-2
我正在尝试编写一个函数,它会将一个新的数字添加到数字列表的末尾,但我似乎无法追查并纠正我的语法错误。有人能帮助我吗?谢谢!我的程序怎么没有运行,我得到语法错误? (DrRacket/Scheme)
(define (add the-list element)
(cond
((empty? the-list) (list element)
(else (cons (first the-list) cons (add (rest the-list) element))))))
(check-expect (four (list 2 5 4) 1) (list 2 5 4 1)) ; four adds num at the end of lon
调用'检查,期望'使用'add',而不是'four'。 – 2014-09-19 19:14:33