by tgbugs · 7y ago · 0 comments
(1 :+ 2)
Would be converted to this: (+ 1 2)
It would also allow for arbitrary placement, so you can do goofy stuff like pretend to be Forth without writing custom macros for the situation: (1 2 3 4 5 :+)
Whether or not that part is an advantage is another story ;)This doesn't solve the "too many parens" problem, because you still have parens, but it does solve the "prefix math looks weird" problem. It's quite a bit simpler than what Dylan does, in that there's no special concept of "binary operators" and it's obvious at a glance how everything converts to sexps.
AFAIK it works for any operator that takes two operands (or more, but it makes less sense to be using it with three or more operands.)
e.g:
> '(arg0 . operator . arg1 arg2)
'(operator arg0 arg1 arg2)