Fibonacci numbers in Oz
Example for versions
Mozart 1.4.0
This example uses iterative definition of Fibonacci numbers.
functor
import
Application System
define
local
A B C S
in
A = {NewCell 0}
B = {NewCell 1}
C = {NewCell 0}
S = {NewCell ""}
for I in 1..16 do
C := @A + @B
A := @B
B := @C
S := {Append {Append @S {Int.toString @A}} ", "}
end
{System.showInfo {Append @S "..."}}
{Application.exit 0}
end
end
Comments
]]>blog comments powered by Disqus
]]>