Looks like Google Groups posting software forced line wraps at less than 80 columns, breaking the code. Lovely. Here's the fn-keywords macro reformatted for 72 column wrapping.
(defmacro fn-keywords "Adds flexible keyword handling to any form which has a parameter list: fn, defn, defmethod, letfn, and others. Keywords may be passed to the surrounding form as & rest arguments, lists, or maps. Lists or maps must be used for functions with multiple arities if more than one arity has keyword parameters. Keywords are bound inside fn-keywords as symbols, with default values either specified in the keyword spec or nil. Keyword specs may consist of just the bare keyword, which defaults to nil, or may have the general form [:keyword-name keyword-default-value* keyword-bound?*]. keyword-bound? is an optional symbol bound to true if the keyword was supplied, and to false otherwise." [kw-spec-raw kw-args & body] (let [kw-spec (map #(if (sequential? %) % [%]) kw-spec-raw) keywords (map first kw-spec) symbols (map (comp symbol name) keywords) defaults (map second kw-spec) destrmap {:keys (vec symbols) :or (apply hash-map (interleave symbols defaults))} supplied (reduce (fn [m [k v]] (assoc m k v)) (sorted-map) (remove (fn [[_ val]] (nil? val)) (partition 2 (interleave keywords (map (comp second rest) kw-spec))))) kw-args-map (gensym)] `(let [kw-args# ~kw-args ~kw-args-map (if (map? kw-args#) kw-args# (apply hash-map kw-args#)) ~destrmap ~kw-args-map] ~@(if (empty? supplied) body `((apply (fn [~@(vals supplied)] ~...@body) (map (fn [x#] (contains? ~kw-args-map x#)) [~@(keys supplied)]))))))) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en