Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "sort"
  6. )
  7.  
  8. func tokensByAscending(t []int) func(i, j int) bool {
  9. return func(i, j int) bool {
  10. return t[i] < t[j]
  11. }
  12. }
  13.  
  14. func main() {
  15. tokens := []int{
  16. 1,
  17. 2,
  18. 44123,
  19. 8,
  20. 3,
  21. 2,
  22. 99,
  23. 6,
  24. }
  25.  
  26. sort.Slice(tokens, tokensByAscending(tokens))
  27.  
  28. fmt.Println(tokens)
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement