球拍有什么程序
Racket what does the procedure
我有一个程序,但实际上我不知道它的作用。
有人会解释吗?
(define (stj fun listt)
(if (null? listt)
`()
(cons (fun (car listt)) (stj fun (cdr listt)))))
这是map
程序,检查documentation。它以一个过程和一个列表作为参数,并将该过程应用于输入列表中的每个元素,生成一个输出列表,结果为:
(stj sqr '(1 2 3 4 5))
=> '(1 4 9 16 25)
我有一个程序,但实际上我不知道它的作用。 有人会解释吗?
(define (stj fun listt)
(if (null? listt)
`()
(cons (fun (car listt)) (stj fun (cdr listt)))))
这是map
程序,检查documentation。它以一个过程和一个列表作为参数,并将该过程应用于输入列表中的每个元素,生成一个输出列表,结果为:
(stj sqr '(1 2 3 4 5))
=> '(1 4 9 16 25)