diff options
| author | Jan Sucan <jan@jansucan.com> | 2023-03-12 11:03:51 +0100 |
|---|---|---|
| committer | Jan Sucan <jan@jansucan.com> | 2023-03-12 11:03:51 +0100 |
| commit | 94ffa913d114cc66ec4cb1963fe10d7cf477e0ca (patch) | |
| tree | 545f41231b0989f2ea5b5eac19857e295a797ccc | |
| parent | e0221b226a4ac7c9099e1d5f8b04cf8a286e4920 (diff) | |
3_b_9: Add solution
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | ch03/3_b_9.hs | 9 |
2 files changed, 10 insertions, 1 deletions
@@ -61,7 +61,7 @@ more visible in the list the first exercise of a group is in bold italics. | 3_b_6 | yes | 70 | | | 3_b_7 | yes | | | | 3_b_8 | yes | | | -| 3_b_9 | | | | +| 3_b_9 | yes | | | | 3_b_10 | | | | | 3_b_11 | | | | | 3_b_12 | | | | diff --git a/ch03/3_b_9.hs b/ch03/3_b_9.hs new file mode 100644 index 0000000..c6595de --- /dev/null +++ b/ch03/3_b_9.hs @@ -0,0 +1,9 @@ +-- Consider three two-dimensional points a, b, and c. If we look at the angle +-- formed by the line segment from a to b and the line segment from b to c, it +-- either turns left, turns right, or forms a straight line. Define a Direction +-- data type that lets you represent these possibilities. + +data Direction = DLeft + | DRight + | DStraight + deriving (Show) |
