A bit from the readme appreciating concatenative programming:
The Joy language introduced concatenative functional programming. This generally means a stack based virtual machine, and a program consisting of words which are functions taking an input stack and returning an output stack. The natural syntax that results is postfix. Over a very long time I have come to feel that syntax gets in between me and the power in a language. Postfix is the least syntax possible.
There are several reasons I like the concatenative style of programming:
-
Function composition is concatenation.
-
Pipelining values through functions to get new values is the most natural idiom.
-
Functions are applied from left to right instead of inside out.
-
Support for multiple return values comes for free.
-
No need for operator precedence.
-
Fewer delimiters are required:
- Parentheses are not needed to control operator precedence.
- Semicolons are not needed to separate statements.
- Commas are not needed to separate arguments.
(Note: Sapf is inspired by, but is not purely a concatenative language because it has lexical variables.)
When I am programming interactively, I most often find myself in the situation where I have a value and I want to transform it to something else. The thing to do is apply a function with some parameters. With concatenative programming this is very natural. You string along several words and get a new value.
-