summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-02-25 14:35:39 +0000
committerRich Hickey <richhickey@gmail.com>2008-02-25 14:35:39 +0000
commit94df1890fd050a59992a1cc45bcf6e10ae8539dc (patch)
treec19dadbf238fa80c04c8bb0a96ff3d91514dcfa1 /src
parent694abf6d09de56e6c03d89650143fc1a5f5075df (diff)
added symbol support for ->, so (-> x :a) ==> (:a x)
Diffstat (limited to 'src')
-rw-r--r--src/boot.clj9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/boot.clj b/src/boot.clj
index ac49bbb8..d5cfea51 100644
--- a/src/boot.clj
+++ b/src/boot.clj
@@ -699,10 +699,13 @@ locking [x & body]
([x form & more] `(.. (. ~x ~form) ~@more)))
(defmacro
- #^{:doc "Macro. Threads the expr through the forms. Inserts expr as the second item in the first form.
- If there are more forms, inserts the first form as the second item in second form, etc."}
+ #^{:doc "Macro. Threads the expr through the forms. Inserts expr as the second item in the first form,
+ making a list of it if it is not a list already. If there are more forms, inserts the first form as the
+ second item in second form, etc."}
->
- ([x form] `(~(first form) ~x ~@(rest form)))
+ ([x form] (if (seq? form)
+ `(~(first form) ~x ~@(rest form))
+ (list form x)))
([x form & more] `(-> (-> ~x ~form) ~@more)))
;;multimethods