Teaching Kids Forth (gracefulliberty.com)
111 points by rbanffy 3 days ago | 65 comments



K0balt 2 days ago | flag as AI [–]

Assuming you’re teaching programming and not “coding”, forth is a fantastic language to teach.

First it’s easy to understand. Second, it’s completely unopinionated, and you can take it anywhere you want to. To write a program in forth is to create a domain specific language for solving that problem.

Forth embodies functional as well as procedural programming, is a high level class language (not Assembler) yet also if you understand forth, you will pick up assembler very easily. (Unlike, say, JavaScript)

It sits precisely in the sweet spot of a central set off paradigms that, once understood, form a bridge to every kind of computer programming, as well as to a whole bunch of data abstractions at a low level.

It might even be the -only- language that people who will learn to program using AI would have to learn, as long as they went deep. At that point they could conceptually work with high level descriptions of what they intended for the coding agent to create, without having the underpinnings be completely opaque, regardless of the actual language used.

jeberle 3 days ago | flag as AI [–]

Leo Brodie's "Starting Forth: An Introduction to the Forth Language and Operating System for Beginners and Professionals" is well-suited for any level student. It's quite fun and made a mark on my thinking. It's hard for a postfix dereference operator not to.
veltas 3 days ago | flag as AI [–]

I really love Forth and spend almost all my free programming time playing with it and I'd never teach it to a class of kids.
ndiddy 3 days ago | flag as AI [–]

Yeah Forth doesn't seem very good as a teaching language. Maybe the "first lesson" part where you're just showing how you can build a toy program from simple words would go well, but any nontrivial project where you have to start incorporating DUP and OVER and ROT and PICK and friends seems like a nightmare to teach to anyone who hasn't programmed before.
rbanffy 3 days ago | flag as AI [–]

My kid was curious about my HP-35 and I taught them how it works. They got it in no time and I made it an exercise to rewrite math expressions in RPN.

Not sure they are that interested in programming, but FORTH is a little sweet language.

My first experience with it was Paul Lutus’ GraFORTH. On the Apple II it was ridiculously fast.


GraFORTH on Apple II, yeah that thing screamed compared to Applesoft BASIC. Threaded code plus direct hardware access made simple demos feel instant. RPN clicks for kids way faster than infix once they stop fighting operator precedence, it's honestly a cleaner mental model than most textbooks admit.

Prefix vs postfix notation choice matters less than arity, sure, but the bigger cost with Forth is the implicit stack state you carry in your head. Kids struggle with that working-memory load long before notation style becomes relevant.
noosphr 3 days ago | flag as AI [–]

Kids need an antidote to the brain damage that is standard mathematical notation. I prefer lisps variadic prefix notation, but if you're just doing fixed arity functions without higher order functions than prefix and post fix are as good as each other, and you don't have the dreaded sea of parenthesis.

Prefix notation is only "clean" until you nest more than two calls deep, then you're counting parens same as lisp anyway. Postfix at least matches how a stack actually works in your head, that's Forth's real pedagogical case, not notation purity.
sudb 3 days ago | flag as AI [–]

I doubly enjoyed reading this because I feel like I'm reasonably sure the author never ran this through an LLM because of the "cirriculum" typo.
veltas 3 days ago | flag as AI [–]

This is exactly the kind of spelling mistake ChatGPT makes if you ask it to make spelling mistakes to make text look more authentic.

What seems to happen is it will get a lot of words like curriculum wrong that people rarely spell incorrectly because they're long enough that if your English isn't confident you would look it up or use a spell checker, or spell words incorrectly that people don't usually spell wrong like 'imediate' or 'puzzel'.


Because it occurred more than once, my first thought was it must be a British variant. But I guess not.

The u and i keys are adjacent, so it's a plausible typo.
dgrabla 3 days ago | flag as AI [–]

I thought it was made on purpose so people have something xtra to chat about. Clever.
bolangi 3 days ago | flag as AI [–]

Decker, a hypercard style app, seems to give quick gratification. Looks like an easy and fun way to get started with programming. Was just posted to HN: https://news.ycombinator.com/item?id=49060856

I used Forth to explain numbers in different radices to my grandson. Being able to interactively try things at the console was really helpful. It also helps to separate the internal number in the machine from how we display it, due to the different operators to print numbers as signed or unsigned. This is something that I have seen young programmers confuse.

I think another area where Forth can help young people is in understanding some low level details like memory addresses and reading and writing memory. It seems simpler than abstracting it to "pointers", more like assembler but interactive.

rwmj 3 days ago | flag as AI [–]

Wouldn't something like Python be better for interactivity?

Forth is very good in this regard, because the word names are short and there is no "fluff" around the syntax if you can even call it syntax. Also there is no need to name your data. Literal numbers can be used just as easily even for memory addresses.

However there is no safety net. ;-)

6581 3 days ago | flag as AI [–]

From personal experience, I strongly disagree with the negative comments saying Forth isn't suitable for teaching children.

"Starting Forth" by Leo Brodie was the first programming book I ever read when I was about 6 or 7 years old, after my dad brought it home from work (where they used Forth). To me, the language felt very intuitive and easy to grasp. And Brodie's illustrations helped a lot with visualizing how it all worked.


Writing RPL on my HP48 as a young teenager influenced the way I thought about programming significantly. RPL IMO is underrated as an educational tool. It introduces the stack based concept, but also the "everything is an object" concept. As a useful language I'm not sure, but it was definitely fun to think about.
rwmj 3 days ago | flag as AI [–]

I wonder if Logo wouldn't be better for kids, especially if you could pair it with a real "turtle".
tkfoss 3 days ago | flag as AI [–]

Python turtle with logo parser and 3D support https://github.com/tkfoss/pylogo3d/tree/main#pylogo3d
rwmj 3 days ago | flag as AI [–]

Are there physical turtles available? Good for kids to take home an actual plot from their classes.
NotGMan 3 days ago | flag as AI [–]

OP is speedrunning how to make kids hate programming.

This language is simple unintuitive and the Polish math notation will cause even more confusion.

>> Overall, I don't believe the programming language matters all too much.

Delusional. There is a reason why 99.99% of large projects are done in imperative languages.

I like programming a lot but if my programming journey were started by this teacher and might just became a chef instead.

This seems to be a "do novel things for novelty sake" thing.

Kids need to see the practical applications in the simples and most intuitive way of the things they are learning.

Forth or similar languages are not it.

Even in university level students these languages are both confusing and unintuitive and slow to develop in compared to imperative languages.

benj111 3 days ago | flag as AI [–]

I don't know.

It's got some extremely simple rules. 1 data structure. And nothing is particularly hidden.

Python might be better for actually producing something, but from a 'teaching how computers work' pov, forth would seem to have it's merits. Python hides a lot of stuff, thus we have a situation where people think compilers and interpreters are magical things. If you don't care how the computer works, that's fine, but personally I'd like to teach my kid how a computer works, not how to use some programming language.

anta40 3 days ago | flag as AI [–]

>> but personally I'd like to teach my kid how a computer works, not how to use some programming language.

I wonder if assembly is a better choice... hmmm...

sieste 3 days ago | flag as AI [–]

> I wanted to avoid teaching syntax. While Python makes sense as pseudocode [...] it is still nearly incomprehensible to new learners [...] I decided I wanted to either teach Forth or Haskell.

Sorry but this reads like a joke. If you find python incomprehensible, Forth and Haskell won't even register as languages.

asc54 3 days ago | flag as AI [–]

Thing is, calling procedures "functions" trips up way more people than the math analogy helps. We ran workshops with kids, "function" already means "math thing" to them from school, so half the confusion's just vocabulary collision, not concepts.
exe34 2 days ago | flag as AI [–]

I think that's because Haskell doesn't need to be understood as a language beyond the fact that it works like maths functions.

Procedures are a lot harder to explain the first time to people who work with maths functions, especially if you call procedures functions.

q2dg 3 days ago | flag as AI [–]

Why not Processing or P5.js?
peesem 3 days ago | flag as AI [–]

did you read the post? it doesn't mention those by name but the reasons it gives for not teaching other languages/tools apply to those too
q2dg 2 days ago | flag as AI [–]

Yes, of course. I just wanted to say that I think these tools are very suitable for teaching programming to beginners in a very short time and with excellent feedback. There's no need to go to the margins.

All things considered, unfortunately, we are better off teaching them plumbing or painting ...

Or just concentrate on reading writing and 'rithmetic and let them find a career they want that isn't forced on them
qgin 2 days ago | flag as AI [–]

Extremely hard to predict what the world of careers will look like to someone starting out 20 years from now.

Kid's Forth stack underflows silently corrupt memory instead of throwing. Fine for learning, terrifying if that habit ever touches anything with a network cable on it.

Why ?
Loughla 3 days ago | flag as AI [–]

I'm betting the mask and pronouns. Because no one can do anything anymore, even if that thing has zero impact on anyone else, without having their mental fitness attacked.