方案不能定义函数

Scheme cannot define function

我有这样一段代码,我检查了我的大括号,但仍然不知道为什么编译器给我

#f is not a function [sumOfSqaresOfTwoBiggest, (anon)]

错误

(
  define (sumOfSqaresOfTwoBiggest a b c) (
    cond (
      ((and (> a c ) (> b c)) (+ (* a a) (* b b)))
      ((and (> a b) (> c b)) (+ (* a a) (* c c)))
      (else (+ (* a a) (* c c)))
    )
  )
)
(sumOfSqaresOfTwoBiggest 1 2 3)

您格式化 lisp 代码的方式很不寻常。事实上,使用为这种代码量身定做的编辑器将帮助你避免这种错误,是的,错误的括号。

这里是正确的缩进版本:

(define (sumOfSqaresOfTwoBiggest a b c)
  (cond ((and (> a c ) (> b c)) (+ (* a a) (* b b)))
        ((and (> a b) (> c b)) (+ (* a a) (* c c)))
        (else (+ (* a a) (* c c)))))

(sumOfSqaresOfTwoBiggest 1 2 3)