5 ms·
This—as well as Logo, however fond my memories of it are—are a bad idea because turtles graphics are by nature imperative: you're programming exclusively for si
by edw 15y ago
This—as well as Logo, however fond my memories of it are—are a bad idea because turtles graphics are by nature imperative: you're programming exclusively for side effects.
What the world needs is an approachable version of a system like the image manipulation presented in Structure and Interpretation of Computer Programs, which takes a functional approach. (It may have only been in the first edition, but it is covered in the Hewlett-Packard videos.)
I'm not a functional programming absolutist, but experience has taught me to think functionally by default. The habit should be instilled in would-be programmers as early as possible.
- dpritchett 15y agoI haven't finished SICP so I'm not sure which bit you're talking about, could you please point it out? http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html#%_toc_start http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html#... All IO is inherently impure, right? At best you're going to be composing funtions out of smaller functions that implement your graphics desires. How can you get around having e.g. a circle(radius, x-pos, y-pos, line-color, fill-color) function that draws per your specifications? There's no reason you couldn't implement that circle function using turtle...
- hendzen 15y agoAll the exercises and code in Section 2.2.4
- ronreiter 15y agoI did not learn how to program using a turtle, so I don't know if it's the right way to go. But intuitively, it seems very simple, at least more than I/O.