Next: SRFI-1 Filtering and Partitioning, Previous: SRFI-1 Length Append etc, Up: SRFI-1
Fold the procedure kons across all elements of lst1, lst2, .... Produce the result of
(kons en1 en2... (kons e21 e22(kons e11 e12 knil))),if enm are the elements of the lists lst1, lst2, ....
Similar to
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))),
Like
fold, but apply kons to the pairs of the list instead of the list elements.
Like
fold-right, but apply kons to the pairs of the list instead of the list elements.
reduceis a variant offold. If lst is(), ridentity is returned. Otherwise,(fold (carlst) (cdrlst))is returned.
unfoldis defined as follows:(unfold p f g seed) = (if (p seed) (tail-gen seed) (cons (f seed) (unfold p f g (g seed))))
- p
- Determines when to stop unfolding.
- f
- Maps each seed value to the corresponding list element.
- g
- Maps each seed value to next seed valu.
- seed
- The state value for the unfold.
- tail-gen
- Creates the tail of the list; defaults to
(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.
Construct a list with the following loop.
(let lp ((seed seed) (lis tail)) (if (p seed) lis (lp (g seed) (cons (f seed) lis))))
- p
- Determines when to stop unfolding.
- f
- Maps each seed value to the corresponding list element.
- g
- Maps each seed value to next seed valu.
- seed
- The state value for the unfold.
- tail
- The tail of the list; defaults to the empty list.
Map the procedure over the list(s) lst1, lst2, ... and return a list containing the results of the procedure applications. This procedure is extended with respect to R5RS, because the argument lists may have different lengths. The result list will have the same length as the shortest argument lists. The order in which f will be applied to the list element(s) is not specified.
Apply the procedure f to each pair of corresponding elements of the list(s) lst1, lst2, .... The return value is not specified. This procedure is extended with respect to R5RS, because the argument lists may have different lengths. The shortest argument list determines the number of times f is called. f will be applied to the list elements in left-to-right order.
Equivalent to
(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
mapfunction. However, the results of the applications are appended together to make the final result.append-mapusesappendto append the results together;append-map!usesappend!.The dynamic order in which the various applications of f are made is not specified.
Linear-update variant of
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.