Created
January 21, 2013 23:17
-
-
Save mwarkentin/4590461 to your computer and use it in GitHub Desktop.
Playing with Clojure in Lighttable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Anything you type in here will be executed | |
;; immediately with the results shown on the | |
;; right. | |
(if true 5) | |
"hello world" | |
true | |
*file* | |
+ | |
(+ 1 2 3) | |
(odd? 3) | |
(number? +) | |
(fn? +) | |
(+ 1 (- 4 2)) | |
((fn [n] (+ n n)) 24) | |
(def twice (fn [n] (+ n n))) | |
(twice 44) | |
(def two 2) | |
two | |
(twice two) | |
'(1 2) | |
(list 1 2 3 4) | |
(first '(1 2 3 4)) | |
(rest '(1 2 3 4 5)) | |
(nth '(1 2 3 4) 2) | |
(def second (fn [list] (nth list 1))) | |
(def second (fn [vec] (first (rest vec)))) | |
(second '(3 4 5 6 7)) | |
(def third (fn [list] (nth list 2))) | |
(third '(1 2 3 4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment