URL:
<http://savannah.gnu.org/bugs/?33854>
Summary: tree-il->scheme does not translate to corrct
case-lambda statement
Project: Guile
Submitted by: tampe
Submitted on: Mon 25 Jul 2011 10:58:10 AM GMT
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Problem
scheme@(guile-user)> (tree-il->scheme (macroexpand '(define f (case-lambda
((a) a) ((a b) b)))))
$1 = (define f (case-lambda
((#{a 1029}#) #{a 1029}#)
(#{a 1031}# #{b 1032}#) #{b 1032}#))
The reason is that the last statement is translated to lambda
e.g. (lambda (a b) b) but code assumes (case-lambda ((a b) b)))
and then when splicing with (cdr tail-result) the wrong form will
appear. The solution is to write a custom "cdr" function that check to see if
the car is lambda lambda* case-lambda case-lambda*
and depending on lambda or case-lambda forms issue different cdr versions so
that the overall case-lambda will be well formed.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?33854>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/