[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

__Function:__**fold***kons knil clist1 clist2 ...*- [SRFI-1] The fundamental list iterator.
When it is given a single list
`clist1`= (`e1``e2`...`en`), then this procedure returns(

`kons``en`... (`kons``e2`(`kons``e1``knil`)) ... )If

`n`list arguments are provided, then the`kons`function must take`n`+1 parameters: one element from each list, and the "seed" or fold state, which is initially`knil`. The fold operation terminates when the shortest list runs out of values. At least one of the list arguments must be finite.Examples:

(fold + 0 '(3 1 4 1 5 9)) => 23 ;sum up the elements (fold cons '() '(a b c d e)) => (e d c b a) ;reverse (fold cons* '() '(a b c) '(1 2 3 4 5)) => (c 3 b 2 a 1) ;n-ary case

__Function:__**fold-right***kons knil clist1 clist2 ...*- [SRFI-1] The fundamental list recursion operator.
When it is given a single list
`clist1`= (`e1``e2`...`en`), then this procedure returns(

`kons``e1`(`kons``e2`... (`kons``en``knil`)))If

`n`list arguments are provided, then the`kons`function must take`n`+1 parameters: one element from each list, and the "seed" or fold state, which is initially`knil`. The fold operation terminates when the shortest list runs out of values. At least one of the list arguments must be finite.Examples:

(fold-right cons '() '(a b c d e)) => (a b c d e) ;copy list (fold-right cons* '() '(a b c) '(1 2 3 4 5)) => (a 1 b 2 c 3) ;n-ary case

__Function:__**pair-fold***kons knil clist1 clist2 ...*__Function:__**pair-fold-right***kons knil clist1 clist2 ...*- [SRFI-1]
Like
`fold`

and`fold-right`

, but the procedure`kons`gets each`cdr`

of the given`clist`s, instead of`car`

.

__Function:__**reduce***f ridentity list*__Function:__**reduce-right***f ridentity list*- [SRFI-1]
Variant of
`fold`

and`fold-right`

.`F`must be a binary operator, and`ridentity`is the value such that for any value`x`that is valid as`f`'s input,(f x ridentity) == ridentity

These functions effectively do the same thing as

`fold`

or`fold-right`

, respectively, but omit application of`f`when`list`contains exactly one element, using the nature of`ridentity`.

__Function:__**unfold***p f g seed &optional tail-gen*- [SRFI-1]
Fundamental recursive list constructor.
Defined by the following recursin.

That is,(unfold p f g seed tail-gen) == (if (p seed) (tail-gen seed) (cons (f seed) (unfold p f g (g seed))))

`p`determines where to stop,`g`is used to generate successive seed value from the current seed value, and`f`is used to map each seed value to a list element.

__Function:__**unfold-right***p f g seed &optional tail*- [SRFI-1]
Fundamental iterative list constructor.
Defined by the following recursin.
(unfold-right p f g seed tail) == (let lp ((seed seed) (lis tail)) (if (p seed) lis (lp (g seed) (cons (f seed) lis))))

__Function:__**append-map***f clist1 clist2 ...*__Function:__**append-map!***f clist1 clist2 ...*- [SRFI-1]
Equivalent to

At least one of the list arguments must be finite.(apply append (map

`f``clist1``clist2`...)) (apply append! (map`f``clist1``clist2`...))

__Function:__**map!***f list1 clist2 ...*- [SRFI-1]
The procedure
`f`is applied to each element of`list1`and corresponding elements of`clist`s, and the result is collected to a list. Celss in`list1`is reused to construct the result list.

__Function:__**map-in-order***f clist1 clist2 ...*- [SRFI-1] A variant of
`map`

, but it guarantees to apply`f`on each elements of arguments in a left-to-right order. Since Gauche's`map`

implementation follows the same order, this function is just a synonym of`map`

.

__Function:__**pair-for-each***f clist1 clist2 ...*- [SRFI-1]
Like
`for-each`, but the procedure`f`is applied on each`cdr`

of`clist`s.

__Function:__**filter-map***f clist1 clist2 ...*- [SRFI-1]
Like
`map`

, but only true values are saved. At least one of the list arguments must be finite.(filter-map (lambda (x) (and (number? x) (* x x))) '(a 1 b 3 c 7)) => (1 9 49)

__Function:__**fold$***kons &optional knil*__Function:__**fold-right$***kons &optional knil*__Function:__**reduce$***f &optional ridentity*__Function:__**reduce-right$***f &optional ridentity*- Partial application versions of
`fold`

,`fold-right`

,`reduce`

, and`reduce-right`

.

[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

This document was generated by