annotate samples/iterfib.tp @ 253:697c2c562af2

Fix infinite loop in hash dict
author Michael Pavone <pavone@retrodev.com>
date Sat, 31 May 2014 21:27:03 -0700
parents 3a169ebb3224
children
rev   line source
pavone@46 1 #{
pavone@46 2
pavone@46 3 fib <- :n {
pavone@46 4 last <- 0
pavone@46 5 cur <- 1
pavone@46 6 counter <- 0
pavone@46 7 while: { counter < n } do: {
pavone@46 8 counter <- counter + 1
pavone@46 9 tmp <- last
pavone@46 10 last <- cur
pavone@46 11 cur <- last + tmp
pavone@46 12 }
pavone@46 13 cur
pavone@46 14 }
pavone@46 15
pavone@46 16 main <- {
pavone@46 17 print: (string: (fib: 30)) . "\n"
pavone@46 18 }
pavone@46 19
pavone@46 20 }