# HG changeset patch # User Mike Pavone # Date 1377568778 25200 # Node ID 372cbd2cd2430c61c392ff95919b4d7fa471286f # Parent a45e535f77422d2b039eff592ca8eb9dda5dd3c4 Added reverse method to lists diff -r a45e535f7742 -r 372cbd2cd243 modules/list.tp --- a/modules/list.tp Mon Aug 26 18:23:05 2013 -0700 +++ b/modules/list.tp Mon Aug 26 18:59:38 2013 -0700 @@ -9,6 +9,7 @@ list node: val withTail: self } . <- :right { right } + reverse <- { self } join <- { "" } string <- { "[]" } print <- { print: string } @@ -52,6 +53,11 @@ node: val withTail: tail } } + reverse <- { + fold: [] with: :tail val { + node: val withTail: tail + } + } join <- :sep { _tail fold: (string: _val) with: :acc el { acc . sep . el