Third try. ;) Concat operator, tests. Now [1,2,3] + (4..6) works! Inlined helper functions to keep core lib small.
This commit is contained in:
@@ -8,4 +8,19 @@ class List {
|
||||
result = result + "]"
|
||||
return result
|
||||
}
|
||||
|
||||
+ that {
|
||||
var newList = []
|
||||
if (this.count > 0) {
|
||||
for (element in this) {
|
||||
newList.add(element)
|
||||
}
|
||||
}
|
||||
if (that is Range || that.count > 0) {
|
||||
for (element in that) {
|
||||
newList.add(element)
|
||||
}
|
||||
}
|
||||
return newList
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user