Range consolidation: Difference between revisions
→{{header|Wren}}: Now uses new core library method.
(Added solution for Action!) |
(→{{header|Wren}}: Now uses new core library method.) |
||
Line 2,237:
=={{header|Wren}}==
As Wren already has a built-in Range class (which is not quite the same as what's required here), we create a Span class instead.
<lang ecmascript>
construct new(r) {
if (r.type != Range || !r.isInclusive) Fiber.abort("Argument must be an inclusive range.")
Line 2,259 ⟶ 2,256:
if (_high < r.low) return [this, r]
if (r.high < _low) return [r, this]
return [Span.new(
}
|