view 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
line wrap: on
line source

#{

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

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

fib <- :n {
  if: n < 2 {
    1
  } else: {
    (fib: n-1) + (fib: n-2)
  }
}

main <- {
  fib: 30
}

}