diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/maybe.lisp (renamed from examples/algebraic-types-concept.lisp) | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/algebraic-types-concept.lisp b/examples/maybe.lisp index 315a693..ce2cd03 100644 --- a/examples/algebraic-types-concept.lisp +++ b/examples/maybe.lisp @@ -1,3 +1,5 @@ +; LIB + (let just (\[a] ["maybe" "just" a])) (let nothing (\[] @@ -13,6 +15,13 @@ (let from-just (at 2)) (let kind (at 1)) +(let map (\[f m] + (match (kind m) + "just" (just (f (from-just m))) + "nothing"))) + +; TESTING + (let m (just 10)) (match (kind m) "just" (from-just m) |
