1
我看到一本關於如何創建方案的地圖功能的代碼,代碼如下:如何調用該地圖功能
:(define map (lambda (f L)
(if null? L '()
(cons (f (car L)) (map f (cdr L))))))
(define square (lambda (x)
(* x x)))
(define square-list (lambda (L)
(map square L)))
按說我可以稱它爲
(map square-list '(1 2 3 4))
但它扔我下面的錯誤:
SchemeError: too many operands in form: (null? L (quote()) (cons (f (car L)) (map f (cdr L))))
Current Eval Stack:
-------------------------
0: (map square-list (quote (1 2 3 4)))
我應該如何調用該函數?