Mercurial > repos > tabletprog
view src/kernel.tp @ 58:7b454d100dc8
Add length method to array. Pass array of arguments to main method. Initialize parent field of environment struct for closures
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 14 Jul 2012 00:35:50 -0700 |
parents | 96e21f525b78 |
children |
line wrap: on
line source
/* array <- #{ new <- { length <- 0 #{ each <- :fun { repeat: length :idx { fun: idx (get: idx) } } } } } */ true <- #{ if:else <- :self trueblock :elseblock { trueblock: } } false <- #{ if:else <- :self trueblock :elseblock { elseblock: } } filter <- :arr pred { output <- arr slice: 0 0 each: arr :idx el { if: (pred: el) { output push: el } else: {} } output }