Programming Clojure
Samenvatting
Drowning in unnecessary complexity, unmanaged state, and tangles of spaghetti code? In the best tradition of Lisp, Clojure gets out of your way so you can focus on expressing simple solutions to hard problems. Clojure cuts through complexity by providing a set of composable tools--immutable data, functions, macros, and the interactive REPL. Written by members of the Clojure core team, this book is the essential, definitive guide to Clojure. This new edition includes information on all the newest features of Clojure, such as transducers and specs.
Clojure joins the flexibility and agility of Lisp with the reach, stability, and performance of Java. Combine Clojure's tools for maximum effectiveness as you work with immutable data, functional programming, and safe concurrency to write programs that solve real-world problems.
Start by reading and understanding Clojure syntax and see how Clojure is evaluated. From there, find out about the sequence abstraction, which combines immutable collections with functional programming to create truly reusable data transformation code. Clojure is a functional language; learn how to write programs in a functional style, and when and how to use recursion to your advantage. Discover Clojure's unique approach to state and identity, techniques for polymorphism and open systems using multimethods and protocols, and how to leverage Clojure's metaprogramming capabilities via macros. Finally, put all the pieces together in a real program.
New to this edition is coverage of Clojure's spec library, one of the most interesting new features of Clojure for describing both data and functions. You can use Clojure spec to validate data, destructure data, explain invalid data, and generate large numbers of tests to verify the correctness of your code.
With this book, you'll learn how to think in Clojure, and how to take advantage of its combined strengths to build powerful programs quickly.
What You Need:
- Java 6 or higher
- Clojure 1.9
Specificaties
Over Aaron Bedra
Inhoudsopgave
Introduction
Who This Book Is For
What’s in This Book
How to Read This Book
Notation Conventions
Web Resources and Feedback
Downloading Sample Code
1. Getting Started
Simplicity and Power in Action
Clojure Coding Quick Start
Navigating Clojure Libraries
Wrapping Up
2. Exploring Clojure
Reading Clojure
Functions
Vars, Bindings, and Namespaces
Metadata
Calling Java
Comments
Flow Control
Where’s My for Loop?
Wrapping Up
3. Unifying Data with Sequences
Everything Is a Sequence
Using the Sequence Library
Lazy and Infinite Sequences
Clojure Makes Java Seq-able
Calling Structure-Specific Functions
Wrapping Up
4. Functional Programming
Functional Programming Concepts
How to Be Lazy
Lazier Than Lazy
Recursion Revisited
Eager Transformations
Wrapping Up
5. Specifications
Defining Specs
Validating Data
Validating Functions
Generative Function Testing
Wrapping Up
6. State and Concurrency
Concurrency, Parallelism, and Locking
Refs and Software Transactional Memory
Use Atoms for Uncoordinated, Synchronous Updates
Use Agents for Asynchronous Updates
Managing Per-Thread State with Vars
A Clojure Snake
Wrapping Up
7. Protocols and Datatypes
Programming to Abstractions
Interfaces
Protocols
Datatypes
Records
reify
Wrapping Up
8. Macros
When to Use Macros
Writing a Control Flow Macro
Making Macros Simpler
Taxonomy of Macros
Wrapping Up
9. Multimethods
Living Without Multimethods
Defining Multimethods
Moving Beyond Simple Dispatch
Creating Ad Hoc Taxonomies
When Should I Use Multimethods?
Wrapping Up
10. Java Interop
Creating Java Objects in Clojure
Calling Clojure From Java
Exception Handling
Optimizing for Performance
A Real-World Example
Wrapping Up
11. Building an Application
Getting Started
Developing the Game Loop
Representing Progress
Implementing Players
Interactive Play
Documenting and Testing Your Game
Farewell
Bibliography
Anderen die dit boek kochten, kochten ook
Net verschenen
Rubrieken
- aanbestedingsrecht
- aansprakelijkheids- en verzekeringsrecht
- accountancy
- algemeen juridisch
- arbeidsrecht
- bank- en effectenrecht
- bestuursrecht
- bouwrecht
- burgerlijk recht en procesrecht
- europees-internationaal recht
- fiscaal recht
- gezondheidsrecht
- insolventierecht
- intellectuele eigendom en ict-recht
- management
- mens en maatschappij
- milieu- en omgevingsrecht
- notarieel recht
- ondernemingsrecht
- pensioenrecht
- personen- en familierecht
- sociale zekerheidsrecht
- staatsrecht
- strafrecht en criminologie
- vastgoed- en huurrecht
- vreemdelingenrecht