RosettaCodeData/Task/Apply-a-callback-to-an-array/ArkScript/apply-a-callback-to-an-arra...

9 lines
187 B
Plaintext

(import std.List :map)
(let array [1 2 3 4 5 6 7 8 9 10])
(let mapped (map array (fun (i) (* i i))))
(assert
(= mapped [1 4 9 16 25 36 49 64 81 100])
"mapped is a list of squares")