为什么 scheme 不允许您从另一个函数中调用一个函数?

Why doesn't scheme allow you to call a function from within another function?

(define function1 (lambda(val)
  (if (list? val) 
     (function2 (val))
     ('!list))))

当我尝试输入 '(t t t) 时,出现以下错误:

application: not a procedure;
 expected a procedure that can be applied to arguments
  given: (t t t)
  arguments...: [none]

我已经定义了 function2,当我单独调用它时它可以工作,但我无法在 function1 中调用它。

问题是 val 不是函数。您应该将 (function2(val)) 替换为 (function2 val).

此外 '!list 也不是函数; if 表达式的 else 子句也需要更正。

'!listval不是程序。