(reversed [list])

This commit is contained in:
2021-06-23 17:18:07 -06:00
parent fe85c15060
commit 23364c1a7a
2 changed files with 7 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ class Kiss {
"groups" => Symbol("Prelude.groups"),
"zip" => Symbol("Prelude.zip"),
"pairs" => Symbol("Prelude.pairs"), // TODO test pairs
"reversed" => Symbol("Prelude.reversed"), // TODO test reversed
"memoize" => Symbol("Prelude.memoize"), // TODO test memoize
"symbolName" => Symbol("Prelude.symbolName"),
"symbol" => Symbol("Prelude.symbol"),

View File

@@ -216,6 +216,12 @@ class Prelude {
return zip(l1, l2);
}
public static function reversed<T>(l:kiss.List<T>):kiss.List<T> {
var c = l.copy();
c.reverse();
return c;
}
// Ranges with a min, exclusive max, and step size, just like Python.
public static function range(min, max, step):Iterator<Int> {
if (step <= 0)