# HG changeset patch # User Michael Pavone # Date 1387656370 28800 # Node ID f3d5068cbd43e93f18b7efc4b826af62b6487e5e # Parent e01137a976546c9089afd45169e58a5fbb08619d Add contains? method to list diff -r e01137a97654 -r f3d5068cbd43 modules/list.tp --- a/modules/list.tp Fri Dec 06 19:19:54 2013 -0800 +++ b/modules/list.tp Sat Dec 21 12:06:10 2013 -0800 @@ -11,6 +11,7 @@ . <- :right { right } reverse <- { self } join <- { "" } + contains? <- :val { false } string <- { "[]" } print <- { print: string } } @@ -63,6 +64,13 @@ acc . sep . el } } + contains? <- :val { + if: _val = val { + true + } else: { + _tail contains?: val + } + } string <- { (fold: "[\n" with: :acc el { acc . " " . (string: el) . "\n"