aboutsummaryrefslogtreecommitdiffhomepage
path: root/std/Option.bruijn
diff options
context:
space:
mode:
authorMarvin Borner2022-08-15 12:02:47 +0200
committerMarvin Borner2022-08-15 12:02:47 +0200
commit7e8697f598a299bb13b5159901a352000975655a (patch)
tree6b71f3fa88f88d81819d959573ce42067dc1eace /std/Option.bruijn
parenta56a4f3af00552af8707fad06e358b340da46ab0 (diff)
Combinator replacements
Diffstat (limited to 'std/Option.bruijn')
-rw-r--r--std/Option.bruijn18
1 files changed, 9 insertions, 9 deletions
diff --git a/std/Option.bruijn b/std/Option.bruijn
index c8a9a95..26de3de 100644
--- a/std/Option.bruijn
+++ b/std/Option.bruijn
@@ -3,20 +3,20 @@
:import std/Combinator .
# empty option
-none T
+none true
# encapsulates value in option
some [[[0 2]]]
# checks whether option is none
-none? [0 T [F]]
-:test (none? none) (T)
-:test (none? (some [[0]])) (F)
+none? [0 true [false]]
+:test (none? none) (true)
+:test (none? (some [[0]])) (false)
# checks whether option is some
-some? [0 F [T]]
-:test (some? none) (F)
-:test (some? (some [[0]])) (T)
+some? [0 false [true]]
+:test (some? none) (false)
+:test (some? (some [[0]])) (true)
# applies a function to the value in option
map [[0 none [some (2 0)]]]
@@ -30,8 +30,8 @@ map-or [[[0 2 1]]]
# extracts value from option or returns first argument if none
unwrap-or [[0 1 I]]
-:test (unwrap-or F (some T)) (T)
-:test (unwrap-or F none) (F)
+:test (unwrap-or false (some true)) (true)
+:test (unwrap-or false none) (false)
# applies encapsulated value to given function
apply [[1 none 0]]