Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
(defmacro ->r
"The proposed Rohner arrow"
([x] x)
([x form] (if (seq? form)
(with-meta (replace {'_ x} form) (meta form))
(list form x)))
([x form & more] `(->r (->r ~x ~form) ~@more)))
(use 'clojure.walk)
user=>(macroexpand-all '(->r c (+ _ 32) (* 1.8 _)))
(* 1.8 (+ c 32))
user=>(macroexpand-all '(->r c count))
(count c)
user=>(macroexpand-all '(->r [] (conj _ 1) (into _ [2 3]) (map inc _) (mapcat #(vector % %) _) (vec _) (conj _ 5 5)))
(conj (vec (mapcat (fn* [p1__3706] (vector p1__3706 p1__3706)) (map inc (into (conj [] 1) [2 3])))) 5 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment