Lisp function call error

后端 未结 4 553
傲寒
傲寒 2021-01-19 12:56

I\'ve written a Lisp function like this:

(defun power (base exponent)
  (if (= exponent 0)
      1
    (* base (power (- exponent 1)))))

Wh

4条回答
  •  再見小時候
    2021-01-19 13:27

    It is the recursive call that only has one argument:

    (power (- exponent 1))
    

    It should be like this:

    (power base (- exponent 1))
    

提交回复
热议问题