6. Data Structures
● Lists (1 2 3)
● Vectors [1 2 3]
● Maps {:a 1 :b 2}
maps are functions of their keys
● Sets #{1 2}
7. Data Structures (contd.)
● Clojure data structures are
○ persistent
■ previous version remains intact when modified
○ immutable
○ support proper equality semantics in their
implementation of equals
8. Syntax
● We’ve just seen it !!
● No text based syntax
● Data structures are the code
Homoiconicity
● Actually, syntax is in the interpretation of
data structures
10. Expressions
● Everything is an expression
● All data literals represent themselves,
except
○ symbols - looks for binding to value
○ lists - an operation form
■ (operation arguments)
■ operation can be special ops, macros or
functions
11. Special ops/forms
● Can have non-normal evaluation of
arguments
○ (def name value-expr)
○ (if test-expr then-expr else-expr)
■ conditional, evaluates only one of then/else
● fn, let, loop, recur, do, new, ., throw, try,
set!, quote, var, monitor-enter, monitor-
exit
12. Functions
● First class values
○ (def five 5)
○ (def add-1 (fn[x] (+ x 1)))
○ (add-1 five) = 6
● Higher order functions (HOF)
● fn special op is used to create functions
13. Lots of other stuff
● Software Transactional Memory
● Macros
● Lazy Sequences
● Metadatas