aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux.lux')
-rw-r--r--stdlib/source/lux.lux23
1 files changed, 19 insertions, 4 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index 9cc2254b2..6042457fe 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -1618,7 +1618,7 @@
(wrap (#Cons y ys)))}
xs)))
-(def:''' (monad/fold m f y xs)
+(def:''' (monad@fold m f y xs)
#Nil
## (All [m a b]
## (-> (Monad m) (-> a b (m b)) b (List a) (m b)))
@@ -1635,7 +1635,7 @@
(#Cons x xs')
(do m
[y' (f x y)]
- (monad/fold m f y' xs'))}
+ (monad@fold m f y' xs'))}
xs)))
(macro:' #export (if tokens)
@@ -1770,7 +1770,7 @@
[lastO (untemplate lastI)]
(wrap (form$ (list (tag$ ["lux" "Cons"]) (tuple$ (list lastO (tag$ ["lux" "Nil"])))))))}
lastI)]
- (monad/fold meta-monad
+ (monad@fold meta-monad
(function' [leftI rightO]
({[_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))]
(let' [[[_module-name _ _] _] spliced]
@@ -4259,7 +4259,7 @@
tags)
pattern (tuple$ (list@map identifier$ locals))]
(do meta-monad
- [enhanced-target (monad/fold meta-monad
+ [enhanced-target (monad@fold meta-monad
(function (_ [m-local m-type] enhanced-target)
(do meta-monad
[m-structure (resolve-type-tags m-type)]
@@ -5881,3 +5881,18 @@
[no yes]
[off on]
)
+
+(macro: #export (:let tokens)
+ (case tokens
+ (^ (list [_ (#Tuple bindings)] bodyT))
+ (if (multiple? 2 (list@size bindings))
+ (return (list (` (..with-expansions [(~+ (|> bindings
+ ..as-pairs
+ (list@map (function (_ [localT valueT])
+ (list localT (` (..as-is (~ valueT))))))
+ (list@fold list@compose (list))))]
+ (~ bodyT)))))
+ (..fail ":let requires an even number of parts"))
+
+ _
+ (..fail "Wrong syntax for :let")))