File tree 1 file changed +12
-6
lines changed
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 14
14
15
15
l.contains = @(item) __list.contains(l, item);
16
16
17
- l.map = @(mapping ) {
17
+ l.select = @(selector ) {
18
18
x = [];
19
- for (y in l) __list.add(x, mapping (y));
19
+ for (y in l) __list.add(x, selector (y));
20
20
ret x;
21
21
};
22
22
23
- l.filter = @(predicate) {
23
+ l.where = @(predicate) {
24
24
x = [];
25
25
for (y in l) if (predicate(y)) __list.add(x, y);
26
26
ret x;
27
27
};
28
28
29
29
l.first = @(predicate) for (x in l) if (predicate(x)) ret x;;
30
30
31
- l.collect = @(fan ) {
31
+ l.selectMany = @(selector ) {
32
32
x = [];
33
- for (y in l) for (z in fan (y)) x.add(z);
33
+ for (y in l) for (z in selector (y)) x.add(z);
34
34
ret x;
35
35
};
36
36
82
82
ret x;
83
83
};
84
84
85
- l.aggr = @(acc) {
85
+ l.aggregate = @(acc) {
86
86
if (l.count() == 1) ret l[0];
87
87
else {
88
88
s = l[0];
93
93
94
94
l.addAll = @() l.aggr(@(x, y)x + y);
95
95
96
+ l.clone = @() {
97
+ x = [];
98
+ l.iter(x.add);
99
+ ret x;
100
+ };
101
+
96
102
ret l;
97
103
};
You can’t perform that action at this time.
0 commit comments