clojure_programming.pdf
(
10307 KB
)
Pobierz
Clojure Programming
Chas Emerick, Brian Carper, and Christophe Grand
Beijing
•
Cambridge
•
Farnham
•
Köln
•
Sebastopol
•
Tokyo
Clojure Programming
by Chas Emerick, Brian Carper, and Christophe Grand
Copyright © 2012 Chas Emerick, Brian Carper, and Christophe Grand. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (http://my.safaribooksonline.com). For more information, contact our
corporate/institutional sales department: (800) 998-9938 or
corporate@oreilly.com.
Editors:
Mike Loukides and Julie Steele
Production Editor:
Teresa Elsey
Copyeditor:
Nancy Reinhardt
Proofreader:
Linley Dolby
April 2012:
First Edition.
Indexer:
Fred Brown
Cover Designer:
Karen Montgomery
Interior Designer:
David Futato
Illustrator:
Robert Romano
Revision History for the First Edition:
2012-03-28
First release
2014-05-14
Second release
See
http://oreilly.com/catalog/errata.csp?isbn=9781449394707
for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc.
Clojure Programming,
the image of a painted snipe, and related trade dress are
trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
ISBN: 978-1-449-39470-7
[LSI]
1399902269
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
1. Down the Rabbit Hole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Why Clojure?
Obtaining Clojure
The Clojure REPL
No, Parentheses Actually Won’t Make You Go Blind
Expressions, Operators, Syntax, and Precedence
Homoiconicity
The Reader
Scalar Literals
Comments
Whitespace and Commas
Collection Literals
Miscellaneous Reader Sugar
Namespaces
Symbol Evaluation
Special Forms
Suppressing Evaluation: quote
Code Blocks: do
Defining Vars: def
Local Bindings: let
Destructuring (let, Part 2)
Creating Functions: fn
Conditionals: if
Looping: loop and recur
Referring to Vars: var
Java Interop: . and new
Exception Handling: try and throw
Specialized Mutation: set!
Primitive Locking: monitor-enter and monitor-exit
Putting It All Together
1
3
3
6
7
9
12
13
18
19
19
20
20
23
23
24
25
26
27
28
36
42
43
44
44
45
45
45
46
iii
Plik z chomika:
Leniek
Inne pliki z tego folderu:
clojure_cookbook.pdf
(9759 KB)
becoming_functional.pdf
(7143 KB)
clojure_programming.pdf
(10307 KB)
functional_javascript.pdf
(7547 KB)
functional_thinking.pdf
(6639 KB)
Inne foldery tego chomika:
advanced_ai_by_morgan_claypool
ai_and_machine_learning_toolkit_by_morgan_and_claypool_publishers
applied_math_and_statistics_toolkit_by_morgan_and_claypool
applied_math_productivity_by_mercury
applied_mathematics_by_mercury
Zgłoś jeśli
naruszono regulamin