3 ms·
I understood. My point is that python does not provide the logo experience, just one small but particularly iconic portion thereof.
by RodgerTheGreat 5y ago
I understood. My point is that python does not provide the logo experience, just one small but particularly iconic portion thereof.
- xapata 5y agoThe syntax is slightly different, but it's similar enough, I think.
- HerrMonnezza 5y agoThe point is: Logo >> turtle graphics.
- akho 5y agoNot really, no. You might not be able or willing (pedagogically) to get kids to the interesting bits, but traditional LOGOs (being ~ pre-Scheme LISPs) are dynamically scoped and have tail call optimization, neither of which would work in Python. The implications are that control structures are defined as simple procedures, there aren’t really closures, … You can probably reimplement much in Python, but at some point you will have to admit you’ve written a LOGO interpreter.
- xapata 5y agoI'm not saying Python is a LISP, but it does have closures. I'm not sure why tail call optimization matters for teaching. This is beginning to sound like a Python bashing instead of a Logo praising. Anyway, I've taught with Python a fair amount and have been pleased with the results, especially when using the `turtle` module.
- RodgerTheGreat 5y agoOne of the advantages of TCE in Logo (in combination with turtle graphics) is that you can teach the concept of recursion in a gradual and intuitive manner. You can start with drawing a circle, using recursion to make an infinite loop, stopping it manually after a while: to circle fd 3 rt 7 circle end Add a parameter, and get a spiral. The turtle winds its way off the screen, and again the student can stop the program manually: to spiral :x fd :x rt 30 spiral (:x + 1) end Introduce a base-case, and now the program stops itself at a desired size: to spiral :x if (:x = 30) [ stop ] fd :x rt 30 spiral (:x + 1) end Small, unsurprising steps building up an intuitive grasp of a useful concept. TCE can also improve the economy of the language, reducing the number of "primitive" control flow concepts that need to be provided out of the box. Since Logo has no "special forms" and is not eagerly evaluated like a Lisp, it's easy to make new control constructs without needing to teach any magic: to while :cond :proc unless run :cond [ stop ] run :proc while :cond :proc end Little things matter.
- xapata 5y agoTurtle 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.
- akho 5y agoRodgerTheGreat explained everything very well. One extra note: LOGO does not have closures (closures require lexical scope). Dynamic scope gives the possibility to, e.g., define new control flow without quoting, but lexical closures are not possible.
- cies 5y agoIndeed. Logo offers a great "my first programming steps" experience. Often translating the programming language (and syntax errors, etc) to the native language of the programmer. This is unmatched, and can never be matched, by Python.