aboutsummaryrefslogtreecommitdiff
path: root/source/lux.lux
diff options
context:
space:
mode:
authorEduardo Julian2015-01-29 01:25:54 -0400
committerEduardo Julian2015-01-29 01:25:54 -0400
commitdf59026eefe30d2a903adee14cea0cce95c92084 (patch)
treef256e4bf3f2b1cc57e6a075e2b7eb65cf064bd83 /source/lux.lux
parent5f492cd8f612906d25f6377731f71c7289fd4b8d (diff)
[Bugs]
- Fixed the errors in the compiler due to its restructuring as monadic code. - Fixed a bug in the analyser where 'case' forms has "Nothing" as their type. [Refactor] - Now there only one way to raise/fold lambda-bodies.
Diffstat (limited to 'source/lux.lux')
-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)