The Python example from around 4:00 on feels a little contrived to me. I’ve done some professional work in Python, and I think I’d write it more as something like this: from math import sqrt def nd_pythagoras(*args): return sqrt(sum(x*x for x in args)) Or if you don’t want to do the fancy n-dimensional generalization: def pythagoras(a, b): return sqrt(a*a + b*b) Which doesn’t require much more name-binding than the likes of “: pythagoras dup * swap dup * + sqrt ;”. I’ll keep watching. Stack-based languages interest me, and while I doubt even Chuck Moore could implement Tears of the Kingdom in Forth, the way something like PlanckForth can be bootstrapped from a tiny core is fascinating. I’ve dabbled in designing a postfix-based language of my own (under the premise of “What would the C equivalent look like in a world where programming languages were mostly developed by speakers of an SOV language?”), but it did seem like there was a lot that could be expressed more clearly and succinctly with explicit value names.
This is bringing back a lot of memories. Back in the early 90s I made a semantics for machine code that had the same sort of [| p q |] = [| p |] o [| q |] distributivity relationship between semantics, concatenation, and composition, allowing you to break a machine code program at any point and get the same meaning. But, I’m wondering whether the language in the talk actually has this property. Since “[“ and “]” aren’t given meaning on their own, it seems that you only get the distributivity property if “[“ and “]” are replaced using quote and compose.
Very nice, even if one would not get 100% - still, it's helpful. Examples in one of Forth standards could be more universal though - if it's doable at all (cons?)..
Forth is not based on lambda calculus tho, it'd be trickier, you'd have to have to build library words that are non standard, joy and factor have those built into the standard implementations.
I took a class with Alan Perlis when I was in college.
Yes, I did have a slight idea of how lucky I was.
Great talk! Very clear exposition. And thanks for the reference 🙂
The Python example from around 4:00 on feels a little contrived to me. I’ve done some professional work in Python, and I think I’d write it more as something like this:
from math import sqrt
def nd_pythagoras(*args): return sqrt(sum(x*x for x in args))
Or if you don’t want to do the fancy n-dimensional generalization:
def pythagoras(a, b): return sqrt(a*a + b*b)
Which doesn’t require much more name-binding than the likes of “: pythagoras dup * swap dup * + sqrt ;”.
I’ll keep watching. Stack-based languages interest me, and while I doubt even Chuck Moore could implement Tears of the Kingdom in Forth, the way something like PlanckForth can be bootstrapped from a tiny core is fascinating. I’ve dabbled in designing a postfix-based language of my own (under the premise of “What would the C equivalent look like in a world where programming languages were mostly developed by speakers of an SOV language?”), but it did seem like there was a lot that could be expressed more clearly and succinctly with explicit value names.
Why isn’t “swap” called “dig” for consistency with “dig2”? Very enjoyable to see how stack languages relate to other compiler theory concepts!
In the joy docs, it says `Note that "dig1" is the same as "swap". ` It looks like it wanted to have a word that was symmetric to buryn/dign.
This is bringing back a lot of memories. Back in the early 90s I made a semantics for machine code that had the same sort of [| p q |] = [| p |] o [| q |] distributivity relationship between semantics, concatenation, and composition, allowing you to break a machine code program at any point and get the same meaning. But, I’m wondering whether the language in the talk actually has this property. Since “[“ and “]” aren’t given meaning on their own, it seems that you only get the distributivity property if “[“ and “]” are replaced using quote and compose.
Wouldn't make more sense for dig to be an operation that pops the top of the stack and digs that far?
Very nice, even if one would not get 100% - still, it's helpful. Examples in one of Forth standards could be more universal though - if it's doable at all (cons?)..
Forth is not based on lambda calculus tho, it'd be trickier, you'd have to have to build library words that are non standard, joy and factor have those built into the standard implementations.
Nice talk, thank you!
great talk!