Functional Programming

Clojure

Basic functions:

(println "Hello, Clarice")
(str 3 " " 2 " " 1 " " "Blast off!") ; Fly to the moon
(count "Hello, Clarice") ; 12
(println true)
(println false)
(println "Home:" nil)

Arithmetic

(+ 1900 84) ;1984
(* 16 124)  ;1984
(- 2000 16) ;1984
(/ 25792 13);1984
(/ 8 3)     ; will get 8/3
(quot 8 3)  ; will get 2

By default, Clojure turns unadorned numeric literals into integers.

Updated:

Leave a Comment