aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--alv-lib/array.moon5
1 files changed, 4 insertions, 1 deletions
diff --git a/alv-lib/array.moon b/alv-lib/array.moon
index bbc1cbd..42eccee 100644
--- a/alv-lib/array.moon
+++ b/alv-lib/array.moon
@@ -246,7 +246,9 @@ map = Constant.meta
examples: { '(map array fn)' }
description: "
Invokes `fn` once for each element in `array` and returns an array of the results.
-`fn` must take one argument and return the same type consistently."
+`fn` must take two the current element and index as arugments, and return the same type consistently.
+
+ (map [1 2 3] (fn [x i] (* x 2)))"
value: class extends Builtin
eval: (scope, tail) =>
@@ -270,6 +272,7 @@ Invokes `fn` once for each element in `array` and returns an array of the result
Dummy array\make_ref!
Constant.num i-1
}
+ Constant.num i-1
}
tag = @tag\clone Tag.parse '-1'