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 technically doesn’t need, either, if you avoid functions taking variable number of arguments and have a grammar that can reliably detect function calls (could be hard if you’re allowing higher-order functions)
Even with functions taking a variable number of arguments, you could do it the C way and use the argc, argv trick, giving you
* 2 + 3 5 6 7 3 ⇒ (* (+ 5 6 7) 3) ⇒ 54
I think you’d have to be a bit of a masochist to do that, though.
That also is why I think varargs functions tend to be rare in bare bones forths. You’d have to write
5 6 7 3 + 3 2 *
Using custom names for the varargs functions would help for the 2-argument version.
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.
> start incorporating DUP and OVER and ROT and PICK and friends
If one understands adding and consuming values at the top of the stack, putting the stack in the state you want it is certainly a small logical step without new theoretical baggage.
Word definitions and the accompanying pointer tricks are more likely to be challenging.
The stack is functionally very simple, but keeping a mental model of what exactly is on it at each point in your code and how to transform it to perform the calculations you need can be tricky.
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.
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.
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.
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'.
Let it be known that this is a spelling mistake I have made for years. I thought I had rooted out of this article. It must have made it back in with later drafts.
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.
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.
> 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.
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.
Assembly is add R1 R2. Forth takes the 2 numbers from the TOS and puts it in those registers. That wasn't obvious what was happening in the post, I wonder if student me would have wondered.
You could make the case for going all the way down to the silicon.
We teach English, maths, science to give a rounded understanding, not to make student productive or give them information that will be immediately useful. IT/computing in secondary school should be doing a similar thing. It should remove the mystery of what a computer is. That it is programmable. Hopefully it's improved since I was young and we were basically shown how to use Excel.
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.
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.
Also pretty sure that kids won’t ever have to deal with syntax lol. For better or for worse, Human language is the new programming language, it’s just a specialised dialect and field. I do worry that by teaching coding and not programming we are shooting kids in the foot though. You need to ba able to leverage deep insight to lead coding agent swarms to create actually good codebases.
that's why most popular languages (python in particular) are the worst of all worlds - if english is the "programming language" why not use a good runtime?
I'm not too familiar with odd languages, but the only language I've seen as more english than python is probably AppleScript!
In one of my jobs, we exclusively used python. We would interview candidates that didn't know python, so would let them use whatever they were familiar with or pseudocode. If they used pseudocode, and if they were interested, I would have fun showing them how they could convert their pseudocode into valid python with some minimal changes and a couple colons.
In my mind, programming is the concepts, especially around problem solving with code as a tool, where coding is specific syntax/implementation, a means to an end. Related, you don't get paid to code, you get paid to program.
veltas | 23 hours ago
[OP] rbanffy | 23 hours ago
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.
JSR_FDED | 20 hours ago
fuzztester | 18 hours ago
n coined the term careware. iirc.
first-hand info. i had downloaded n used arachnophilia.
he is on hn.
[OP] rbanffy | 13 hours ago
noosphr | 19 hours ago
pitchlatte | 16 hours ago
cultofmetatron | 13 hours ago
pitchlatte | 13 hours ago
lioeters | 12 hours ago
antonvs | 11 hours ago
lioeters | 11 hours ago
WolfeReader | 6 hours ago
Someone | 11 hours ago
Prefix technically doesn’t need, either, if you avoid functions taking variable number of arguments and have a grammar that can reliably detect function calls (could be hard if you’re allowing higher-order functions)
Even with functions taking a variable number of arguments, you could do it the C way and use the argc, argv trick, giving you
I think you’d have to be a bit of a masochist to do that, though.That also is why I think varargs functions tend to be rare in bare bones forths. You’d have to write
Using custom names for the varargs functions would help for the 2-argument version.ndiddy | 19 hours ago
HelloNurse | 9 hours ago
If one understands adding and consuming values at the top of the stack, putting the stack in the state you want it is certainly a small logical step without new theoretical baggage.
Word definitions and the accompanying pointer tricks are more likely to be challenging.
ndiddy | an hour ago
cameldrv | 22 hours ago
q2dg | 22 hours ago
peesem | 21 hours ago
q2dg | 35 minutes ago
jeberle | 21 hours ago
dark_star | 20 hours ago
fuzztester | an hour ago
er ...
There is also Thinking Forth.
https://www.forth.com/wp-content/uploads/2018/11/thinking-fo...
sudb | 20 hours ago
encomiast | 20 hours ago
WillAdams | 19 hours ago
dgrabla | 13 hours ago
veltas | 13 hours ago
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'.
gracefulliberty | 13 hours ago
veltas | 13 hours ago
pbgcp2026 | 19 hours ago
assimpleaspossi | 18 hours ago
bolangi | 18 hours ago
lebuffon | 18 hours ago
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 | 11 hours ago
lebuffon | 3 hours ago
However there is no safety net. ;-)
exe34 | 2 hours ago
sieste | 15 hours ago
Sorry but this reads like a joke. If you find python incomprehensible, Forth and Haskell won't even register as languages.
exe34 | 2 hours ago
Procedures are a lot harder to explain the first time to people who work with maths functions, especially if you call procedures functions.
NotGMan | 12 hours ago
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 | 11 hours ago
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 | 11 hours ago
I wonder if assembly is a better choice... hmmm...
benj111 | 11 hours ago
Assembly is add R1 R2. Forth takes the 2 numbers from the TOS and puts it in those registers. That wasn't obvious what was happening in the post, I wonder if student me would have wondered.
You could make the case for going all the way down to the silicon.
We teach English, maths, science to give a rounded understanding, not to make student productive or give them information that will be immediately useful. IT/computing in secondary school should be doing a similar thing. It should remove the mystery of what a computer is. That it is programmable. Hopefully it's improved since I was young and we were basically shown how to use Excel.
6581 | 12 hours ago
"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.
rwmj | 11 hours ago
tkfoss | 11 hours ago
rwmj | 11 hours ago
K0balt | 4 hours ago
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.
liveoneggs | 2 hours ago
K0balt | an hour ago
K0balt | an hour ago
liveoneggs | 38 minutes ago
nomel | 30 minutes ago
In one of my jobs, we exclusively used python. We would interview candidates that didn't know python, so would let them use whatever they were familiar with or pseudocode. If they used pseudocode, and if they were interested, I would have fun showing them how they could convert their pseudocode into valid python with some minimal changes and a couple colons.
fasterik | 57 minutes ago
nomel | 32 minutes ago