langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,17 @@
fib() {
if test 0 -gt "$1"; then
echo "fib: fib of negative" 1>&2
return 1
else
(
fib2() {
if test 2 -gt "$1"; then
echo "$1"
else
echo $(( $(fib2 $(($1 - 1)) ) + $(fib2 $(($1 - 2)) ) ))
fi
}
fib2 "$1"
)
fi
}

View file

@ -0,0 +1,18 @@
$ for i in -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12; do
> fib $i
> done
fib: fib of negative
fib: fib of negative
0
1
1
2
3
5
8
13
21
34
55
89
144