This is the mail archive of the kawa@sourceware.cygnus.com 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" <nferrier@tapsellferrier.co.uk> 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(ScmEnv.java:74)
	at gnu.mapping.Binding.get(Binding.java:18)
	at atInteractiveLevel$lambda.apply2(foo.scm:8)
	at gnu.mapping.Procedure2.applyN(Procedure2.java:49)
	at gnu.expr.ApplyExp.eval(ApplyExp.java:38)
	at gnu.expr.ModuleExp.evalModule(ModuleExp.java:34)
	at kawa.Shell.run(Shell.java:80)
	at kawa.Shell.run(Shell.java:31)
	at kawa.repl.main(repl.java:143)

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
per@bothner.com   http://www.bothner.com/~per/

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