Mercurial > repos > tabletprog
comparison modules/list.tp @ 300:ea94b1e43c97
Add foreach to empty list
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 25 Jul 2014 13:43:25 -0700 |
parents | bb4723fec05e |
children | 56deb4a102db |
comparison
equal
deleted
inserted
replaced
299:c0561cb06ee3 | 300:ea94b1e43c97 |
---|---|
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 foreach <- :self fun { self } | |
7 map <- :fun { self } | 8 map <- :fun { self } |
8 | <- :val { | 9 | <- :val { |
9 list node: val withTail: self | 10 list node: val withTail: self |
10 } | 11 } |
11 . <- :right { right } | 12 . <- :right { right } |