aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/static.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/static.lux')
-rw-r--r--stdlib/source/library/lux/static.lux22
1 files changed, 20 insertions, 2 deletions
diff --git a/stdlib/source/library/lux/static.lux b/stdlib/source/library/lux/static.lux
index 6de030bee..e8d213dd8 100644
--- a/stdlib/source/library/lux/static.lux
+++ b/stdlib/source/library/lux/static.lux
@@ -1,6 +1,6 @@
(.using
[library
- [lux {"-" nat int rev}
+ [lux {"-" nat int rev if cond}
["[0]" meta]
[abstract
[monad {"+" do}]]
@@ -9,7 +9,7 @@
["<[0]>" code]]]
[data
[collection
- ["[0]" list ("[1]#[0]" functor)]]]
+ ["[0]" list ("[1]#[0]" functor mix)]]]
[macro
[syntax {"+" syntax:}]
["[0]" code]]
@@ -99,3 +99,21 @@
.let [[_ result] (random.result (random.pcg_32 [..pcg_32_magic_inc seed])
random)]]
(in (list#each format result)))))
+
+(syntax: .public (if [test <code>.any
+ then <code>.any
+ else <code>.any])
+ (do meta.monad
+ [test (meta.eval .Bit test)]
+ (in (list (.if (:as .Bit test)
+ then
+ else)))))
+
+(syntax: .public (cond [test,then/* (<>.some (<>.and <code>.any <code>.any))
+ else <code>.any])
+ (in (list (list#mix (function (_ [test then] else)
+ (` (..if (~ test)
+ (~ then)
+ (~ else))))
+ else
+ (list.reversed test,then/*)))))