|
|
|
|
|
by a_lieb
2529 days ago
|
|
I've always wondered if a good way to do infix would be to simply have the ability to mark an item with a character that means "move this to the front of the expression." Let's say the char is ":". Then this: (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. |
|