This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
define-values
- From: Steve Yegge <steve dot yegge at gmail dot com>
- To: kawa at sources dot redhat dot com
- Date: Tue, 22 Mar 2005 02:40:40 -0800
- Subject: define-values
- Reply-to: Steve Yegge <steve dot yegge at gmail dot com>
I was looking around for a way to make multiple definitions at once,
and found the FAQ entry at schemers.org (
http://schemers.org/Documents/FAQ/#multidefine)
that provides a macro for it. It doesn't seem to work in Kawa:
(define-syntax define-values
(syntax-rules ()
((define-values () exp)
(call-with-values (lambda () exp) (lambda () 'unspecified)))
((define-values (var . vars) exp)
(begin
(define var (call-with-values (lambda () exp) list))
(define-values vars (apply values (cdr var)))
(define var (car var))))
((define-values var exp)
(define var (call-with-values (lambda () exp) list)))))
(define-values (one two) (values 1 2))
<stdin>:419:1: warning - duplicate definition for 'two' (overrides line 419:21)
<stdin>:419:1: warning - duplicate definition for 'one' (overrides line 419:16)
gnu.mapping.UnboundLocationException: unbound location one (property (dynamic))
at gnu.mapping.Location.get(Location.java:67)
at atInteractiveLevel$129.lambda2(<stdin>:419)
at atInteractiveLevel$129.apply0(<stdin>:410)
at gnu.expr.ModuleMethod.apply0(ModuleMethod.java:177)
at kawa.standard.call_with_values.callWithValues(call_with_values.java:12)
at atInteractiveLevel$129.run(<stdin>:419)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:259)
at kawa.Shell.run(Shell.java:231)
at kawa.Shell.run(Shell.java:177)
at kawa.Shell.run(Shell.java:164)
at kawa.Shell.run(Shell.java:151)
at kawa.repl.main(repl.java:673)
And in any case, the macro only works for top-level definitions, not
internal ones (according to the FAQ).
Would it be worthwhile to add an implementation of define-values to Kawa?
-steve