Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -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
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue