Mercurial > repos > tabletprog
view src/kernel.tp @ 238:3bfc00e4f5e5
Eval lambda assignments at macro expandion time so they can be called by macros
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 05 Jan 2014 19:27:41 -0800 |
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 }