[iterate-devel] collect-tail ?

Chris Dean ctdean at sokitomi.com
Thu Dec 15 21:57:42 UTC 2005


How would I go about reading the last 10 lines in a files?  Or more
generally, how do I go about collecting the last N elements of
anything?

I'm looking for advice on the "right way" to do this using iterate.

On way would be to write collect-tail that just kept the last N
elements:

  (iter (for line :in-file my-file :using #'read-line)
        (collect-tail line :how-many 10))

Is this a good way?

Regards,
Chris Dean



More information about the iterate-devel mailing list