Category talk:Wren-sort: Difference between revisions

m
→‎Source code: Now uses Wren S/H lexer.
(→‎Source code: Added Find.nearest and SortedList.nearestIndexOf methods.)
m (→‎Source code: Now uses Wren S/H lexer.)
 
(3 intermediate revisions by the same user not shown)
Line 1:
===Source code===
 
<langsyntaxhighlight ecmascriptlang="wren">/* Module "sort.wren" */
import "./trait" for Comparable
 
Line 298:
static isSorted(a) { isSorted(a, false) }
static isSortedDesc(a) { isSorted(a, true) }
 
// Reverses a list in place and returns it.
static reverse(a) {
var c = a.count
if (c < 2) return a
var i = 0
var j = a.count - 1
while (i < j) {
var t = a[i]
a[i] = a[j]
a[j] = t
i = i + 1
j = j - 1
}
return a
}
}
 
Line 728 ⟶ 712:
// Returns the string representation of 'this'.
toString { _lst.toString }
}</langsyntaxhighlight>
9,486

edits