-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuiltin.go
183 lines (157 loc) · 4.83 KB
/
builtin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
package uniq
// Uint8s sorts and deduplicates a slice of uint8 in increasing order.
func Uint8s(s []uint8) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Uint16s sorts and deduplicates a slice of uint16 in increasing order.
func Uint16s(s []uint16) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Uint32s sorts and deduplicates a slice of uint32 in increasing order.
func Uint32s(s []uint32) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Uint64s sorts and deduplicates a slice of uint64 in increasing order.
func Uint64s(s []uint64) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Int8s sorts and deduplicates a slice of int8 in increasing order.
func Int8s(s []int8) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Int16s sorts and deduplicates a slice of int16 in increasing order.
func Int16s(s []int16) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Int32s sorts and deduplicates a slice of int32 in increasing order.
func Int32s(s []int32) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Int64s sorts and deduplicates a slice of int64 in increasing order.
func Int64s(s []int64) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Float32s sorts and deduplicates a slice of float32 in increasing order.
func Float32s(s []float32) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Uints sorts and deduplicates a slice of uint in increasing order.
func Uints(s []uint) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Uintptrs sorts and deduplicates a slice of uintptr in increasing order.
func Uintptrs(s []uintptr) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Bytes sorts and deduplicates a slice of byte in increasing order.
func Bytes(s []byte) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Runes sorts and deduplicates a slice of rune in increasing order.
func Runes(s []rune) int {
return Slice(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Uint8s tests whether a slice of uint8 is sorted and deduplicated in increasing order.
func Uint8sAreSorted(s []uint8) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Uint16s tests whether a slice of uint16 is sorted and deduplicated in increasing order.
func Uint16sAreSorted(s []uint16) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Uint32s tests whether a slice of uint32 is sorted and deduplicated in increasing order.
func Uint32sAreSorted(s []uint32) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Uint64s tests whether a slice of uint64 is sorted and deduplicated in increasing order.
func Uint64sAreSorted(s []uint64) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Int8s tests whether a slice of int8 is sorted and deduplicated in increasing order.
func Int8sAreSorted(s []int8) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Int16s tests whether a slice of int16 is sorted and deduplicated in increasing order.
func Int16sAreSorted(s []int16) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Int32s tests whether a slice of int32 is sorted and deduplicated in increasing order.
func Int32sAreSorted(s []int32) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Int64s tests whether a slice of int64 is sorted and deduplicated in increasing order.
func Int64sAreSorted(s []int64) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Float32s tests whether a slice of float32 is sorted and deduplicated in increasing order.
func Float32sAreSorted(s []float32) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Uints tests whether a slice of uint is sorted and deduplicated in increasing order.
func UintsAreSorted(s []uint) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Uintptrs tests whether a slice of uintptr is sorted and deduplicated in increasing order.
func UintptrsAreSorted(s []uintptr) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Bytes tests whether a slice of byte is sorted and deduplicated in increasing order.
func BytesAreSorted(s []byte) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}
// Runes tests whether a slice of rune is sorted and deduplicated in increasing order.
func RunesAreSorted(s []rune) bool {
return SliceIsSorted(s, func(i int, j int) bool {
return s[i] < s[j]
})
}