【发布时间】:2021-01-13 15:32:14
【问题描述】:
我正在尝试创建一个函数来将整数列表连接成单个整数/字符串, 预期值:
(check-expect (concatNumbers (list 1 2 3 4)) 1234)
(check-expect (concatNumbers (list 0 4 3 2 1)) 04321)
我的功能:
(define (concatNumbers alon)
(local
((define (inner list1 acc)
(cond
((empty? list1) acc)
(else
((string-append (number->string (first list1)) acc)
(inner (rest list1) acc))))))
(inner alon "")))
但是有一个我无法理解的错误:
function call: expected a function after the open parenthesis, but received "3"
我试图找到以下值的测试:
(concatNumbers (list 1 5 7 8 9 3))
【问题讨论】:
-
那是....不是串联。
标签: syntax conditional-statements scheme racket function-call