Hacker News new | past | comments | ask | show | jobs | submit login

Very random question. It’s the first I come across a concatenative programming language. Is SQL also concatenative in a way? I am thinking what you can do by chaining subqueries together for instance using “WITH”.



Not at all. "Concatenative"[1] is a property of a language syntax; broadly speaking, it holds that an arbitrary expression in the program text can be understood as a sequence of words, and any subsequence is in some sense meaningful; that is, the semantics of the expression as a whole is derived by "concatenating" the semantics of each word, and this semantic "concatenation" is consistent in that it can be used to provide a semantics to any subsequence.

[1] https://en.wikipedia.org/wiki/Concatenative_programming_lang...

This all works well for untyped languages (FORTH is untyped, as an example), but once you add in reasonably complex types you can't really use "sequences" alone, anymore; the directly comparable property is instead true of string diagrams. And once you add some more complexity, you even have to deal with, e.g. proof nets. There are ways to simplify textual syntaxes like e.g. typed lambda calculus along 'concatenative' lines, but mostly these are simple tweaks (De Bruijn notation, and/or De Bruijn indexes) that don't really create a "different" language.


Would you be willing to point me to some research/articles related to your statement about complex types? I'm (also) working on a statically-typed, concatenative programming language. It's for fun. I'd like to learn more about this topic.


See https://arxiv.org/abs/0903.0340 for a basic introduction to the issues, and https://arxiv.org/abs/0908.3347 for a slightly more extensive treatment, also mentioning proof nets. This does not explicitly say that these diagrams can be understood as the equivalent to sequences in something FORTH-like, but this is in fact what the papers are pointing out in a general sense, so I see it as a rather trivial remark.


Thank you!


FORTH was (I think?) one of the first concatenative languages, if not the first.

Interestingly, PostScript is also concatenative.

If you've ever used an RPN calculator, you almost understand how concatenative languages work!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: