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 p…
Mirth – a type-safe concatenative purely functional programming language
61–70 of 76 posts
Re: Mirth – a type-safe concatenative purely functional programming language
#62Earlier quoted context omitted.
I know you are a gigantic egomaniac and I'm wasting my time writing this, but if you could ever repress your inflated sense of (mis)justice for two seconds, you might notice that the poster actually asked a perfectly valid question. With the context presented so far (zero, for those keeping score at home), there's no reason to assume that the poster is dismissive of the project being discussed. Why IS Mirth needed, w…
> I know you are a gigantic egomaniac and I'm wasting my time writing this, but if you could ever repress your inflated sense of (mis)justice for two seconds, you might notice that the poster actually asked a perfectly valid question. Also a perfectly trivial one, an insulting one, and one that has been asked countless times, and that has no real place in a post presenting a new language but goes to meta yak shaving…
Re: Mirth – a type-safe concatenative purely functional programming language
#63Earlier quoted context omitted.
There exist other languages in the category, e.g. https://kittenlang.org/ , http://www.factorcode.org/ , https://github.com/cdiggins/cat-language , https://en.m.wikipedia.org/wiki/Joy_(programming_language) . I assume the parent poster referred to improving those (or at least explaining which deficiencies of those myrth is addressing). (In case you didn't already, you can read about this family of languages in http:/…
Note that none of these languages have dependent types and that feature is sometimes impossible to add in full generic power after the fact without completely breaking existing code.
Re: Mirth – a type-safe concatenative purely functional programming language
#64Earlier quoted context omitted.
Some examples here: https://twitter.com/afsofia_/status/1105913438650486784
I have no idea how to read or make sense of these definitions. I mean semantically and grammatically. What should I read if I want to understand those snippets and how/why they do define what an addition is?
succ : Nat -- Nat
means that if you can prove there is a Nat, n on the top of the stack, you can do succ to replace that with a Nat, succ n. Similarly we have: + : Nat Nat -- Nat
Which says if you have two Nats on the top of the stack you can do + to get a single Nat.The next weird thing is pattern matching. + is defined with two cases. The first is:
zero + = id
Which makes some sense: to add zero to x, do nothing. Making up a variable syntax it would look like: zero + =
The pattern matching on the next line is harder: succ + = + succ
Which (making up syntax again) says that if your stack looks like: m n
And n = succ k: m (succ k)
And you do +, you “unapply” succ to get a “stack” that looks like: m k succ
With the application of + shown: m k succ +
And this matches the pattern above so we transform: m k + succ
And evaluate: (m+k) succ
(m+k+1)
(m+n)
I think this is a rough idea of how the basic types work: Denote a “stack” of types (e.g. Nat Nat above) as [a], and single types a.
If e : [a] -- [b] then for any [c], e : [c] [a] -- [c] [b]
If dashes are omitted from a type a, it is the same as the type -- a (ie [b] -- [b] a for any [b])
If e : [a] -- [b] and f : [b] -- [c] then e f : [a] -- [c]
To define a word w : [a] -- [b], e w = f is a valid clause if:
1. e has type [c] -- [a]
2. f has type [c] -- [b]
3. e is a valid pattern (ie made out of constructors (?))
I guess the rest of the typing rules are more complicated.Re: Mirth – a type-safe concatenative purely functional programming language
#65Earlier quoted context omitted.
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 p…
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.
Re: Mirth – a type-safe concatenative purely functional programming language
#66I was interested by the title, but it really needs a quick-start + examples in the readme.
I've looked at some basic library code that is implemented as part of the compiler, and... well, I'm not sure about this. The syntax does not really seem reminiscent of concatenative languages ala FORTH, so in what sense is this a "concatenative" language? The documentation doesn't say - there is no documentation to speak of. I'm not going to dismiss the effort that has been put into this already, but I'd sure like t…
Re: Mirth – a type-safe concatenative purely functional programming language
#67Earlier quoted context omitted.
> I know you are a gigantic egomaniac and I'm wasting my time writing this, but if you could ever repress your inflated sense of (mis)justice for two seconds, you might notice that the poster actually asked a perfectly valid question. Also a perfectly trivial one, an insulting one, and one that has been asked countless times, and that has no real place in a post presenting a new language but goes to meta yak shaving…
Seeing as his account is 11 hours old as of my writing this and that this is his only comment I have a little paranoid-detective feeling that this may be from PC, just an alt account, even if not they are clearly a very angry person
Re: Mirth – a type-safe concatenative purely functional programming language
#68Earlier quoted context omitted.
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.
Re: Mirth – a type-safe concatenative purely functional programming language
#69Earlier quoted context omitted.
1. Pick one of those langs. 2. Build a product. 3. ??? 4. Profit.
1. Done 2. Done 3. ??? 4. It's open source (damn it!)
Be the change you want to see!
Re: Mirth – a type-safe concatenative purely functional programming language
#70Very 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”.
Interestingly, PostScript is also concatenative.
If you've ever used an RPN calculator, you almost understand how concatenative languages work!