Skip to content

Commit

Permalink
update clojure.note
Browse files Browse the repository at this point in the history
  • Loading branch information
number23 committed May 16, 2013
1 parent 5c832ea commit 1e02163
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions clojure/clojure.note
Expand Up @@ -54,3 +54,13 @@ user=> (->> 2 ; 2
(/ 2) ; (/ 2 (+ 10 (* 2 2)))
(* 6)) ; (* 6 (/ 2 (+ 10 (* 2 2))))
;=> 6/7

;; from <<Clojure Programming>>, P257.
(defn preserve-metadata
"Ensures that the body containing `expr` will carry the metadata
from `&form`."
[&form expr]
(let [res (with-meta (gensym "res") (meta &form))]
`(let [~res ~expr]
~res)))

0 comments on commit 1e02163

Please sign in to comment.