generics, quick sorter,

i agree to say its fallacies you can provide one func to quicksort string 
or Vegetables{}.

in my understanding you are doing a quickSorter of Values you can compare.

quicksort([]Valuer)

type Valuer interface {
Value() int
}

So what s a Valuer when you intent to quicksort a []string ? 

well maybe its func(string) int, 
if you were to sort by length, 
len() is almost compatible,
but in current go its not, 
its an additional by-hand boiler plate construct to make it compatible.

further, quicksort([]Valuer)  could also be quicksort(readable func() int) 
[]Valuer,
the difference being that the first version works on existing store,
the second must build its own, as a sort works on data set with limits.

but, i dont feel like i want to write quicksort(<T>)

On Wednesday, May 24, 2017 at 9:52:27 AM UTC+2, mhh...@gmail.com wrote:
>
> see the title, only for what s needed 
> Slice/Splice/Each/Map/First/Last/Reverse/Sort ect ect not len, for reason. 
> so interface system serves the userland by its definition of struct, and 
> the basic slice type provided by the language is fully operational, without 
> breaking, btw. i don t go further in evaluation, i leave that to the 
> reader, just trying to work decently.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to