Scheme函数调用错误

时间:2016-03-31 01:52:56

标签: list scheme racket function-call

尝试运行我的程序时,我一直遇到这个错误:

function call: expected a function after the open parenthesis, but nothing's there

我似乎无法弄清楚我的代码的哪一部分是错误的修复错误。有人能指出我正确的方向吗?

以下是生成错误的代码:

(define (list2tree ls)
   (list2tree-help ls ()))

(define (list2tree-help ls tree)
   (cond ((null? ls) tree)
         (else (list2tree-help (cdr ls)
                               (insert (car ls) tree)))))

1 个答案:

答案 0 :(得分:1)

请注意,这是空列表的无效语法:

(list2tree-help ls ())

应该是:

(list2tree-help ls '())