[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LIST-LENGTH & circular lists

This page is part of the web mail archives of SRFI 1 from before July 7th, 2015. The new archives for SRFI 1 contain all messages, not just those from before July 7th, 2015.

    > So, there are basically these two levels: pure lists and
    > side-effectable lists.  In the pure-list world, it is not
    > interesting or even well-defined to ask the
    > how-many-elements-in-this-circular-list question. In the
    > side-effectable list world, it makes sense.

   In your "pure" world, there's no such thing as a circular list -
   there's no distinction basically, btw a circular list & a stream, and
   list-length should then return infinity.

   But this is scheme, which isn't "pure".  It's not clear to me why the
   distinction between a pure list & a "side-effectable" list should be

People frequently like to work in a "pure" subset of Scheme. Simpler world,
more axioms about your code & data hold. Sometimes, you work in this world
in one chunk of your program, then take an impure view for some other piece
where it's necessary to do so.