Skip to content

Instantly share code, notes, and snippets.

@vishnuvp
Created February 1, 2019 08:43
Show Gist options
  • Save vishnuvp/870c1e3d921274a3e9fe9a25efaaadf7 to your computer and use it in GitHub Desktop.
Save vishnuvp/870c1e3d921274a3e9fe9a25efaaadf7 to your computer and use it in GitHub Desktop.
Clojure is homoiconic
user=> (+ 1 1)
2
user=> (defn to-word [symbol]
#_=> (case symbol
#_=> + `plus
#_=> 1 `one
#_=> 2 `two
#_=> 3 `three
#_=> 4 `four
#_=> 5 `five
#_=> 6 `six
#_=> 7 `seven
#_=> 8 `eight
#_=> 9 `nine
#_=> 0 `zero
#_=> ))
#'user/to-word
user=> (to-word 1)
user/one
user=> (quote (+ 1 1))
(+ 1 1)
user=> (map to-word (quote (+ 1 2)))
(user/plus user/one user/two)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment