Mercurial > repos > tabletprog
comparison samples/fibnof.tp @ 39:a997e42b9051
Add foreach method to array and add fib sample that can work in C environment and array example
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 10 Jul 2012 23:18:14 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
38:e7be612fd3ae | 39:a997e42b9051 |
---|---|
1 #{ | |
2 | |
3 true <- #{ | |
4 if:else <- :self trueblock :elseblock { | |
5 trueblock: | |
6 } | |
7 } | |
8 | |
9 false <- #{ | |
10 if:else <- :self trueblock :elseblock { | |
11 elseblock: | |
12 } | |
13 } | |
14 | |
15 fib <- :n { | |
16 if: n < 2 { | |
17 1 | |
18 } else: { | |
19 (fib: n-1) + (fib: n-2) | |
20 } | |
21 } | |
22 | |
23 main <- { | |
24 fib: 30 | |
25 } | |
26 | |
27 } |