sw-examples: Fibonacci.sw3

Raw file here.
-- Implement the Fibonacci sequence:
-- updated to the version 3.1.1 language

Fib |0> => |0>
Fib |1> => |1>
-- Fib |*> !=> arithmetic(Fib minus[1] |_self>, |+>, Fib minus[2] |_self>) |>
Fib |*> !=> Fib minus[1] |_self> ++ Fib minus[2] |_self>


-- now a quick demonstration:
table[number, Fib] (|0> .. |15>)


Home