On Tue, May 09, 2006 at 11:23:48AM +0100, Smylers wrote:
> So I have the list generated by the scan.  And?  What do I do with it?
> I can't think of any situation in my life where I've been wanting such a
> list.

Scans are useful when the intermediate results are interesting, as well
as when you want to cut off a stream once some threshold condition is
met.

    item [+] 1 .. 10;           # 10th triangular number
    list [+] 1 .. 10;           # 10 first triangular number
    first { $_ > 42 } [+] 1 ..*  # first triangular number over 42

If you have a series whose sum yields closer and closer approximations
of some value, you can use a scan to efficiently cut off once some
epsilon is reached.

-- 
Gaal Yahas <[EMAIL PROTECTED]>
http://gaal.livejournal.com/

Reply via email to