mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 06:08:41 +01:00
Update set example to use bitwise operators
This commit is contained in:
committed by
Kyle Marek-Spartz
parent
18af6514f0
commit
a67cde69bb
@ -68,27 +68,25 @@ class Set {
|
|||||||
return new Set(_list.where(f))
|
return new Set(_list.where(f))
|
||||||
}
|
}
|
||||||
|
|
||||||
/*| that {
|
| that {
|
||||||
// Union
|
// Union
|
||||||
|
return new Set(_list + that)
|
||||||
}*/
|
}
|
||||||
|
|
||||||
+ that {
|
+ that {
|
||||||
// A synonym for |
|
// A synonym for |
|
||||||
return new Set(_list + that)
|
return this | that
|
||||||
// return this | that
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* & that {
|
& that {
|
||||||
// Intersection
|
// Intersection
|
||||||
return new Set(
|
return new Set(
|
||||||
_list.where(fn (element) {
|
_list.where(fn (element) {
|
||||||
return that.contains(element)
|
return that.contains(element)
|
||||||
}) + that.where(fn (element) {
|
}) + that.where(fn (element) {
|
||||||
return _list.contains(element)
|
return _list.contains(element)
|
||||||
})
|
}))
|
||||||
)
|
}
|
||||||
} */
|
|
||||||
|
|
||||||
- that {
|
- that {
|
||||||
// Set minus
|
// Set minus
|
||||||
|
|||||||
Reference in New Issue
Block a user