Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
mseepgood
· 4mo ago · 0 comments
It's not good Go code anyway. In Go you would use a for loop. Just because Go has generics nowadays doesn't mean you should abandon good taste and write ML/Haskell/Rust/C# in it.
Comments
[–]
_6bln
4mo ago
Sure it's a bad example. But you can't simplify something like this without losing type safety:
SortBy[T, K comparable](slice: []T, key: func (T) K)