Live data from Hacker News

Teaching Kids Forth

gracefulliberty.com

41–50 of 73 posts

Re: Teaching Kids Forth

#42

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 i…

Wouldn't something like Python be better for interactivity?

Re: Teaching Kids Forth

#45
post #39
post #37

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 be…

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.

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

Re: Teaching Kids Forth

#46
post #40

Earlier quoted context omitted.

The need to remember operator precedence is a consequence of the infix notation syntax.

It’s a tradeoff against lots of irritating silly parentheses.

Postfix doesn’t need parentheses.

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.

Re: Teaching Kids Forth

#47
post #44
post #41

I wonder if Logo wouldn't be better for kids, especially if you could pair it with a real "turtle".

Python turtle with logo parser and 3D support https://github.com/tkfoss/pylogo3d/tree/main#pylogo3d

Are there physical turtles available? Good for kids to take home an actual plot from their classes.

Re: Teaching Kids Forth

#48
post #45
post #39

Earlier quoted context omitted.

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. I wonder if assembly is a better choice... hmmm...

Well one can follow on from the other.

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.

Re: Teaching Kids Forth

#49
post #21
post #2

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.

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.

Post reply on HN