Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "sort"
- )
- func tokensByAscending(t []int) func(i, j int) bool {
- return func(i, j int) bool {
- return t[i] < t[j]
- }
- }
- func main() {
- tokens := []int{
- 1,
- 2,
- 44123,
- 8,
- 3,
- 2,
- 99,
- 6,
- }
- sort.Slice(tokens, tokensByAscending(tokens))
- fmt.Println(tokens)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement