[plt-scheme] Dead lock using map-stream?
First of all, what good would that thing do?
map-stream calls proc for each element of the stream, or in other words, calls (+ 0), (+ 1), etc. and streams them.
Second, does (enumerate-interval 0 10) work?
-----Original Message-----
From: Gurpreet S. Saini [mailto:gsaini at u.washington.edu]
Sent: א 23/11/2003 05:08
To: plt-scheme at list.cs.brown.edu
Cc:
Subject: [plt-scheme] Dead lock using map-stream?
For list-related administrative tasks:
http://list.cs.brown.edu/mailman/listinfo/plt-scheme
[Note that both of definitions come from chapter 3 of
the first edition of SICP]
Consider
1. the following defintions:
(define the-empty-stream '())
(define (enumerate-interval low high)
(if (> low high)
the-empty-stream
(cons-stream low
(enumerate-interval (+ low 1) high))))
(define (map-stream proc stream)
(if (empty-stream? stream)
the-empty-stream
(cons-stream (proc (head stream))
(map-stream proc (tail stream)))))
2. And the following call:
(map-stream + (enumerate-interval 0 10))
Right now this call is stalled. It looks to me like
this is supposed to happen. This is because both enumerate-interval and
map-stream's call to tail is in a cons-stream.
thanks
--Gurp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20031123/43e77269/attachment.html>