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

From: Robby Findler (robby at cs.uchicago.edu)
Date: Wed May 19 12:07:29 EDT 2004

At Wed, 19 May 2004 04:01:36 -0700 (PDT), Noel Welsh wrote:
> 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:

> > (begin (values) 1)
> context expected 1 value, received 0 values

This is a bug in DrScheme. It'll be fixed for v299 (can't be fixed
right now, since DrScheme is still in shambles due to unicode
translation, but I've added a test case so I won't forget -- thanks!)

The correct answer is just 1. The reason: toplevel begin should behave
as if the expressions were just entered sequentially into the REPL.

> > (display (values))
> [bug icon] context expected 1 value, received 0 values

In this case, this is correct response. The arguments (and the function
position) of an application should produce exactly one value (not zero,
like in this case).

Robby


Posted on the users mailing list.