feat: implement List concat operator + supporting Range and empty lists
Add `+` method to List class in core.wren that creates a new list by concatenating elements from both operands. Supports concatenation with Range objects and handles empty lists on either side. Includes comprehensive test cases in test/list/concat.wren covering list-list, list-range, and empty list combinations.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
var a = [1, 2, 3]
|
||||
var b = [4, 5, 6]
|
||||
var c = a + b
|
||||
var d = a + (4..6)
|
||||
var e = a + []
|
||||
var f = [] + a
|
||||
var g = [] + []
|
||||
|
||||
IO.print(a) // expect: [1, 2, 3]
|
||||
IO.print(b) // expect: [4, 5, 6]
|
||||
IO.print(c) // expect: [1, 2, 3, 4, 5, 6]
|
||||
IO.print(d) // expect: [1, 2, 3, 4, 5, 6]
|
||||
IO.print(e) // expect: [1, 2, 3]
|
||||
IO.print(f) // expect: [1, 2, 3]
|
||||
IO.print(g) // expect: []
|
||||
Reference in New Issue
Block a user