chickadee » sequences » make-linear-sequence

make-linear-sequence MAKE ELT NEXTprocedure

Returns an object representing a sequence that only allows sequential "on-at-a-time" access to its elements. MAKE should be a procedure of two arguments, a size count and an initial value and should return a collection of elements which will be stored as "state" in the sequence object. ELT should be a procedure of one argument receiving the "state" and should return the element inside the collection that is represented by the currently stored state. NEXT should be a procedure that receives the current state and returns a new state representing the underlying collection that will make the next element accessible via ELT. If the collection has run out of elements, NEXT should return #f.