Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -1,18 +1,19 @@
#define system.
#define extensions.
#symbol fibo = (:n)
[
n < 0
? [ #throw InvalidArgumentException new:"Must be non negative". ].
(n < 0)
? [ #throw InvalidArgumentException new &message:"Must be non negative". ].
^ { eval:n [ ^ (n > 1) ? [ ($self:(n - 2)) + ($self:(n - 1)) ] ! [ n ]. ] }:n.
].
#symbol program =
[
control forrange &int:-1 &int:10 &do: (&int:i)
-1 to:10 &doEach: (:i)
[
console << "fib(" << i << ")=".
console writeLiteral:"fib(":i:")=".
console writeLine:(fibo:i) | if &InvalidArgumentError: e
[