Skip to content

Latest commit

 

History

History
47 lines (37 loc) · 1.32 KB

20210728234216-clojure.org

File metadata and controls

47 lines (37 loc) · 1.32 KB

Clojure

Using Emacs with Clojure

Captured On: [2021-08-26 Thu 09:02]

[2021-07-21 Wed] Examples of Clojure arrow macro

bb '(-> 3 (+ 2))'

5

~ bb ‘(-> 3 (- 2))’ 1

~ bb ‘(->> 3 (- 2))’ -1

~ bb ‘(- 2 3)’ -1

~ bb ‘(-> 2 (- 3))’ -1

bb '(-> "world" (print "hello"))'

world hello%

~ bb ‘(-> “world” (println “hello”))’ world hello

~ bb ‘(->> “world” (println “hello”))’ hello world

~ bb ‘(-> “Thean” (println “hello” “world”))’ Thean hello world

~ bb ‘(->> “Thean” (println “hello” “world”))’ hello world Thean

~ bb ‘(-> 3 - 2)’ ----- Error -------------------------------------------------------------------- Type: java.lang.Exception Message: Cannot call 2 as a function. Location: <expr>:1:1