Created
August 5, 2009 20:17
-
-
Save fffej/162926 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro accum | |
[f body] | |
`(with-local-vars [acc# (transient []) | |
~f (fn [x#](conj! (var-get acc#) x#))] | |
~body | |
(persistent! (var-get acc#)))) | |
(defn my-keys [m] (accum a (doseq [[k v] m] (a k)))) | |
(defn my-vals [m] (accum a (doseq [[k v] m] (a k)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment