Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set? sorter? #1

Closed
anlhord opened this issue Mar 8, 2015 · 3 comments
Closed

set? sorter? #1

anlhord opened this issue Mar 8, 2015 · 3 comments

Comments

@anlhord
Copy link

anlhord commented Mar 8, 2015

No description provided.

@anlhord
Copy link
Author

anlhord commented Mar 8, 2015

About sorting:
I want to know what's the advantage to using the your sorter compared to:

  1. standard library implementing the sort interface (non performance critical)
  2. using https://github.com/gomacro/sort to sort a slice (performance critical code)

@reusee
Copy link
Owner

reusee commented Mar 8, 2015

The sorter is an implementation of standard sort.Interface. The BytesSorter from example can be use as following

 slices := [][]byte{                                                                                                                                                       
  []byte("foo"),                                                                                                                                                           
  []byte("bar"),                                                                                                                                                           
  []byte("baz"),                                                                                                                                                           
 }                                                                                                                                                                         
 sort.Sort(BytesSorter{slices, func(a, b []byte) bool {                                                                                                                    
  return bytes.Compare(a, b) == -1                                                                                                                                         
 }})                                                      

Set and sorter are just demonstrations of template.

@reusee reusee closed this as completed Mar 8, 2015
@anlhord
Copy link
Author

anlhord commented Mar 8, 2015

thanks for the info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants