annotate samples/iterfib.tp @ 211:53cd9c3bcf96

Don't compile quote expressions in C backend for now
author Mike Pavone <pavone@retrodev.com>
date Sat, 30 Nov 2013 15:04:52 -0800
parents 3a169ebb3224
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
46
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #{
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3 fib <- :n {
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
4 last <- 0
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
5 cur <- 1
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6 counter <- 0
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
7 while: { counter < n } do: {
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8 counter <- counter + 1
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
9 tmp <- last
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
10 last <- cur
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
11 cur <- last + tmp
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
12 }
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
13 cur
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
14 }
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
16 main <- {
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
17 print: (string: (fib: 30)) . "\n"
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
18 }
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
19
55572bb15623 Added iterative fib example
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
20 }