[plt-scheme] v4 questions

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Mar 30 17:10:52 EDT 2008

On Mar 30, Doug Orleans wrote:
> Mark Engelberg writes:
>  > I've been looking through the preview reference:
>  > http://pre.plt-scheme.org/docs/html/reference/index.html for v4.0, and
>  > have a few comments/questions.
>  >
>  > 1. Why no streams?  Wouldn't it be nice to have a solid stream
>  > implementation with namings that are consistent with the PLTScheme
>  > list functions, and integrated into the comprehension syntax, i.e.,
>  > for/stream ?  Please consider this...
> 
> I kind of agree, but this would also be pretty simple to do as a
> PLaneT package.  Here's a start:
> 
>   (define-syntax (for/stream stx)
>     [...])

I have never seen a practical need for something like this (where by
"this" I mean a general facility to turn a sequence of side-effects
into a stream of values).  If you have a lazy cons, then (IME) it's
usually easier to just use it directly.  If you have a `for' loop with
side effects, you can just keep it as such.


>   (define (in-stream s)
>     (make-do-sequence
>      (lambda ()
>        (values stream-car stream-cdr s stream-pair? void void))))

Why not a generic `in-delayed' which makes up the usual iterator
values, then wraps them all in functions that automatically force
promises?  This way you don't have to pre-choose whether to use even
or odd streams, whether you delay the cars or not etc, plus you get it
to work with a bunch of other lazy types (as long as they're using the
same delay/force).


>  > 4. I noticed that the built-in list functions and string functions are
>  > a tiny bit beefier than v372, but still fall short from the more
>  > complete SRFI implementations.  I hope that it will be extremely
>  > easy to bring in the missing functions without conflict.  In v372
>  > it's a bit awkward to get a full suite of string and list
>  > functions because of conflicts.
> 
> As of a week or two ago, you can do the following and not get any
> conflicts:
> 
>   #lang scheme
>   (require srfi/1)
>   (require srfi/13)
> 
> In other words, extremely easy!

There is still a problem with requiring both srfi/1 and scheme/list.
A solution for that is:

  (require scheme/list (subtract-in srfi/1 scheme/list))

which will grab everything from scheme/list, and stuff from srfi/1
that are not provided by scheme/list.  (This is using the
scheme/require library.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.