aboutsummaryrefslogtreecommitdiffstats
path: root/stdlib/maybe.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/maybe.lisp')
-rw-r--r--stdlib/maybe.lisp51
1 files changed, 0 insertions, 51 deletions
diff --git a/stdlib/maybe.lisp b/stdlib/maybe.lisp
deleted file mode 100644
index 086b0dc..0000000
--- a/stdlib/maybe.lisp
+++ /dev/null
@@ -1,51 +0,0 @@
-; LIB
-
-(let! Maybe/just (\[a]
- ["Maybe" "just" a]))
-(let! Maybe/nothing (\[]
- ["Maybe" "nothing"]))
-
-(let! Maybe/#at (\[n seq]
- (match seq
- []
- (fatal! "Maybe/#at out of bounds")
- otherwise
- (match n
- 0
- (head seq)
- otherwise
- (Maybe/#at (- n 1) (tail seq))))))
-
-(let! Maybe/unpack (Maybe/#at 2))
-(let! Maybe/kind (Maybe/#at 1))
-
-(let! Maybe/map (\[f m]
- (match (Maybe/kind m)
- "just" (Maybe/just (f (Maybe/unpack m)))
- "nothing" (Maybe/nothing))))
-
-(let! Maybe/and-then (\[f m]
- (match (Maybe/kind m)
- "just" (f (Maybe/unpack m))
- "nothing" (Maybe/nothing))))
-
-; TESTING
-
-;; (let! print-line! (\[s]
-;; (print! (concat s "\n"))))
-
-;; (let! a (Maybe/just 10))
-;; (let! b (Maybe/nothing))
-
-;; (Maybe/map (+ 5) a)
-;; (Maybe/map (+ 5) b)
-
-;; (Maybe/and-then (\[n] (Maybe/just (+ n 5))) a)
-;; (Maybe/and-then (\[n] (Maybe/just (+ n 5))) b)
-
-;; (let! m (Maybe/just 10))
-;; (match m
-;; (Maybe/just _)
-;; (print-line! (fmt "found just {0}!" [(Maybe/unpack m)]))
-;; (Maybe/nothing)
-;; (print-line! "found nothing!"))