Hi Jon,

> On May 31, 2017, at 6:14 PM, Jon Zeppieri <zeppi...@gmail.com> wrote:
> 
> On Wed, May 31, 2017 at 5:54 PM, Steve Byan's Lists
> <steve-l...@byan-roper.org> wrote:
>> So, I don't want to try to fit all the records in memory at once. I thought 
>> that the lazy stream would accomplish this --- am I wrong?
> 
> You're right, but using a lazy stream will still consume more than
> just using `read` within the loop that actually processes the data.
> So, for example:
> 
> (define (map-trace stat%-set in-port)
>  (for/fold ([sexp-count 0])
>            ([trace-record (in-port read in)])
>    (+ sexp-count 1)))
> 
> (I didn't try this, but I think it's right.)
> 
> This way, you don't build up a list or a lazy stream; you just process
> each datum as it's read.

Thanks, I don't recall why I didn't think of this alternative. I guess I was 
hung up on streams, or else not thinking of s-expressions as lists :-(

Best regards,
-Steve

--  
Steve Byan
steveb...@me.com
Littleton, MA



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to