Skip to content

Instantly share code, notes, and snippets.

@sritchie
Created March 30, 2011 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sritchie/895353 to your computer and use it in GitHub Desktop.
Save sritchie/895353 to your computer and use it in GitHub Desktop.
(defmacro defphase
[name & rest]
(let [[name [argvec body]]
(name-with-attributes name rest)]
`(def ~name
(phase-fn ~argvec ~body))))
(defmacro let-with-arg->
"A `let` form that can appear in a request thread, and assign the
value of the threaded arg.
eg.
(-> 1
(let-with-arg-> val [a 1]
(+ a val)))
=> 3"
[arg arg-symbol binding & body]
`(let [~arg-symbol ~arg
~@binding]
(-> ~arg-symbol ~@body)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment