Reputation: 5967
Trying to create a macro form of Haskell's lambda syntax, I'm pretty close except one last tweak, the / (which should be a \, but can't grumble..) needs a space next to it, is there any way to make it so my macro doesn't need space between it and it's first argument?
for instance:
(reduce (/x y -> x y) [1 2 3])
instead of:
(reduce (/ x y -> x y) [1 2 3])
I suspect this isn't possible, but only way to know for sure is to ask people who know, so what's the word?
Upvotes: 2
Views: 132
Reputation: 92067
No, but if you wanted to do something more ambitious, you could define another macro with-haskell-lambdas
that you wrap your entire namespace in. That macro could look through all the forms under it, eg with tree-seq, find symbols of the form /x
, and replace them with / x
instead.
Upvotes: 2
Reputation: 15769
No. Macros cannot change the lexical syntax of the language. That requires read-macros, which Clojure doesn't have.
Upvotes: 5