diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2022-10-04 20:25:22 +0300 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-05 14:21:53 +0200 |
| commit | 77968899b90cd9afe2ed2668b290b66cb553ced2 (patch) | |
| tree | 4446ab6257f21603b45e04fadd4deeae231bffc9 /examples/maybe.lisp | |
| parent | c1713b4ea6c542fa2fe0d66b51c5b7b27fedf57a (diff) | |
Implement naive export system
Diffstat (limited to 'examples/maybe.lisp')
| -rw-r--r-- | examples/maybe.lisp | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/examples/maybe.lisp b/examples/maybe.lisp deleted file mode 100644 index 7cabfea..0000000 --- a/examples/maybe.lisp +++ /dev/null @@ -1,60 +0,0 @@ -; LIB - -(let! just (\[a] - ["maybe" "just" a])) -(let! nothing (\[] - ["maybe" "nothing"])) - -(let! unsafe-at (\[n seq] - (match seq - [] - (fatal! "unsafe-at out of bounds") - otherwise - (match n - 0 - (head seq) - otherwise - (unsafe-at (- n 1) (tail seq)))))) - -(let! unpack-just (unsafe-at 2)) -(let! kind (unsafe-at 1)) - -(let! map (\[f m] - (match (kind m) - "just" (just (f (unpack-just m))) - "nothing" (nothing)))) - -(let! and-then (\[f m] - (match (kind m) - "just" (f (unpack-just m)) - "nothing" (nothing)))) - -; TESTING - -;; (let! print-line! (\[s] -;; (print! (concat s "\n")))) - -;; (let! a (just 10)) -;; (let! b (nothing)) - -;; (map (+ 5) a) -;; (map (+ 5) b) - -;; (and-then (\[n] (just (+ n 5))) a) -;; (and-then (\[n] (just (+ n 5))) b) - -;; (let! m (just 10)) -;; (match m -;; (just _) -;; (print-line! (fmt "found just {0}!" [(unpack-just m)])) -;; (nothing) -;; (print-line! "found nothing!")) - -(let! exports [ - just - nothing - unpack-just - kind - map - and-then -]) |
