Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
ClojureScript: Up and Running
Preface
Who Should Read This Book
How to Use This Book
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
Acknowledgments
1. Introduction: Why ClojureScript?
The Rise of Browser Applications
The Rise of JavaScript
The Need for a Better Language
Introducing ClojureScript
2. Hello World
Leiningen
Installing Leiningen on OS X and Linux
Installing Leiningen on Windows
Using lein-cljsbuild
Getting Started with the REPL
Compiling a ClojureScript File to JavaScript
Structuring the Leiningen project
Updating the project configuration
Writing a ClojureScript file
Compiling
Running ClojureScript in the Browser
Other Capabilities of lein-cljsbuild
3. The Compilation Process
Architecture
Google Closure Compiler
The Google Closure Library
ClojureScript and Google Closure
The Compilation Pipeline
How to Compile
Compiling ClojureScript
Hello, Compiler
The Clojure REPL
Compilation in Depth
Compilation Sources
Compilation and Optimization Options
:optimizations
Where do the files go?
Compiling with optimizations
Loading optimized code in a browser
Compiling without optimizations
Loading unoptimized code in a browser
An alternative: pretty-printing
Other Compilation Options
Summary
4. ClojureScript Basics
ClojureScript versus Clojure
Expressions and Side Effects
Syntax and Data Structures
Symbols and Keywords
Data Structures
Special Forms and Definitions
Functions
Multi-Arity Functions
Variadic Functions
Local Bindings
Destructuring
Closures
Flow Control
Conditional Branching
cond
do
when
JavaScript Interop
The js Namespace
Methods and Fields
Constructor Functions
Scope of this
Exceptions
Summary
5. Data and State
Primitives
Strings
Keywords
Symbols
Characters
Numbers
Booleans
Functions
nil
Data Structures
Collection Types
Lists
Vectors
Maps
Sets
Immutability
Why immutability?
Persistence
Identity and State
Atoms
6. Sequences
The Sequence Abstraction
Lazy Sequences
Letting Go of the Head
The Sequence API
map
reduce
filter
Other Useful Sequence Functions
7. Namespaces, Libraries, and Google Closure
Namespaces
Using Namespaces
Using namespaces at the REPL
Using Namespaces Effectively
The Implementation of Namespaces
Namespaces and *.js files
Namespaces and variable names
Advanced Compilation Mode
Consuming Libraries
ClojureScript Libraries
JavaScript Libraries
Google Closure libraries
Plain old JavaScript libraries
With Advanced mode
Without Advanced mode
Creating Libraries
For Consumption by ClojureScript
For Consumption by JavaScript
^:export metadata
8. Macros
Code as Data
Writing Macros
Syntax-Quote
Auto-Gensyms
Using Macros
When to Write Macros
Summary
9. Development Process and Workflow
Installing ClojureScript
Checking Out from Source Control
Downloading a Compressed Archive
Installing Dependencies
The Built-In Tools
Command-Line Compilation
Clojure REPL
ClojureScript REPL
The Browser REPL
Setting Up the Browser REPL
Serving your HTML via Ring and Compojure
Starting the bREPL server
Configuring the bREPL client
Additional lein-cljsbuild Features
Launching a Browser REPL
Custom bREPL Launch Commands
Hooking Into Default Leiningen Tasks
Testing ClojureScript Code
Including ClojureScript in JAR Files
Compiling the Same Code as Clojure and ClojureScript
10. Integration with Clojure
AJAX
The Reader and Printer
Example Client-Server Application
Extending the Reader
User-Defined Tagged Literals
Sharing Code
Summary
A. Libraries
ClojureScript’s Standard Library
Google Closure Library
Domina
Enfocus
Jayq
C2
core.logic
About the Authors
Copyright
← Prev
Back
Next →
← Prev
Back
Next →