aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/lux.lux59
1 files changed, 32 insertions, 27 deletions
diff --git a/source/lux.lux b/source/lux.lux
index c40c26589..cab8a31d2 100644
--- a/source/lux.lux
+++ b/source/lux.lux
@@ -87,33 +87,38 @@
(annotate lambda Macro)
(def' lambda
(lambda' _ tokens
- (case tokens
- (#Cons self (#Cons (#Tuple (#Cons arg args')) (#Cons body #Nil)))
- (#Form (#Cons (#Ident "lambda'")
- (#Cons self
- (#Cons arg
- (case args'
- #Nil
- (#Cons body #Nil)
-
- _
- (#Cons (#Ident "lux:lambda")
- (#Cons (#Tuple args')
- (#Cons body #Nil))))))))
-
- (#Cons (#Tuple (#Cons arg args')) (#Cons body #Nil))
- (#Form (#Cons (#Ident "lambda'")
- (#Cons (#Ident "_")
- (#Cons arg
- (case args'
- #Nil
- (#Cons body #Nil)
-
- _
- (#Cons (#Ident "lux:lambda")
- (#Cons (#Tuple args')
- (#Cons body #Nil))))))))
- )))
+ (lambda' _ state
+ (let output (case tokens
+ (#Cons self (#Cons (#Tuple (#Cons arg args')) (#Cons body #Nil)))
+ (#Form (#Cons (#Ident "lambda'")
+ (#Cons self
+ (#Cons arg
+ (case args'
+ #Nil
+ (#Cons body #Nil)
+
+ _
+ (#Cons (#Ident "lux:lambda")
+ (#Cons (#Tuple args')
+ (#Cons body #Nil))))))))
+
+ (#Cons (#Tuple (#Cons arg args')) (#Cons body #Nil))
+ (#Form (#Cons (#Ident "lambda'")
+ (#Cons (#Ident "_")
+ (#Cons arg
+ (case args'
+ #Nil
+ (#Cons body #Nil)
+
+ _
+ (#Cons (#Ident "lux:lambda")
+ (#Cons (#Tuple args')
+ (#Cons body #Nil)))))))))
+ [(#Cons output #Nil) state]))))
+
+(def cons
+ (lambda [tail head]
+ (#Cons head tail)))
#(
(defmacro (lambda tokens)