ReindexedCollection.st
changeset 4145 dac736be1523
parent 3861 694e93011ca8
child 4342 f7a0d195e291
equal deleted inserted replaced
4144:9093e8aaf912 4145:dac736be1523
    38 
    38 
    39 documentation
    39 documentation
    40 "
    40 "
    41     ReindexedCollection is a wrapper around a sequenceable collection that remaps the indices 
    41     ReindexedCollection is a wrapper around a sequenceable collection that remaps the indices 
    42     with in linear algorithm.  
    42     with in linear algorithm.  
    43     The elements in the ReindexedCollection are elements in the sequenceable collection at 
    43     The elements in the ReindexedCollection are the elements of the original collection 
    44     some start to some stop at some step.  
    44     at 'some start' to 'some stop' (optionally 'by some step').  
    45 
    45 
    46     ReindexedCollection allows for efficient use of first/rest-like algorithms (i.e. aka Lisp)
    46     ReindexedCollection allows for efficient use of first/rest-like algorithms (i.e. aka Lisp)
    47     applied to Sequenceable collections, as they avoid element-copying.
    47     applied to Sequenceable collections, as they avoid element-copying.
    48 
    48 
       
    49     For example,
       
    50         coll1 := #(1 2 3 4 5 6 7 8 9 10).
       
    51         coll2 := coll1 from:8.
       
    52     gives us a collection in coll2, which 'contains' 3 elements, 8, 9, 10
       
    53     with indices 1,2,3. 
       
    54     I.e. a slice from the other array.
       
    55 
       
    56     The reindexed collection is 'read-only'. I.e. it does not allow for elements to be changed.
       
    57     
    49     See class side examples.
    58     See class side examples.
    50 
    59 
    51     [Instance Variables:]
    60     [Instance Variables:]
    52         sequence        <SequenceableCollection>        the sequence that will be reindexed.
    61         sequence        <SequenceableCollection>    the sequence that will be reindexed.
    53         interval        <Interval>      the object that describes indicies of interest in the sequence.
    62         interval        <Interval>                  the object that describes indicies of interest in the sequence.
    54 
    63 
    55     [Origin:]
    64     [Origin:]
    56         Part of the Engineering Math Goodies package from Travis.
    65         Part of the Engineering Math Goodies package from Travis.
    57     
    66     
    58     [Author:]
    67     [Author:]