scheme map

冯阳成
2023-12-01

(map proc list ...+)

Applies proc to the elements of the lsts from the first elements to the last. The proc argument must accept the same number of arguments as the number of supplied lsts, and all lsts must have the same number of elements. The result is a list containing each result of proc in order.

proc的参数个数

list的个数

并且所有的list元素个数必须相等

参考:

4.10 Pairs and Lists

(map (lambda (a b)
       (list (+ a 1) (+ b 2)))
     '(2 3)
     '(4 5))

;(map (lambda (a b)
;       (list (+ a 1) (+ b 2)))
;     9 3)

(map (lambda (number)
         (+ 1 number))
       '(1 2 3 4))

(map (lambda (number1 number2)
         (+ number1 number2))
       '(1 2 3 4)
       '(10 100 1000 10000))

 类似资料:

相关阅读

相关文章

相关问答