Category talk:Wren-sort: Difference between revisions
→Source code: Removed Comparable class which is now being imported from new Wren-trait module.
m (→Source code: Changed a method name.) |
(→Source code: Removed Comparable class which is now being imported from new Wren-trait module.) |
||
Line 1:
===Source code===
<lang ecmascript>/* Module "
import "/trait" for Comparable
/*
Line 419 ⟶ 420:
static highest(a) { highest(a, false) }
// Finds the
// Returns a list of three items:
// The first item is a list of the
// The second item is the number of
// The third item is the range of indices at which the
static
Sort.isList_(a)
var c = a.count
if (c == 0) Fiber.abort("An empty list does not have a
var hc = (c/2).floor
return (c%2 == 1) ? [[a[hc]], 1, hc..hc] : [[a[hc-1], a[hc]], 2, hc-1..hc]
}
}
Line 454 ⟶ 437:
var Cmp_Cmp = Cmp
var Cmp_Sort = Sort
var Cmp_Find = Find</lang>
|