Hi Gregg,

> If I'm processing a file, by lines, thus:
>
> foreach line read/lines/with file rec-sep [
>
> It appears that foreach doesn't call read on each pass, but I thought I'd
> ask to see if anyone knows, for certain. I know you can modify the block
> that foreach uses and it will see the changes, but I wasn't sure what
magic
> occurs in this scenario.
>
> The real question, I suppose, is: Should I cache the return value from
'read
> before using it with foreach, or is that unnecessary?

No foreach does not call read on each pass. Read returns a series which is
then given to foreach as a parameter.
By cache I assume you mean something like:

    the-lines: read/lines/with file rec-sep
    foreach line the-lines [...]

You would only do this if you need to access those lines again in your
script. I doubt there is any other memory effect other than creation a
single word "the-lines" and the prevention of the series being garbage
collected.

No opinion on the second question due to lack of knowledge :)

Brett.

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to