【问题标题】:applying non procedure and non object error应用非过程和非对象错误
【发布时间】:2012-08-16 18:55:56
【问题描述】:
declare
fun {Factorial N}
   local FactorialAux in
      fun {FactorialAux N Product}
     if N == 0 then Product
     else {FactorialAux N-1 {fibo N}|Product}
     end
      end
      {FactorialAux N nil}
   end
end

fun {fibo N}
   if N==1 then 1
   else if N==2 then 1
    else {fibo N-1}+{fibo N-2}
    end
   end
end

{Browse {Factorial 3}}

我的代码打印斐波那契数列。如果 N = 4,则打印前四个斐波那契数列 这是我的代码,其中我收到了问题标题中所述的错误。 提前感谢您的任何帮助

【问题讨论】:

    标签: fibonacci oz


    【解决方案1】:

    变量必须以 Oz 中的大写字母开头。过程和函数名称始终是变量,因此它们也必须以大写字母开头。

    你的函数fibo 应该被称为Fibo。当然,所有对fibo 的调用也必须修复。

    【讨论】:

      猜你喜欢
      • 2014-03-06
      • 1970-01-01
      • 2014-11-15
      • 1970-01-01
      • 1970-01-01
      • 2013-02-24
      • 2011-02-07
      • 2023-03-22
      • 1970-01-01
      相关资源
      最近更新 更多