view samples/iterfib.tp @ 47:cd41f7c22fcd

Remove compiled hello and private samples and add source
author Mike Pavone <pavone@retrodev.com>
date Fri, 13 Jul 2012 08:50:10 -0700
parents 55572bb15623
children 3a169ebb3224
line wrap: on
line source
#{
true <- #{
  if:else <- :self trueblock :elseblock {
    trueblock:
  }
}

false <- #{
  if:else <- :self trueblock :elseblock {
    elseblock:
  }
}

fib <- :n {
  last <- 0
  cur <- 1
  counter <- 0
  while: { counter < n } do: {
  	counter <- counter + 1
  	tmp <- last
  	last <- cur
  	cur <- last + tmp
  }
  cur
}

main <- {
  print: (string: (fib: 30)) . "\n"
}

}