aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-11-05 02:31:55 -0400
committerEduardo Julian2020-11-05 02:31:55 -0400
commit11cc4a67001162d689eb827f755424a07b99fccb (patch)
treea689186bf0bef21056a3ad13e8f06f313a3a6989 /stdlib/source/lux.lux
parent8ac980fd3b6d2050edc0e631a00028c1e6c28c73 (diff)
Lightweight machinery for agent-oriented programming.
Diffstat (limited to 'stdlib/source/lux.lux')
-rw-r--r--stdlib/source/lux.lux21
1 files changed, 9 insertions, 12 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index 9365e0cda..3e373be35 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -2909,18 +2909,15 @@
#None))
(#Some g!name head tail body)
(let [g!blank (local-identifier$ "")
- g!name (local-identifier$ g!name)
- body+ (list@fold (: (-> Code Code Code)
- (function' [arg body']
- (if (identifier? arg)
- (` ([(~ g!blank) (~ arg)] (~ body')))
- (` ([(~ g!blank) (~ g!blank)]
- (case (~ g!blank) (~ arg) (~ body')))))))
- body
- (list@reverse tail))]
- (return (list (if (identifier? head)
- (` ([(~ g!name) (~ head)] (~ body+)))
- (` ([(~ g!name) (~ g!blank)] (case (~ g!blank) (~ head) (~ body+))))))))
+ nest (: (-> Code (-> Code Code Code))
+ (function' [g!name]
+ (function' [arg body']
+ (if (identifier? arg)
+ (` ([(~ g!name) (~ arg)] (~ body')))
+ (` ([(~ g!name) (~ g!blank)]
+ (.case (~ g!blank) (~ arg) (~ body'))))))))]
+ (return (list (nest (..local-identifier$ g!name) head
+ (list@fold (nest g!blank) body (list@reverse tail))))))
#None
(fail "Wrong syntax for function")))