blob: 19daa8e7c0fa0a2dbeb88256a4dcc5d01e913281 [file] [log] [blame]
// +build ignore,OMIT
package main
import (
"fmt"
"sort"
)
type Weekday int
const (
Mon Weekday = iota
Tue
Wed
Thu
Fri
Sat
Sun
)
var names = [...]string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}
func (d Weekday) String() string { // ...
return names[d]
}
// lexical START OMIT
type lexical []string
func (a lexical) Len() int { return len(a) }
func (a lexical) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a lexical) Less(i, j int) bool { return a[i] < a[j] }
// lexical END OMIT
func main() {
var list []string
for d := Mon; d <= Sun; d++ {
list = append(list, d.String())
}
sort.Sort(lexical(list))
for i, x := range list {
fmt.Println(i, x)
}
}