Macro want to use symbol instead of string in clojure -


so trying make haskell lambda syntax, , macro i've got:

(defmacro / [& all]   (let [args (take-while #(not (= %1 "=>")) all)         argcount (count args)         expr (last (split-at (+ argcount 1) all))]     `(fn ~(vec args) (~@expr))))  (reduce (/ x y "=>" + x y) [1 2 3]) 

this works enough, last thing i'd make don't need "=>" can use =>

any tips how might make => valid symbol can parse in context i'm referring?

compare name of symbol against string:

(defmacro / [& all]   (let [args (take-while #(not (= (name %1) "=>")) all)         argcount (count args)         expr (last (split-at (+ argcount 1) all))]     `(fn ~(vec args) (~@expr)))) 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -