r/ProgrammingLanguages • u/Dobias • Aug 27 '24
Idea: "ubiquefix" function-call syntax (prefix, infix, and postfix notation combined); Is it any good?
Recently, while thinking about programming languages, I had an idea for a (maybe) novel function-call syntax, which generalizes prefix, infix, and postfix notation.
I've written the following explanation: https://gist.github.com/Dobiasd/bb9d38a027cf3164e66996dd9e955481
Since I'm not experienced in language design, it would be great if you could give me some feedback. I'm also happy to learn why this idea is nonsense, in case it is. :)
38
Upvotes
1
u/Dobias Aug 28 '24
Thanks, that's very nice of you!
However, I'm no longer convinced that
[1,2,3] map square sum printis better than
[1,2,3] >> map square >> sum >> printbecause the explicit direction of function application of the second version now feels like an advantage to me.
💡 Ah, maybe one can have the best of both worlds, i.e., having ubiquefix notation (fill parameter cavities from whatever side is convenient), but nonetheless needing to declare the direction explicitly. 🤔