Skip to content

Instantly share code, notes, and snippets.

@timmc
Created August 11, 2011 02:43
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 timmc/1138805 to your computer and use it in GitHub Desktop.
Save timmc/1138805 to your computer and use it in GitHub Desktop.
Playing around with name composition
(defmacro kf [& args]
(let [is-key #(= \_ (last (str %)))
ks (filter is-key args)
as (filter (complement is-key) args)]
(let [n (symbol (apply str (map name ks)))]
`(~n ~@as))))
(defn do_not_ [a b] a)
(kf do_ 2 not_ (+ 3 4)) ;; (do_not_ 2 (+ 3 4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment