diff options
-rw-r--r-- | TUTORIAL.md | 26 | ||||
-rw-r--r-- | solutions/id.slip | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/TUTORIAL.md b/TUTORIAL.md index e0017d6..30e7d62 100644 --- a/TUTORIAL.md +++ b/TUTORIAL.md @@ -466,3 +466,29 @@ n saved > (fibonacci n) 34 : Int ``` + + +Exercise 3: Generic functions – the identity +-------------------------------------------- + +Write the identity function for any type. + +This should make you familiar with typing function +definitions that contain generics. + + +Exercise 4: Map left / right (integers) +--------------------------------------- + +Write functions `map-left` and `map-right` that take a +coproduct and a function and map the corresponding side of +the given coproduct using the given function. + +Note: the solution is not in the same directory as the rest, +but you can find implementations for these in the standard +library. + +This exercise will train your abilities to use generics more +than the last one. You will get familiar with coproducts. + + diff --git a/solutions/id.slip b/solutions/id.slip new file mode 100644 index 0000000..e0d768e --- /dev/null +++ b/solutions/id.slip @@ -0,0 +1 @@ +(let id (fn x T T x)) |