Namespace: go.std.sort
v1.0Contents
Summary
Provides a lowlevel interface to the sort package.
Package sort provides primitives for sorting slices and userdefined collections.
Index
 Float64Slice
 Float64s
 Float64sAreSorted
 IntSlice
 Interface
 Ints
 IntsAreSorted
 IsSorted
 Reverse
 SearchFloat64s
 SearchInts
 SearchStrings
 Sort
 Stable
 StringSlice
 Strings
 StringsAreSorted
 arrayOfFloat64Slice
 arrayOfIntSlice
 arrayOfInterface
 arrayOfStringSlice
 refToFloat64Slice
 refToIntSlice
 refToStringSlice
Legend

Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.
(None.)
Variables

(None.)
Functions, Macros, and Special Forms

Float64s
Function v1.0(Float64s x)
Float64s sorts a slice of float64s in increasing order.
Notanumber (NaN) values are ordered before other values.
Go input arguments: (x []float64)
Joker input arguments: [^arrayOfDouble x] 
Float64sAreSorted
Function v1.0(Float64sAreSorted x)
Float64sAreSorted reports whether the slice x is sorted in increasing order,
with notanumber (NaN) values before any other values.
Go input arguments: (x []float64)
Go returns: bool
Joker input arguments: [^arrayOfDouble x]
Joker returns: ^Boolean 
Ints
Function v1.0(Ints x)
Ints sorts a slice of ints in increasing order.
Go input arguments: (x []int)
Joker input arguments: [^arrayOfInt x] 
IntsAreSorted
Function v1.0(IntsAreSorted x)
IntsAreSorted reports whether the slice x is sorted in increasing order.
Go input arguments: (x []int)
Go returns: bool
Joker input arguments: [^arrayOfInt x]
Joker returns: ^Boolean 
IsSorted
Function v1.0(IsSorted data)
IsSorted reports whether data is sorted.
Go input arguments: (data Interface)
Go returns: bool
Joker input arguments: [^Interface data]
Joker returns: ^Boolean 
Reverse
Function v1.0(Reverse data)
Reverse returns the reverse order for data.
Go input arguments: (data Interface)
Go returns: Interface
Joker input arguments: [^Interface data]
Joker returns: ^Interface 
SearchFloat64s
Function v1.0(SearchFloat64s a x)
SearchFloat64s searches for x in a sorted slice of float64s and returns the index
as specified by Search. The return value is the index to insert x if x is not
present (it could be len(a)).
The slice must be sorted in ascending order.
Go input arguments: (a []float64, x float64)
Go returns: int
Joker input arguments: [^arrayOfDouble a, ^Double x]
Joker returns: ^Int 
SearchInts
Function v1.0(SearchInts a x)
SearchInts searches for x in a sorted slice of ints and returns the index
as specified by Search. The return value is the index to insert x if x is
not present (it could be len(a)).
The slice must be sorted in ascending order.
Go input arguments: (a []int, x int)
Go returns: int
Joker input arguments: [^arrayOfInt a, ^Int x]
Joker returns: ^Int 
SearchStrings
Function v1.0(SearchStrings a x)
SearchStrings searches for x in a sorted slice of strings and returns the index
as specified by Search. The return value is the index to insert x if x is not
present (it could be len(a)).
The slice must be sorted in ascending order.
Go input arguments: (a []string, x string)
Go returns: int
Joker input arguments: [^arrayOfString a, ^String x]
Joker returns: ^Int 
Sort
Function v1.0(Sort data)
Sort sorts data.
It makes one call to data.Len to determine n and O(n*log(n)) calls to
data.Less and data.Swap. The sort is not guaranteed to be stable.
Go input arguments: (data Interface)
Joker input arguments: [^Interface data] 
Stable
Function v1.0(Stable data)
Stable sorts data while keeping the original order of equal elements.
It makes one call to data.Len to determine n, O(n*log(n)) calls to
data.Less and O(n*log(n)*log(n)) calls to data.Swap.
Go input arguments: (data Interface)
Joker input arguments: [^Interface data] 
Strings
Function v1.0(Strings x)
Strings sorts a slice of strings in increasing order.
Go input arguments: (x []string)
Joker input arguments: [^arrayOfString x] 
StringsAreSorted
Function v1.0(StringsAreSorted x)
StringsAreSorted reports whether the slice x is sorted in increasing order.
Go input arguments: (x []string)
Go returns: bool
Joker input arguments: [^arrayOfString x]
Joker returns: ^Boolean
Types

Float64Slice
Concrete Type v1.0Float64Slice implements Interface for a []float64, sorting in increasing order,
with notanumber (NaN) values ordered before other values.

Len
Receiver for Float64Slice v1.0([])

Less
Receiver for Float64Slice v1.0([i j])
Less reports whether x[i] should be ordered before x[j], as required by the sort Interface.
Note that floatingpoint comparison by itself is not a transitive relation: it does not
report a consistent ordering for notanumber (NaN) values.
This implementation of Less places NaN values before any others, by using:
x[i] < x[j]  (math.IsNaN(x[i]) && !math.IsNaN(x[j]))

Search
Receiver for Float64Slice v1.0([x])
Search returns the result of applying SearchFloat64s to the receiver and x.

Sort
Receiver for Float64Slice v1.0([])
Sort is a convenience method: x.Sort() calls Sort(x).

Swap
Receiver for Float64Slice v1.0([i j])

IntSlice
Concrete Type v1.0IntSlice attaches the methods of Interface to []int, sorting in increasing order.

Len
Receiver for IntSlice v1.0([])

Less
Receiver for IntSlice v1.0([i j])

Search
Receiver for IntSlice v1.0([x])
Search returns the result of applying SearchInts to the receiver and x.

Sort
Receiver for IntSlice v1.0([])
Sort is a convenience method: x.Sort() calls Sort(x).

Swap
Receiver for IntSlice v1.0([i j])

Interface
Abstract Type v1.0An implementation of Interface can be sorted by the routines in this package.
The methods refer to elements of the underlying collection by integer index.

Len
Method for Interface v1.0([])
Len is the number of elements in the collection.

Less
Method for Interface v1.0([i j])
Less reports whether the element with index i
must sort before the element with index j.
If both Less(i, j) and Less(j, i) are false,
then the elements at index i and j are considered equal.
Sort may place equal elements in any order in the final result,
while Stable preserves the original input order of equal elements.
Less must describe a transitive ordering:
 if both Less(i, j) and Less(j, k) are true, then Less(i, k) must be true as well.
 if both Less(i, j) and Less(j, k) are false, then Less(i, k) must be false as well.
Note that floatingpoint comparison (the < operator on float32 or float64 values)
is not a transitive ordering when notanumber (NaN) values are involved.
See Float64Slice.Less for a correct implementation for floatingpoint values.

Swap
Method for Interface v1.0([i j])
Swap swaps the elements with indexes i and j.

StringSlice
Concrete Type v1.0StringSlice attaches the methods of Interface to []string, sorting in increasing order.

Len
Receiver for StringSlice v1.0([])

Less
Receiver for StringSlice v1.0([i j])

Search
Receiver for StringSlice v1.0([x])
Search returns the result of applying SearchStrings to the receiver and x.

Sort
Receiver for StringSlice v1.0([])
Sort is a convenience method: x.Sort() calls Sort(x).

Swap
Receiver for StringSlice v1.0([i j])

arrayOfFloat64Slice
Concrete Type v1.0Float64Slice implements Interface for a []float64, sorting in increasing order,
with notanumber (NaN) values ordered before other values.

arrayOfIntSlice
Concrete Type v1.0IntSlice attaches the methods of Interface to []int, sorting in increasing order.

arrayOfInterface
Concrete Type v1.0An implementation of Interface can be sorted by the routines in this package.
The methods refer to elements of the underlying collection by integer index.

arrayOfStringSlice
Concrete Type v1.0StringSlice attaches the methods of Interface to []string, sorting in increasing order.

refToFloat64Slice
Concrete Type v1.0Float64Slice implements Interface for a []float64, sorting in increasing order,
with notanumber (NaN) values ordered before other values.

refToIntSlice
Concrete Type v1.0IntSlice attaches the methods of Interface to []int, sorting in increasing order.

refToStringSlice
Concrete Type v1.0StringSlice attaches the methods of Interface to []string, sorting in increasing order.