初学scheme - 写list的难点

New to scheme - Difficulties in writing list

我正在努力完成这个练习题,以便更好地掌握方案,但对于我目前的代码,它给了我一个警告:"Warning in compile: possible incorrect argument count in call (cons (list (car l1) (car l2))"

我一直在看这段代码,但仍然无法弄清楚我做错了什么。

define (zip l1 l2) 
(if (or (null? l1) (null? l2))
 (cons (list (car l1) (car l2))
   (zip (cdr l1) (cdr l2)))))

(define (map-binary func l1 l2) 
 (map (lambda (l2) (apply func l2)) (zip l1 l2)))

cons 的调用没有任何问题,但是您缺少第一个左括号和 zip 过程的基本情况,这将结束递归:

(define (zip l1 l2) 
  (if (or (null? l1) (null? l2))
      '() ; this was missing
      (cons (list (car l1) (car l2))
            (zip (cdr l1) (cdr l2)))))