
Thinking Forth – A Language and Philosophy for Solving Problems (1984) [pdf] - headalgorithm
https://1scyem2bunjw1ghzsf1cjwwn-wpengine.netdna-ssl.com/wp-content/uploads/2018/11/thinking-forth-color.pdf
======
pierrec
One thing Forth is great at is signal processing. This was kind of a
revelation to me when I tried Paul Batchlor's Sporth, a Forth-style language
specialized in audio processing.

Nowadays audio synths and effects are most commonly represented as interactive
spaghetti diagrams connecting basic DSP blocks together into directed graphs
determining the signal flow. To make a good audio programming language, the
question then becomes: is there a nice textual representation for this kind of
graph? And Forth is a great answer to that question.

I had so much fun with Sporth that I ported it to the browser and made an
online playground for it: [https://audiomasher.org/](https://audiomasher.org/)
with some examples:
[https://audiomasher.org/browse](https://audiomasher.org/browse) and a
tutorial: [https://audiomasher.org/learn](https://audiomasher.org/learn)

~~~
vanderZwan
Very, very cool!

Little bit of feedback: it only plays when the tab has focus - is that a
browser thing, or something could theoretically be overridden?

EDIT: Opening the tab in a separate window keeps the sound running even when
alt-tabbing away

EDIT2: The interactive cook book environment are missing a _previous_ and
_next_ link at the top/end of each chapter, clicking back and finding which
chapter is next is a little bit tedious.

~~~
hutzlibu
" is that a browser thing"

Unfortunately and thanks to many misusing auto-playing ads - it is. Sounds can
only start playing if the tab is the active one.

~~~
pierrec
As you point out, sounds can only _start_ in foreground tabs, but the glitch
here is that already-running audio is getting stopped when the user switches
to another tab. So it's a bug in my code!

------
joe_the_user
This seems primarily about program design with Forth being the example
language. And looking at it, it seems like between this view of design versus
object-oriented design books versus, I-don't-know, functional design ideas,
the main difference is what _things_ are language-implemented versus what
things exist conceptually but aren't directly supported/implemented by the
language.

The thing about all this that I find interesting in describing these
situations, design-theories are leveraging human language skills. The big
thing is taking a customer's narrative of what they want to have accomplished
and turning this into the exact, machine-implemented series of instruction.
You are talking about a human-being using the language-facility to construct
something exact. And well, I don't know if the structure of human-generated
language for problem solving has been investigated that much by linguists but
it would be interesting to see an investigation of this in relation to program
design.

------
rlonstein
Let's also add a link to Loeliger's Threaded Interpretive Languages...
[https://archive.org/details/R.G.LoeligerThreadedInterpretive...](https://archive.org/details/R.G.LoeligerThreadedInterpretiveLanguagesTheirDesignAndImplementationByteBooks1981/page/n1)

~~~
srean
Cannot thank you enough. Have been looking for an affordable copy for a long
time.

~~~
rlonstein
Keep your eyes open, I paid less than $10 USD plus book rate shipping for my
used, very good condition copy from a random seller on Amazon several years
ago.

[https://isbn.nu/9780070383609](https://isbn.nu/9780070383609)

I have no idea why sellers are asking the prices they are.

------
StillBored
Forth is the language that taught me (among other things) that its possible to
break problems into pieces that are too small to understand the whole.

I'm not sure really what to call this other than something along the lines of
can't see the forest for the trees. Its the opposite of having functions so
large it takes hours to figure out what they do. In this case you have words
that you can't figure out what they do for days because the call graphs step
across 300 different modules and 10k other words all of which are like
"update-pie-with-apples" and comprise two other words "dup pie, apple-pie-
update" or something.

~~~
todd8
My experience with FORTH was similar, although you've put into words the
problems I found with FORTH better than I could.

The original article is by Leo Brodie. I bought his book _Starting FORTH_
(which is now available online[1]) shortly after reading a 1980 Byte Magazine
article on FORTH.

It's not hard to implement FORTH. I found that R. G. Loeliger's book[2]
_Threaded Interpretive Languages: Their Design and Implementation_ allowed me
to easily build my own FORTH inspired system.

[1] [https://www.forth.com/starting-forth/](https://www.forth.com/starting-
forth/)

[2] [https://www.amazon.com/Threaded-Interpretive-Languages-
Desig...](https://www.amazon.com/Threaded-Interpretive-Languages-Design-
Implementation/dp/007038360X)

------
submeta
My HP 28s calcultor from 1988 (still got it, still works excellently) is
programmed in a stack based, Forth + Lisp inspired hybrid language, that was
lightyears ahead of all the concepts, programming languages that I had seen
back then (Basic, Pascal, C). It was stack based. I could put data onto the
stack and get it from there if needed. It had an excellent REPL. It was
working with all kinds of data structures: complex numbers, lists, arrays,
matrices. Also, everything was an object. And code could generate code, just
like in Lisp.

Only when I learned about Mathematica I found something more powerful in 1988.

~~~
submeta
What makes me sad is that the latest and most capable calculator from HP (the
HP Prime) seems to use something like Pascal. After 30 years they come up with
something like Pascal? Instead of what they had in 1988?

Back then they used a variant of Lisp: RPL (Reverse Polish Lisp)

------
fouc
I loved Forth and Chuck Moore's 10x philosophy.

I went from Forth to Ruby, from a notorious write-only language to a language
that's a joy to read & write.

I occasionally wonder about the possibility of a forth/ruby hybrid, stack-
based interpreter/compiler with the readability of ruby.

Ruby's OO is based on message passing. A message-passing OO is something that
could potentially be implemented elegantly in Forth.

~~~
pmarreck
This sounds really interesting (disclaimer: I love both these languages), but
isn’t a main advantage of Forth that it compiles to something that is really f
__*ing fast, and wouldn’t that hybrid potentially give that up?

~~~
sifoobar
The reason it's fast is brutal simplicity. But it's a spectrum, with dogmatic
Forth close to one end; the more you can keep things simple, the more raw
speed you get for free.

The approach I'm using in Snigl [0] is to start with Forth and add more
elaborate features as optional/gradual layers. As long as you don't use
variables and closures you get to enjoy more raw speed etc.

[0] [https://gitlab.com/sifoo/snigl](https://gitlab.com/sifoo/snigl)

------
nickcw
Reading this book (in 1984 or so) was one of the formative moments for me.
Especially the idea that as software developers we should strive for the
simplest most elegant solution and we could iterate our designs to get there.

The cartoons are brilliant - I often think of the universal processor (p82)
"word, food, data" when designing something that doesn't have a clear purpose.

------
stefano
If you're interested in Forth, I created a WASM implementation some time ago:
[https://github.com/stefano/wasm-forth](https://github.com/stefano/wasm-forth)

The main limitation is the interaction with the JS world, which is limited to
textual I/O, but it's enough to run an interactive REPL.

------
jonsen
About the time of this book I transitioned from computer engineering and
assembler programming into software engineering. I was lucky to stumble upon
Thinking Forth. Swallowed it. Gave me invaluable insight. (Another important
transition stepping stone was _Programming Languages - Design and
Implementation_ by Terence Pratt.)

~~~
ams6110
I tried to learn Fourth when I was a kid of about 14. There was an
implementation for the TI-99/4A, which I had. But I never grokked it. I am
guessing the manuals and other examples assumed knowledge I didn't have.
Haven't gone back to it since.

~~~
nobleach
Hmmm, the TI-99/4A. Any chance you made Mr. Bojangles dance? (I read that
BASIC manual cover to cover)

~~~
bitwize

        100 CALL CHAR(96, "995A3C3C3C3C2221")
        110 CALL CHAR(97, "1899FF3C3C3C4484")

------
sifoobar
It's a shame Forth is so tricky to find. I learned Prolog and Lisp in school,
but Forth was never even mentioned. It would make an excellent introduction to
programming if you ask me.

Once I got my hands on a tutorial, I quickly realized it was the perfect
foundation for the language [0] I've been designing in my mind.

[0] [https://gitlab.com/sifoo/snigl](https://gitlab.com/sifoo/snigl)

------
dang
From 2015:
[https://news.ycombinator.com/item?id=9842557](https://news.ycombinator.com/item?id=9842557)

From 2011:
[https://news.ycombinator.com/item?id=3389286](https://news.ycombinator.com/item?id=3389286)

------
mcguire
I've never had a chance to play with Forth, but Starting Forth was one of the
first good computer books I ever read.

[https://www.forth.com/starting-forth/](https://www.forth.com/starting-forth/)

------
mud_dauber
My first job after grad school was writing code for Harris Semiconductors'
RTX-2000 processor (native Forth execution) as an apps engineer. Showing
people how to morph the compiler, and toggle between assembly & Forth on the
fly, blew people's minds. Good times.

------
AlexCoventry
I read this book over and over when I was a kid.

