map -- r7rs Definition functor;
Procedure variants:
((map-procedure list |1...|) -> (list-proper))
map-procedure;list;... -- at least one time;list-proper;scheme:base -- (scheme base);scheme -- (scheme);(map proc list_1 list_2 ...)Domain: It is an error if
procdoes not accept as many arguments as there arelists and return a single value.The
mapprocedure appliesprocelement-wise to the elements of thelists and returns a list of the results, in order. If more than onelistis given and not all lists have the same length,mapterminates when the shortest list runs out. Thelists can be circular, but it is an error if all of them are circular. It is an error forprocto mutate any of the lists. The dynamic order in whichprocis applied to the elements of thelists is unspecified. If multiple returns occur frommap, the values returned by earlier returns are not mutated.(map cadr '((a b) (d e) (g h))) ===> (b e h) (map (lambda (n) (expt n n)) '(1 2 3 4 5)) ===> (1 4 27 256 3125) (map + '(1 2 3) '(4 5 6 7)) ===> (5 7 9) (let ((count 0)) (map (lambda (ignored) (set! count (+ count 1)) count) '(a b))) ===> (1 2) or (2 1)
The text herein was sourced and adapted as described in the "R7RS attribution of various text snippets" appendix.