Functional programming Racket博士,反对者:预期2个论点,但发现3个
我有这个函数和其他一些函数,但当我运行它时,racket博士说: 缺点:期望2个参数,但找到3个 我想不出哪里的Functional programming Racket博士,反对者:预期2个论点,但发现3个,functional-programming,racket,Functional Programming,Racket,我有这个函数和其他一些函数,但当我运行它时,racket博士说: 缺点:期望2个参数,但找到3个 我想不出哪里的cons不正确,有人能帮我吗 ;; Component -> ListOfCode ;; produce a list of codes of all parts required to build the given component ;; if a part appears twice, the code of the bar should also appear twic
cons
不正确,有人能帮我吗
;; Component -> ListOfCode
;; produce a list of codes of all parts required to build the given component
;; if a part appears twice, the code of the bar should also appear twice
(check-expect (list-code C0) (cons "000000" (cons "111000" (cons "222000" empty))))
(check-expect (list-code C1) (cons "000000" (cons "111000" (cons "111000" (cons 444000 empty)))))
(check-expect (list-code C3) (cons "000000" (cons "111000" (cons "555000" (cons "666000" (cons "666000" (cons "000000" (cons "111000" (cons "222000" (cons "000000" (cons "111000" (cons "111000" (cons 444000 empty)))))))))))))
;(define (list-code c) loc)
(define (list-code c)
(cons (find-codes-loc (component-loc c)) ;fn-for-loc
(get-code-lop (component-lop c)) ;fn-for-lop
empty))
在这里:
(define (list-code c)
(cons (find-codes-loc (component-loc c)) -- argument 1
(get-code-lop (component-lop c)) -- argument 2
empty)) -- argument 3