comparison src/kernel.tp @ 33:96e21f525b78

Forgot to add kernel.tp
author Mike Pavone <pavone@retrodev.com>
date Sun, 08 Jul 2012 12:32:24 -0700
parents
children
comparison
equal deleted inserted replaced
32:64f1d516fbfd 33:96e21f525b78
1 /*
2 array <- #{
3 new <- {
4 length <- 0
5 #{
6 each <- :fun {
7 repeat: length :idx {
8 fun: idx (get: idx)
9 }
10 }
11 }
12 }
13 }
14 */
15
16 true <- #{
17 if:else <- :self trueblock :elseblock {
18 trueblock:
19 }
20 }
21
22 false <- #{
23 if:else <- :self trueblock :elseblock {
24 elseblock:
25 }
26 }
27
28 filter <- :arr pred {
29 output <- arr slice: 0 0
30 each: arr :idx el {
31 if: (pred: el) {
32 output push: el
33 } else: {}
34 }
35 output
36 }