This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Scheme style auto-resizing hashtable (fwd)


>>>>> "Maciej" == Maciej Stachowiak <mstachow@mit.edu> writes:


Maciej> marko.kohtala@ntc.nokia.com writes:
>> I lost the beginning of your discussion, but could your iterators
>> be a cons cell where the cdr value is delayed?
>> 

Maciej> You've just reinvented streams (mentioned in an earlier post)
Maciej> - SICP covers them pretty extensively.

>> This would be neater, if cdr, map and for-each implicitly forced
>> the cdr, but for the below example I define ++ to replace cdr.
>> 

Maciej> stream-map is well-known (and returns another stream),
Maciej> stream-for-each would be pretty useless, as you'd generate
Maciej> even more garbage than if you were just processing a normal
Maciej> list.

I'm not sure I understand what a stream is, esp. since I don't think
I've gotten marko's post yet for some reason.  But it strikes me that
stream-for-each could be useful if it blocked on the deferred cdr.

(stream-for-each (lambda (x) (print (eval x))) (read-stream stdin))

makes for a pretty elegant looking repl ;)

Or am I grossly misunderstanding streams :)

        -Eric