售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Clojure for Java Developers
Table of Contents
Clojure for Java Developers
Credits
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Piracy
Questions
1. Getting Started with Clojure
Getting to know Clojure
Installing Leiningen
Using a REPL
The nREPL protocol
Hello world
REPL utilities and conventions
Creating a new project
Project structure
Creating a standalone app
Using Cursive Clojure
Installing Cursive Clojure
Getting started with Clojure code and data
Lists in Clojure
Operations in Clojure
Functions in Clojure
Clojure's data types
Scalars
Collection data types
Summary
2. Namespaces, Packages, and Tests
Namespaces in Clojure
Packages in Clojure
The classpath and the classloader
Back to Clojure namespaces
Playing with namespaces
Creating a new namespace
Working with namespaces on the REPL
Testing in Clojure
Testing from the command line
Testing in IntelliJ
Summary
3. Interacting with Java
Using Maven dependencies
Clojure interop syntax
Creating an object
Calling an instance method
Calling a static method or function
Accessing inner classes
Writing a simple image namespace
Writing the tests
The let statement
Destructuring in Clojure
Sequential destructuring
Associative destructuring
Exposing your code to Java
Testing from Groovy
Proxy and reify
Summary
4. Collections and Functional Programming
Basics of functional programming
Persistent collections
Types of collections in Clojure
The sequence abstraction
Specific collection types in Clojure
Vectors
Lists
Maps
Sorted maps and hash maps
Common properties
Sets
Sorted sets and hash sets
Common properties
Union, difference, and intersection
Applying functional programming to collections
The imperative programming model
The functional paradigm
Functional programming and immutability
Laziness
Summary
5. Multimethods and Protocols
Polymorphism in Java
Multimethods in Clojure
Keyword hierarchies
isa?
parents
descendants
underive
A la carte dispatch functions
Protocols in Clojure
Records in Clojure
Summary
6. Concurrency
Using your Java knowledge
The Clojure model of state and identity
Promises
Pulsar and lightweight threads
Futures
Software transactional memory and refs
Atoms
Agents
Validators
Watchers
core.async
Why lightweight threads?
Goblocks
Channels
Transducers
Summary
7. Macros in Clojure
Lisp's foundational ideas
Macros as code modification tools
Modifying code in Java
Modifying code in Groovy
The @ToString annotation
The @TupleConstructor annotation
The @Slf4j annotation
Writing your first macro
Debugging your first macro
Quote, syntax quote, and unquoting
Unquote splicing
gensym
Macros in the real world
References
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜