Mercurial > repos > tabletprog
comparison modules/list.tp @ 311:dfd204c82849
Merge
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 01 Aug 2014 18:56:50 -0700 |
parents | ed908b7fcec6 56deb4a102db |
children | eef8a5cea812 |
comparison
equal
deleted
inserted
replaced
310:2308336790d4 | 311:dfd204c82849 |
---|---|
2 _empty <- #{ | 2 _empty <- #{ |
3 length <- { 0 } | 3 length <- { 0 } |
4 empty? <- { true } | 4 empty? <- { true } |
5 fold:with <- :acc :fun { acc } | 5 fold:with <- :acc :fun { acc } |
6 foldr:with <- :acc :fun { acc } | 6 foldr:with <- :acc :fun { acc } |
7 filter <- :pred { self } | |
8 foreach <- :self fun { self } | |
7 map <- :fun { self } | 9 map <- :fun { self } |
8 | <- :val { | 10 | <- :val { |
9 list node: val withTail: self | 11 list node: val withTail: self |
10 } | 12 } |
11 . <- :right { right } | 13 . <- :right { right } |
35 } | 37 } |
36 acc | 38 acc |
37 } | 39 } |
38 foldr:with <- :acc fun { | 40 foldr:with <- :acc fun { |
39 fun: (_tail foldr: acc with: fun) _val | 41 fun: (_tail foldr: acc with: fun) _val |
42 } | |
43 filter <- :pred { | |
44 reverse: (fold: [] with: :acc el { | |
45 if: (pred: el) { el | acc } else: { acc } | |
46 }) | |
40 } | 47 } |
41 map <- :fun { | 48 map <- :fun { |
42 node: (fun: _val) withTail: (_tail map: fun) | 49 node: (fun: _val) withTail: (_tail map: fun) |
43 } | 50 } |
44 foreach <- :self fun { | 51 foreach <- :self fun { |