Clojure Standard Library
An annotated reference
Renzo Borgatti
  • MEAP began December 2016
  • Publication in Early 2019 (estimated)
  • ISBN 9781617293580
  • 625 pages (estimated)

The Clojure standard library is a treasure trove of functions and macros that have been battle-tested over the years to solve the most challenging programming problems. Knowing what's available in the standard library not only liberates programmers from mundane tasks like connecting to data sources, parsing XML, dealing with numbers but also more advanced problems like handling concurrency and parallelism. Having a deep knowledge of the Clojure standard library helps you solve problems quickly and more efficiently.

Clojure Standard Library is an extensive reference to the standard library but it doesn't read as a dull list of functions. In addition to providing clear explanations for each topic, this guide is full of real-world examples, links, and background information. The book approaches difficult topics by illustrating them in a readable and pleasant way, using visual structure to emphasize the essential information. The book is designed to be used as a reference, but each function provides an interesting reading on its own, offering insight into functional and general programming. By using this reference, you will be able to make the most idiomatic and efficient choice while developing a Clojure application.

Table of Contents detailed table of contents

Part 1: Introduction

1. Know Your Tools

1.1. Why should I care about the Standard Library?

1.2. Aren't specifications just plain boring?

1.3. The different versions of Clojure

1.4. The Clojure Standard Library

1.5. Making Your Development Life Easier

1.6. The problem of fragmented information

1.7. The well kept secret of the Clojure Ninja

1.8. The perfect companion book

1.9. Summary

Part 2: Fundamentals

2. Creating and manipulating functions

2.1. Function definition

2.1.1. defn and defn-

2.1.2. fn

2.1.3. fn*

2.2. Higher order functions

2.2.1. fnil

2.2.2. comp

2.2.3. complement

2.2.4. constantly

2.2.5. identity

2.2.6. juxt

2.2.7. memfn

2.2.8. partial

2.2.9. every-pred

2.2.10. some-fn

2.3. Threading macros

2.3.1. ->

2.3.2. ->>

2.3.3. as->

2.3.4. cond->

2.3.5. cond->>

2.3.6. some->

2.3.7. some->>

2.4. Function execution

2.4.1. apply

2.4.2. memoize

2.4.3. trampoline

3. Basic Constructs

3.1. Lexical Binding

3.1.1. let and let*

3.1.2. if-let, when-let, if-some and when-some

3.1.3. letfn and letfn*

3.2. Boolean Operators

3.2.1. not

3.2.2. and, or

3.3. Conditional Branching

3.3.1. if, if-not, when and when-not

3.3.2. cond

3.3.3. condp

3.3.4. case and case*

3.4. Iteration and loops

3.4.1. loop, recur and loop*

3.4.2. range

3.4.3. for

3.5. A Glimpse of Collection Processing

3.5.1. first, second and last

3.5.2. map and map-indexed

3.5.3. filter and remove

3.5.4. reduce and reductions

4. Creating and inspecting macros

4.1. defmacro

4.2. macroexpand, macroexpand-1 and macroexpand-all

4.3. quote

4.4. gensym

4.5. definline

4.6. destructure

4.7. clojure.template/apply-template

4.8. clojure.template/do-template

5. Operations on Numbers

5.1. +, -, * and /

5.2. inc and dec

5.3. quot, rem and mod

5.4. max and min

5.5. max-key and min-key

5.6. rand and rand-int

5.7. with-precision

5.8. +', -', *', inc' and dec'

5.9. unchecked-add, unchecked-subtract, unchecked-multiply, unchecked-inc, unchecked-dec and unchecked-negate

5.10. unchecked-add-int, unchecked-add-int, unchecked-subtract-int, unchecked-multiply-int, unchecked-divide-int, unchecked-inc-int, unchecked-dec-int, unchecked-negate-int and unchecked-remainder-int</text>

6. Comparison and Equality

6.1. = (equal) and not= (not equal)

6.2. == (double equal)

6.3. < (less than), > (more than), <= (less than or equal) ( and >= (more than or equal)

6.4. compare

6.5. identical?

6.6. clojure.data/diff

Part 3: Data Structures

7. Collections

7.1. Basics

7.1.1. into

7.1.2. count

7.1.3. nth

7.1.4. empty

7.1.5. every?, not-every?, some and not-any?

7.1.6. empty? and not-empty

7.2. Polymorphic

7.2.1. conj

7.2.2. get

7.2.3. contains?

7.3. General purpose

7.3.1. rand-nth

7.3.2. shuffle

7.3.3. random-sample

7.3.4. frequencies

7.3.5. sort and sort-by

7.3.6. group-by

7.3.7. partition-by

7.3.8. partition and partition-all

7.3.9. flatten

7.3.10. distinct

7.3.11. dedupe

7.3.12. replace

7.3.13. reverse

7.4. WIP

7.4.1. distinct?

7.4.2. peek and pop

8. Sequences

9. Lists

10. Vectors

10.1. vector

10.2. vec

10.3. vector-of

10.4. mapv

10.5. filterv

10.6. subvec

10.7. rseq

11. Sets

12. Maps

Part 4: Common Programming Tasks

13. Strings

14. Regular Expressions

15. Formatting and printing

16. clojure.walk

17. Zippers

18. XML

19. Type Checking and Coercion

20. REPL and Server Socket Support

21. Testing

Part 5: Type Oriented Programming

22. Type Abstraction

23. Polymorphic Dispatch

Part 6: Introspection

24. Creating and Organizing Vars

25. Namespaces

26. Dynamic Variables

27. Code Evaluation

Part 7: Working with Java

28. General Interoperability

29. Java Arrays

30. Exception Handling

Part 8: Concurrency

31. Threads, State and Parallelism

32. Reducers and Transducers

32.1. Reducers

32.1.1. fold

32.1.2. reducer and folder

32.1.3. monoid

32.2. Transducers

32.2.1. transduce

32.2.2. eduction

32.2.3. completing

32.2.4. cat

32.3. reduced, reduced?, ensure-reduced, unreduced

Part 9: Mutability

33. Side Effects and Mutation

34. IO

Part 10: Other functions, macros and namespaces

35. Utils, Helpers and more

36. Special Purpose

Appendixes

Appendix A: Alphabetic Index

Appendix B: Declaration Order Index

Appendix C: Top 100 Clojure most used functions

Appendix D: Functions by Domain

Appendix E: Index of the examples

What's inside

Each function or macro is presented with:

  • An introduction including areas of application and main goals
  • A more rigorous contract section, including parameters and return types
  • Real world examples of the function in action
  • Background and conceptual information necessary to better understand the function
  • Diagrams and comparison tables
  • Implementation details and performance implications

About the reader

For developers of all skill levels who need a thorough reference to Clojure standard library.

About the author

Renzo Borgatti is a software engineer with more than 15 years of experience in the field. Renzo worked with Java, Ruby, and Objective-C before discovering Clojure and functional programming a few years ago, a passion that quickly turned into professional work. He's a frequent speaker at user groups and conferences.


Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
Buy
MEAP eBook $47.99 pdf + ePub + kindle + liveBook

FREE domestic shipping on three or more pBooks