diff options
author | Eduardo Julian | 2022-03-11 05:52:21 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-03-11 05:52:21 -0400 |
commit | 6766be5427b1788a44e07151e3fabe33ec4f8b37 (patch) | |
tree | 8d8aa5c1d8fd4a9f733f82c48080284ecd4ec31a /stdlib/source/library/lux/static.lux | |
parent | ac2c19d93407b00c89513f0f81e9cbbd1425bd9a (diff) |
Added an easy way to export Lux functionality to host programs (everywhere else).
Diffstat (limited to 'stdlib/source/library/lux/static.lux')
-rw-r--r-- | stdlib/source/library/lux/static.lux | 22 |
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/*))))) |