Want to make a hacker laugh? Say "Forth is the dual of Lisp" to someone familiar with both languages. It seems they reach the same goal of a totally programmable programming language through completely opposite approaches.
Years ago I made it partway through this early LISP manual co-authored by a young John McCarthy before his move to Stanford: http://www.softwarepreservation.org/projects/LISP/book/LISP%...
I remember thinking:
1) They did not mess around in the 1960s. No "Hello World," no promises, no sales pitch. Just an in-yer-face "Here's how we do things downtown"
2) They defined a language in terms of itself. I still don't get all that implies but, damn, they can do that?
Reminds me of the plethora of compilers written in the languages they're meant to compile. (Roslyn, Java compiler, F# compiler, etc.)
The spec for a language is harder to define than the compiler for it. The spec for Lisp is written in Lisp. And it's about half a page of Lisp code. And it's executable, which is not usually true with specs.
This is why reading the Lisp spec feels like reading "the Maxwell's equations of software" (to quote Alan Kay). It's a whole other fundamental model of computation, every bit as fundamental as a Turing machine, but much more practical. Nobody builds serious computing engines out of pure Turing machines, but people do it all the time with McCarthy machines.
And you're right, there's absolute magic in old computing papers. They were pioneers. I wish we could see more of this pioneering spirit combined with todays silicon and ease of international communication.
Aside from the functional vs concatenative paradigms, they share a lot of development philosophy, and give a lot of the same superpowers to the developers.
They're both the same basic idea, just that Forth is a much more radical low-level implementation of that idea (e.g. it was just perfect for minimal 8-bit home computers).
Forth is execution that happens to have some syntax.
If you want a dual of lisp you need to look at Joy or Factor.
From talking to several people who've implemented things like this, I think they would've said the same thing before.
Nobody walks around knowing how to implement these kinds of things. If you need it, you just start trying, learning, reading, etc, until eventually you do it.
I worked at FORTH, Inc. one summer in the 80s before starting college. They sold a Forth system which they were converting to a new language standard, which (among other things) had changed the canonical booleans from 1-for-true to -1. One day I noticed the trig functions were giving wrong answers.
So I bring up the code with my boss, and it's pretty hard for us to figure out -- compact, no explanation, tables of random-looking numbers. Someone stops by (Dean Sanderson? iirc), we tell him what's up, he looks at the screen, and almost right away he's like "Oh, this is easy! All you need to do is swap the lines in the tables."
I tried gForth as well but during the installation, it invoked HomeBrew which gave a series of hostile messages that my system is obsolete and to not bother asking for any help or support. See [2] and the output provided by the poster - it is what I saw in my case.
[1] https://www.forth.com/download/
[2] https://superuser.com/questions/1767114/is-it-that-bad-to-us...
Well, that's not really about programmings skills though. That's math.
You could write a decent approximate SIN using the taylor series formula [1]. It's pretty easy, you don't even need to know math, can just look the formula up and translate it to an algorithm. Real world language SIN methods use more efficient and accurate methods, but it's still about knowing the math or looking up common such algorithms.
Or you could just invoke the libc (standard C library) SIN from Forth or whatever language you're using. That's what Python and other languages do.
The quote is more about the approach of writing an application by writing a DSL for the application, than about starting from zero and re-doing all the low level libraries like trig yourself.
I had no idea FORTH could invoke libraries from C. I got the impression it would be used on systems where space is at a premium precluding the installation of other higher-level languages.
https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Cal...
There are even bindings to C/C++ GUI libraries and so on. Running at constrained systems is just a common deployment scenario, but nothing in Forth necessitates it. You can even run it under Windows.
I would like to add though, that "language" does not have to mean macros and DSL. It can also simply mean what kind of things one considers primitives for the problem to solve. Those primitives can be built in already, they can be user defined functions (or words) or macros or whatever else makes an identifier or thing one can reference later when solving the actual problem.
If you want to do the parsed exterior DSL thing today, the magic wand that probably does it the best is Raku and its souped-up grammar system. I actually am exploring that now and I think it has a good toolkit for prototyping anything resembling a textual interface.
on: What are the enduring innovations of Lisp? (2022):
https://news.ycombinator.com/item?id=36159999
>PostScript is as truly homoiconic and polymorphic and interactive as Lisp.
on: Masterminds of Programming: Chuck Moore (2009):
https://news.ycombinator.com/item?id=21964186
on: Sun's NeWS was a mistake, as are all toolkit-in-server windowing systems (2013) (utoronto.ca):
https://news.ycombinator.com/item?id=22456471
FORTH ?KNOW IF
HONK!
ELSE
FORTH LEARN!
THEN
https://news.ycombinator.com/item?id=29261771on: Forth vs Lisp:
https://news.ycombinator.com/item?id=29261810
NeWS PostScript stuff:
https://news.ycombinator.com/item?id=22456831
Lisp in Forth:
Can't resist reposting this:
https://news.ycombinator.com/item?id=39109122
3rd comment down the subthread.
I've enjoyed reading about FORTH and LISP over the years and I think LISP advocates have a similar philosophy. What Leo Brodie states so nicely is very hard for me to actually do. I think that's what separates the people who "get" computing from those (like me) who glue bits of various libraries together to get past the problem of the moment.
As an HP calculator lover (I wore the ENTER > = t-shirt 40 years ago) I understand the stack and RPN but have no idea how I'd write a trig or stat function if it weren't already built in!