scsh-users
[Top] [All Lists]

return value of do

To: scsh <scsh@zurich.csail.mit.edu>
Subject: return value of do
From: Andreas Bernauer <andreas.bernauer@gmx.de>
Date: Wed, 25 Feb 2004 13:32:36 -0500
Mail-followup-to: scsh <scsh@zurich.ai.mit.edu>
Hi,

I am using the R5RS `do' construct in scsh and it seems to return a
wrong value.  The `do' construct looks like:

 (do ((<variable1> <init1> <step1>) 
       ...) 
     (<test> <expression> ...)
     <command> ...)

R5RS says (4.2.4):

  If <test> evaluates to a true value, then ... . If no <expression>s
  are present, then the value of the `do' expression is unspecified.

So I expected the unspecified value when there is no expression.
However, scsh returns the value of the test expression:

Top level
> (do ((i 0 (+ i 1))) ((= i 1)) 1)
#t
> (do ((i 0 (+ i 1))) ('true) 1)
'true

(While e.g. mzscheme returns unspecified.)

Well, I thought maybe "unspecified" doesn't strictly mean
#{Unspecific}, but R5RS uses the same term for the return values of if
with no alternate or set!. (4.1.6: "The result of the `set!' 
expression is unspecified.") and scsh returns #{Unspecific} in both
cases.  Thus, I consider the return value of `do' as a bug.  What do
you think?

I used the current scsh 0.6.6 beta version.

Andreas.

Attachment: pgpY5esYmi8MI.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>