You can animations and interactions between different elements, or track a global state. It also involves more complex functions than drawing. This lets you use more complex items and dive into the type signatures a bit more. There is also Codeworld Haskell, which employs the full Haskell feature set. Now the basic version of Codeworld is like Haskell but with some simplifications and syntactic changes. Program = drawingOf(myTree(-5, green, brown) & myTree(5, red, black)) MyTree :: (Number, Color, Color) -> Picture Tree(c1, c2) = colored(leaves, translucent(c1)) & As you learn more about the different patterns, you can create your own functions. You can compose this drawing with different components, always represented by expressions. Your program is ultimately a single drawing. But Codeworld eschews both these approaches in favor of a more functional style. You'd create shapes that have different properties and change these over time. You might also approach drawing in an object oriented fashion. For example, you could tell a turtle to start drawing, move 25 pixels, turn, and move again. You create “turtles” that move around the screen and perform commands. The Logo programming language that I first learned used a more procedural style. This is different from similar sorts of programs and language in many ways.
0 Comments
Leave a Reply. |