[plt-scheme] Why does (begin ((lambda () (values))) (display "k")) fail?

From: ifconfig (nslookupifconfig at hotmail.com)
Date: Wed May 19 08:45:51 EDT 2004

The problem is not that the call to values has no arguments, it is that the
expression that accepts (values) gets 0 values instead of 1.
An example:

Welcome to DrScheme, version 207.
Language: Pretty Big (includes MrEd and Advanced).
> (call-with-values (lambda () (values 1 2 3))
                    list)
(1 2 3)
> (call-with-values (lambda () (values 1 2))
                    list)
(1 2)
> (call-with-values (lambda () (values 1))
                    list)
(1)
> (call-with-values (lambda () (values))
                    list)
()
>

Yours,
ifconfig.


> -----Original Message-----
> From: plt-scheme-admin at list.cs.brown.edu [mailto:plt-scheme-
> admin at list.cs.brown.edu] On Behalf Of Noel Welsh
> Sent: Wednesday, May 19, 2004 1:02 PM
> To: Anders Conradi; plt-scheme at list.cs.brown.edu
> Subject: Re: [plt-scheme] Why does (begin ((lambda () (values))) (display
> "k")) fail?
> 
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> 
> --- Anders Conradi <beque at telia.com> wrote:
> 
> > Welcome to DrScheme, version 206p1.
> > Language: Standard (R5RS).
> >  > (define l (lambda () (values)))
> >  > (begin (l) (display "k"))
> > context expected 1 value, received 0 values
> >  > ((lambda () (begin (l) (display "k"))))
> > k
> 
> I can confirm this works in MzScheme but displays an
> error in DrScheme (in the MzScheme language no less).
> It is due to the call to values with no value
> supplied.  Some smaller examples:
> 
> > (values)
> 
> > (begin (values) 1)
> context expected 1 value, received 0 values
> 
> > (display (values))
> [bug icon] context expected 1 value, received 0 values
> 
> I can't explain it, but it only seems to occur when
> the value of (values) is used in another expression.
> 
> Noel
> 
> 
> =====
> Email: noelwelsh <at> yahoo <dot> com
> Jabber: noelw <at> jabber <dot> org
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! - Internet access at a great low price.
> http://promo.yahoo.com/sbc/


Posted on the users mailing list.