www.delorie.com/gnu/docs/guile/guile_446.html | search |
Buy GNU books! | |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
(kons en1 en2 ... (kons e21
e22 (kons e11 e12 knil)))
,
if enm are the elements of the lists lst1, lst2, ....
fold
, but applies kons in right-to-left order
to the list elements, that is:
(kons e11 e12(kons e21
e22 ... (kons en1 en2 knil)))
,
fold
, but apply kons to the pairs of the list
instead of the list elements.
fold-right
, but apply kons to the pairs of the list
instead of the list elements.
reduce
is a variant of reduce
. If lst is
()
, ridentity is returned. Otherwise, (fold (car
lst) (cdr lst))
is returned.
fold-right
variant of reduce.
unfold
is defined as follows:
(unfold p f g seed) = (if (p seed) (tail-gen seed) (cons (f seed) (unfold p f g (g seed)))) |
(lambda (x) '())
.
g produces a series of seed values, which are mapped to list elements by f. These elements are put into a list in left-to-right order, and p tells when to stop unfolding.
(let lp ((seed seed) (lis tail)) (if (p seed) lis (lp (g seed) (cons (f seed) lis)))) |
(lambda (x) '())
.
(apply append (map f clist1 clist2 ...)) |
and
(apply append! (map f clist1 clist2 ...)) |
Map f over the elements of the lists, just as in the map
function. However, the results of the applications are appended
together to make the final result. append-map
uses
append
to append the results together; append-map!
uses
append!
.
The dynamic order in which the various applications of f are made is not specified.
map
-- map!
is allowed, but not
required, to alter the cons cells of lst1 to construct the
result list.
The dynamic order in which the various applications of f are made is not specified. In the n-ary case, lst2, lst3, ... must have at least as many elements as lst1.
for-each
, but applies the procedure f to the pairs
from which the argument lists are constructed, instead of the list
elements. The return value is not specified.
map
, but only results from the applications of f
which are true are saved in the result list.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
webmaster | delorie software privacy |
Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |