From df59026eefe30d2a903adee14cea0cce95c92084 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 29 Jan 2015 01:25:54 -0400 Subject: [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. --- source/lux.lux | 59 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 27 deletions(-) (limited to 'source/lux.lux') 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) -- cgit v1.2.3