【发布时间】:2014-05-23 13:42:29
【问题描述】:
我在 Scheme 中练习递归。我下面的代码用于返回连分数的值:
(define (fun n v)
(define (fun-wl b v) (
(if (null? b)v ;return a value
(fun-wl (cdr b) (/ 1 (+ (car b) v)))))) ;first arg.list, second(1/(car b+v))
(define (iter a b)
(if (null? a)(fun-wl b v)
(iter (cdr a) (cons (car a) b)))) ;reverse list
(iter n null)
)
这是我对方案的输入:
(fun '(1 2 3 4) 6)
我的代码出现了这个错误:
application: not a procedure;
expected a procedure that can be applied to arguments
given: 72/103
arguments...: [none]
【问题讨论】:
-
第二行末尾有一个空括号。括号表示 Scheme 中的函数调用。
-
你试过用谷歌搜索
site:stackoverflow.com "application: not a procedure"吗?这是多次重复。