ServerJS/API/iter/ProposalK

From MozillaWiki
< ServerJS‎ | API
Jump to: navigation, search
/*** Iterable
    a mixin that adds convenience functions to types
    that implement `iter`.
*/

/**** iter
    a default ``iter`` that returns itself.
*/
/**** added */
/**** nextCatch */
/**** len
    a default, destructive implementation
    of `len` that consumes the remaining elements
    of the iteration and returns how many were
    encountered.
*/
/**** toObject */
/**** toArray */
/**** toList */
/**** toDict */
/**** toUnique
    returns a `Set` of the unique elements of the iterable.
*/
/**** toString
    returns the concatenation of the elements of the 
    iterable coerced into `String` objects.
*/
/**** toNumber
    a polymorphic alias of `len`.
*/
/**** toBoolean
    returns whether `toNumber` is greater than 0.
*/
/**** sliced */
/**** forEach */
/**** forEachApply */
/**** each */
/**** eachIter */
/**** eachApply */
/**** eachApplyIter */
/**** where */
/**** whereIter */
/**** whereApply */
/**** whereApplyIter */
/**** zip */
/**** zipIter */
/**** transpose */
/**** transposeIter */
/**** enumerate */
/**** enumerateIter */
/**** reduce */
/**** reduced */
/**** flatten */
/**** flattened */
/**** group */
/**** sorted */
/**** reversed */
/**** min */
/**** mix */
/**** sum */
/**** product */
/**** all */
/**** any */
/**** join */


/*** Iter
    - :is:`Iterable`

    Accepts:

    - an optional ``next`` `Function`.  Without a ``next`` function,
      returns an empty iteration.
    - an optional ``hasNext`` `Function``.

*/
/**** next */
/**** hasNext */

/*** iter
    Returns an iteration of a given object.  Attempts
    to call the polymorphic `iter` of a typed object.
    Otherwise, coerces to the first applicable of 
    `String`, `Array`, or `Object` types.
*/

/*** objectIter */
/*** arrayIter */
/*** stringIter */


/**
    Top Level Functions
    ===================

    Functions that operate on iterables, or objects
    coercible to iterables using the polymorphic `iter`
    function.
*/

/*** forEach */
/*** forEachApply */
/*** each */
/*** each */
/*** eachIter */
/*** eachApply */
/*** eachApplyIter */
/*** where */
/*** whereIter */
/*** whereApply */
/*** whereApplyIter */
/*** map */
/*** mapIter */
/*** forTimes */
/*** timesIter */
/*** times */
/*** transpose */
/*** transposeIter */
/*** zip */
/*** zipIter
/*** enumerate */
/*** enumerateIter */
/*** reduce */
/*** cycle */
/*** chain */
/*** repeat */
/*** flatten */
/*** compact */
/*** compactIter */
/*** without */
/*** withoutIter */
/*** group */
/*** all */
/*** any */
/*** min */
/*** max */