| 3 weeks ago (http://arclanguage.org/item?id=18044) I said that arc can merge clojure's -> and ->> operators thanks to its [.. _ ..] syntax for simple functions. I just added this to wart without any reader changes: mac (x -> f)
`(,f ,x)
mac (x -> f) :case (mem? '_ f)
`((fn(_) ,f) ,x)
Now I can do things like: 3 -> _+1
The catch of course is that '_ is now special inside ->, and that only the pipe operator supports the simpler syntax for anonymous functions. Not as powerful, but still worthwhile given how nicely you can break down ssyntax chaining when there's a string or expression in between: a.b."foo".c.d # illegal
(a.b "foo") -> _.c.d # legal
The interruption here has a proportionate effect; you can keep ssyntax before and after it. In arc you have to unwind the entire thing: (((a.b "foo") c) d)
Thoughts? |