-
-
Save tomjack/43e7d7d5248e6d639eea to your computer and use it in GitHub Desktop.
This file contains 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
(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