Clojure BASICS
Data Types
Data Structures
Data Types
Data Structures
-----------
−−−−−−−−−−−
+
+
Edn
(Extensible Data Notation)
Functions
(defn say-hi
[name]
(print "Hi " name "!"))
(fn [name]
(print "Hi " name "!")
Anonymous fn
(Eval uation)
(. JAVA Interop)
( LISTS )
[ Vectors ]
#{ Sets }
{ Maps }
( SEQUENCE )
#(funCtions)
Higher order fns
Namespaces
(ns clojureba.skynet)
(defn take-over [world]
(prn "I'm taking over the " world
", please stand by..."))
(def targets ["Sarah Connor",
"John Connor"])
src/clojureba/skynet.clj
REQUIRe
(ns clojureba.terminator
(:require [clojureba.skynet :as skynet]))
(defn terminate [target]
(prn "Terminating " target "..."))
(defn terminate-all
[]
(map terminate skynet/targets))
src/clojureba/terminator.clj
Questions?
other Important stuff
-
RecordS
-
Multimethods
-
ProtocoLs
Links
- 4Clojure - online excersices
- Leiningen - build tools
- Clojuredocs - documentation w/ examples
- Google Group - official mailing list
- Rich Hickey's Greatest Hits - talks
- Clojure - source code in GitHub
Clojure 101
By Juan Facorro
Clojure 101
- 506