This is the mail archive of the mailing list for the Kawa project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug returning lambda(x.y)

"Nic Ferrier" <> writes:

>   (define (posbug p q)
>     (lambda (x .y)
>       (if (not y)
>          x
>          (car y))))

First, if you get a VerifyError from Kawa, that will almost always
be a bug in Kawa, or possibly the verifier.  I.e. Kawa should never
generate non-verifyable code, even for bogus input.

Luckily, my version doesn't do that.  Instead, I get a
#|kawa:1|# ((posbug "0" "1") 1 2)
gnu.mapping.UnboundSymbol: Unbound symbol y
	at kawa.standard.ScmEnvConstraint.get(
	at gnu.mapping.Binding.get(
	at atInteractiveLevel$lambda.apply2(foo.scm:8)
	at gnu.mapping.Procedure2.applyN(
	at gnu.expr.ApplyExp.eval(
	at gnu.expr.ModuleExp.evalModule(
	at kawa.repl.main(

The problem is that there is no space between the `.' and the `y'
in the lambda header, so Kawa thinks you are declaring an identifier `.y'.
That makes plain `y' an unbound identifier.

Finally, note that `(not y)' will never be true.  This is because `y'
is a list, and a list can never be false.  Remember that in Scheme
(unlike Common Lisp and Emacs Lisp), the empty list is considered true.
	--Per Bothner

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]