Live data from Hacker News

Mirth – a type-safe concatenative purely functional programming language

github.com

61–70 of 76 posts

Re: Mirth – a type-safe concatenative purely functional programming language

#61
post #50

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…

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

#62
post #60

Earlier 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…

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

#63
post #33
post #24

Earlier 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.

I think there is some misunderstood. I just saw mentions of java and python and I just wanted to add some pointers for people who might not know that myrth lives in a void. I didn't want to imply that there is no point in writing a new language.

Re: Mirth – a type-safe concatenative purely functional programming language

#64

Earlier 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?

The first confusing thing is the type signatures. Concatenative languages pass everything around with a stack so here the double dash separates a top part of the stack before application from what the application of the word transforms that bit of the stack into, so:

  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

#65
post #61

Earlier 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.

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

#66

I 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…

Are we looking at the same thing? It’s definitely a post-fix stack based language. It just also has strong ML-like types.

Re: Mirth – a type-safe concatenative purely functional programming language

#67
post #60

Earlier 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

[deleted]

Re: Mirth – a type-safe concatenative purely functional programming language

#68
post #61

Earlier 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.

Thank you!

Re: Mirth – a type-safe concatenative purely functional programming language

#69

Earlier 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!)

Well next time make something that you can turn into a viable business and build an org around that lang and that culture.

Be the change you want to see!

Re: Mirth – a type-safe concatenative purely functional programming language

#70
post #50

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”.

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!

Post reply on HN