Range consolidation: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: removed an unnecessary deep_copy(), inlined the rs>re test) |
|||
Line 710: | Line 710: | ||
{{trans|C#}} |
{{trans|C#}} |
||
<lang dyalect>type Pt(s, e) |
<lang dyalect>type Pt(s, e) with Lookup |
||
func Pt.Min() => min(this.s, this.e) |
func Pt.Min() => min(this.s, this.e) |
||
Line 725: | Line 725: | ||
func overlap(left, right) => |
func overlap(left, right) => |
||
right.Max() >= left.Min() |
left.Max() > right.Max() ? right.Max() >= left.Min() |
||
: left.Max() >= right.Min() |
|||
else left.Max() >= right.Min() |
|||
func consolidate(left, right) => Pt(min(left.Min(), right.Min()), max(left.Max(), right.Max())) |
func consolidate(left, right) => Pt(min(left.Min(), right.Min()), max(left.Max(), right.Max())) |