- Diagrams
- Coordinate System
- Circle
- Rectangle
- Superposition of two Diagrams
- Exercise: “No Entry” Sign
- Moving Diagrams
- Exercise: Door
- Superposition of Diagrams
- List Comprehensions
- Dot-dot Expressions
- Exercise: Coins
- Exercise: Stairs
- Exercise: Cage
- Exercise: Circles
- Exercise: Spheres
- Exercise: Pearl Necklace
- Exercise: Spiral
- Coloring
- Exercise: Colored “No Entry” Sign
- Rotation
- Exercise: Black Star
- Exercise: Dial
- Section
- Exercise: Dandelion
- Polygon
- Exercise: Star
- Anything Else?

Notes

- Edit the line after
`Test>`

and hit`<Enter>`

.

The diagram will change! - Diagrams presented here are not part of the Haskell Platform.

We use them only to introduce the basic concepts of Haskell.

Note the type of functions and the syntax of function application.

Note the type of functions with two parameters and their application.

Note the syntax of operators.

Make a diagram similar to the “no entry” sign shown here (hint: use lengths 2, 5 and 8):

Note the application of functions with two parameters as operators.

Note that the precedence of `move`

is higher than the precedence of `<|>`

.

Make a diagram similar to the door shown here (hint: use lengths 0, 2, 6, 10, 14 and 20):

Note the type of lists and the syntax of conctrete lists.

Make a diagram similar to the coins shown here (hint: the radius of the circles are 4):

Make a diagram similar to the stairs shown here (hint: use lengths -5, 1, 2, 5):

Make a diagram similar to the cage shown here (hint: use lengths -5, 1, 2, 4, 20):

The radius of the spheres are 1.5^{x}, x∈{-5,-4,…,4,5}.

The exponentiation operator is: `**`

A function used is x ↦ x^{2}/10.

The new functions used here are `pi`

, `sin`

and `cos`

.

Predefined colors: `black`

, `gray`

, `white`

, `red`

, `green`

, `blue`

, `yellow`

Note the type of constants (nothing special though).

The used length is 10.

This is just a demo what can we define later.

The following code describes a tree with `n`

levels:

```
tree n
| n <= 0 = empty
| otherwise
= pack (tree (n-1)) $ \t ->
((0,0)~~(0,-5) <|> t `rotate` 15 <|> t `rotate` (-15))
`move` (0,5) `scale` 0.8
```

Here is the tree with 6 levels:

(WARNING: you can kill your browser with more than 8 levels!)