| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gauche.collection - Collection framework map and for-each,
and SRFI-1 (See section 10.2 srfi-1 - List library adds a rich set of such functions,
but they work only on lists.
Using the method dispatch of the object system, this module efficiently extends those functions for other collection classes such as vectors and hash tables. It also provides a simple way for user-defined class to adapt those opertaions. So far, the following operations are defined.
fold, map, map-to, for-each
find, filter, filter-to,
remove, remove-to, partition, partition-to
coerce-to
size-of, lazy-size-of
call-with-iterator, call-with-builder,
with-iterator, with-builder, call-with-iterators.
Those operations work on collections and its subclass, sequences. A collection is a certain form of a set of objects that you can traverse all the object in it in a certain way. A sequence is a collection that all its elements are ordered, so that you can retrieve its element by index.
The following Gauche built-in objects are treated as collections and/or sequences.
<list>
<vector>
<string>
<hash-table>
<s8vector>, <u8vector>, ... <f64vector>
srfi-4 module,
See section 10.4 srfi-4 - Homogeneous vectors).
See section 9.18 gauche.sequence - Sequence framework, for it adds more sequence specific
methods.
The methods that needs to return a set of objects, i.e.
map, filter, remove and partition.
returns a list (or lists). The corresponding "-to" variant
(map-to, filter-to, remove-to and partition-to.
takes a collection class argument and returns the collection of the class.
9.3.1 Mapping over collection 9.3.2 Selection and searching in collection 9.3.3 Miscellaneous operations on collection 9.3.4 Fundamental iterator creators 9.3.5 Implementing collections
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |