r/Forth • • Jan 26 '19

How Forth helps learning Haskell !!!

https://groups.google.com/forum/#!topic/comp.lang.forth/lpYwr5JtGbc
0 Upvotes

4 comments sorted by

1

u/[deleted] Jan 27 '19

Having some experience from both languages, I can see where this is coming from.

Forth words compose similarly to Haskell functions, both allow leaving things unsaid and implicit that are explicit in most languages. But the control you have over the parameter stack in Haskell is much more formalized.

My own baby, Snigl (https://gitlab.com/sifoo/snigl); takes Forth several steps further in the general direction of Haskell.

1

u/wengchunkn Jan 27 '19

Nice work.

I have bee told about another similar project Kitten:

https://groups.google.com/d/msg/comp.lang.forth/lpYwr5JtGbc/rapxAeHQDQAJ

On an organizational level, I believe your project, Kitten and others could be group under Stack Machine Metaprogramming (SMMP) -- whose goal is to produce a Forth like reverse Polish notation that can "UNIFY" as many programming languages as possible (theoretically ALL of them -- as RPN is equivalent to abstract syntax tree).

https://github.com/udexon/SMMP

On the practical and technical level, I am inclined to produce a "shallow" "syntactic translator" as demonstrated in the following example for C/C++:

https://github.com/udexon/5CSM/tree/master/SMPG/CSM_5GL

I would leave the actual working of the target programming language (i.e. C/C++ or Haskell) to their respective interpreters or compilers. In this case, my RPN can be deployed regardless of the internal changes due to development of the target language, also, I do not need to maintain the resource to handle the equivalent of a monster in terms of software engineering.

In the short term, I buy time to get more younger programmers interested in my 5GL (Fifth Generation Graph Language, a pun to Forth). When we have more followers, then they would be able to attack the modular work.

2

u/jephthai Jan 27 '19

A very enthusiastic post indeed, but most Forth programs are about as imperative as you get, with maximum side effects. I do think you can write Forth in a functional style, but it's not as idiomatic (or at least, as historically normal, anyway).

0

u/agumonkey Jan 28 '19

people doing concatenative programming do have fp in mind I believe