Created
July 2, 2013 08:01
-
-
Save zmack/5907513 to your computer and use it in GitHub Desktop.
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
(print [1 2 3 4 5]) | |
(seq {:a 1 :b 2}) | |
((fn foo [x] (when (> x 0) (conj (foo (dec x)) x))) 5) | |
(seq (reverse (range 1 6))) | |
(-> (range 5) reverse filter `#(% > 1)) | |
(-> [2 5 4 1 3 6] reverse rest sort last) | |
(->> '(2 5 4 1 3 6) (drop 2) (take 3) (map inc) (reduce +)) | |
(filter odd? #{1 2 3 4 5}) | |
((fn [index] | |
(loop [a 0 b 1 n index acc []] | |
(if (> n 0) | |
(recur b (+ a b) (dec n) (cons a acc)) | |
(reverse acc) | |
) | |
) | |
) | |
10) | |
((fn [thing] | |
(if (seq? thing) | |
thing | |
[thing] | |
)) #{1 2 3 4}) | |
((fn [thing] | |
(= (reverse thing) | |
(reverse (reverse thing)))) '(1 2 3 4 5)) | |
(= (reverse "racecar") "racecar") | |
(cons 3 [1 2 3]) | |
(fn [a b c n] | |
(if (> n 0) | |
(print a b c n) | |
) | |
) | |
((fn[separator items] | |
(rest | |
(reverse | |
(flatten | |
(map list (reverse items) (repeat (count items) separator)))))) | |
0 [1 2 3 4]) | |
((fn [min-value max-value] | |
(loop [min min-value max (- max-value 1) acc '()] | |
(if (> min max) | |
acc | |
(recur min (- max 1) (cons max acc))))) 10 20) | |
((fn [my-list] | |
(reverse (loop [my-list my-list acc '()] | |
(if (empty? my-list) | |
acc | |
(if (= (first acc) (first my-list)) | |
(recur (rest my-list) acc) | |
(recur (rest my-list) (cons (first my-list) acc))))))) "LEEEEEEEROOOOOOYYYYYYYYY") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment