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

6.15.1.1 Mapping

Function: map proc list1 list2 ...
[R5RS+] Applies proc for each element(s) of given list(s), and returns a list of the results. R5RS doesn't specify the application order of map, but Gauche guarantees proc is always applied in order of the list(s). Gauche's map also terminates as soon as one of the list is exhausted.

 
(map car '((a b) (c d) (e f))) => (a c e)

(map cons '(a b c) '(d e f))
  => ((a . d) (b . e) (c . f))

Note that the gauche.collection module (See section 9.3 gauche.collection - Collection framework) extends map to work on any type of collection.

Function: for-each proc list1 list2 ...
[R5RS] Applies proc for each element(s) of given list(s) in order. The results of proc are discarded. The return value of for-each is undefined. When more than one list is given, for-each terminates as soon as one of the list is exhausted.

Note that the gauche.collection module (See section 9.3 gauche.collection - Collection framework) extends for-each to work on any type of collection.



This document was generated by Ken Dickey on November, 28 2002 using texi2html