Retoor software development Projects Research SearchXNG
Register Sign In

6 lines
103 B
Plaintext
Raw Normal View History

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.
2014-02-15 06:06:29 +01:00
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 Copy Permalink
48ef257973
wren/test/list/map.wren
Response time: 37ms
Mail Licenses API