aric
Joined 14 years ago
Karma
418
Submissions
197
Member since
Nov 22
Joined 14 years ago
2. Impure?
3. That's the point. It's to force people to stop using maps as if they're sorted.
4. Why would you want to rely on the arbitrary nature of a hash table for order?
5. That's the best type of boilerplate. It's short. It brings clarity. You might not need custom sort functions. The sort package supports basic types, which you'd use if you're keeping track of an index with []int for instance. https://golang.org/pkg/sort/
func it(n int) []struct{} {
return make([]struct{}, n)
}
// ex. 1:
for range it(10) {
fmt.Println(".")
}
// ex. 2:
for i := range it(10) {
fmt.Println(i)
}Video about it (Nov 2014): "Implementing a bignum calculator" https://www.youtube.com/watch?v=PXoG0WX0r_E
b := &a
fmt.Println((*b)[0])