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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -