[plt-scheme] Why this code based on SRFI-42 does not work under PLT Scheme ?

From: Jens Axel Soegaard (jensaxel at soegaard.net)
Date: Fri May 8 04:43:54 EDT 2009

Bruno Carnazzi wrote:
>    Hi folks,
> 
> I'd like to know why this code does not work under PLT Scheme :
> 
> (require srfi/42)
> 
> (first-ec #f (: n 0 100)  (if (even? n)) n)
> 
> It fails with message :
> 
> :until: expected <generator> in  in: (if (even? n))

Thanks for the bug report.

Here is a quick work-around:

#lang scheme
(require srfi/42
          (only-in mzscheme if))
(display (first-ec #f (: n 0 100)  (if (even? n)) n))


Note the following works fine:

#lang mzscheme
(require srfi/42)
(display (first-ec #f (: n 0 100)  (if (even? n)) n))

The explanation is that the meaning of if changed from mzscheme
to scheme -- and I forgot to change the if used in the
srfi-42 implementation.

-- 
Jens Axel Søgaard


Posted on the users mailing list.