3 ms·
Turtle in Python would have the same flow of ideas up to the invention of new control flow, which I agree is cool. But that's why Python isn't a LISP. Yet, th
by xapata 5y ago
Turtle in Python would have the same flow of ideas up to the invention of new control flow, which I agree is cool. But that's why Python isn't a LISP.
Yet, the creation of a "while" here isn't so different than making a new function which performs that logic. Was your example intended to demonstrate creating new syntax?
- RodgerTheGreat 5y agoYes, it's a do-while loop. It takes two arguments ("cond" and "proc") which would both be bracketed lists. "unless" is common sugar for a negated if statement. "run" evaluates a list as an expression. You'll notice that if/unless also take their bodies as lists, rather than any sort of special-purpose block syntax. "stop" short-circuits the current procedure and immediately returns. Since Logo has dynamic scope, any variable references in "cond" and "proc" will resolve the same within "while" as they did in its caller; no nasty visibility surprises. Since Logo does not eagerly evaluate lists, there is no need to "quote" or otherwise escape the lists in the caller's context. It is precisely that one can define such a construct without defining new syntax per se that is useful.
- xapata 5y ago> there is no need to "quote" or otherwise escape the lists in the caller's context. That's a handy feature. Thanks for the explanation.