Skip to content

Instantly share code, notes, and snippets.

@jclaggett
Created August 25, 2010 16:40
Show Gist options
  • Save jclaggett/549822 to your computer and use it in GitHub Desktop.
Save jclaggett/549822 to your computer and use it in GitHub Desktop.
; Experiment with 'foo' blocks as an alternative to -> and ->>.
(defmacro foo
([] '%)
([form & more]
`(let [~'% ~form] (foo ~@more))) )
(def foo-ex1
(foo
1
(+ 1 %)
(/ % 2) ) )
(def foo-ex2
[
'(->>
(map vector (range) coll)
(filter (fn [[i & args]] (apply f args)))
(map first))
'(foo
(map vector (range) coll)
(filter (fn [[i & args]] (apply f args)) %)
(map first %)) ] )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment