feat: add List.map method with test for element transformation
Implement a `map` method on the List class that applies a given function `f` to each element, returning a new list with the transformed values. Includes a test case verifying incrementing each element by 1.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
var a = [1,2,3]
|
||||
var inc = fn (x) { return x + 1 }
|
||||
var b = a.map(inc)
|
||||
|
||||
IO.write(b) // expect: [2, 3, 4]
|
||||
Reference in New Issue
Block a user