Skip to content

Instantly share code, notes, and snippets.

@tomjack tomjack/heart.clj Secret
Created Apr 12, 2010

Embed
What would you like to do?
(ns scratch.heart)
(defmacro <3
([x] x)
([x mode form]
(case mode
-> `(-> ~x ~form)
->> `(->> ~x ~form)))
([x mode form & more]
`(<3 (<3 ~x ~mode ~form) ~@more)))
;; (<3 [1 2 3] -> (conj 4) ->> (map inc) ->> (filter even?) -> (concat [5 7]))
;; (concat (filter even? (map inc (conj [1 2 3] 4))) [5 7])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.