|
|
|
|
|
by Cthulhu_
999 days ago
|
|
One caveat; if `fn` is declared inline when calling that function, it's not very pretty because Go doesn't have a function shorthand (yet?): x.transform(func(value int) string { return fmt.Sprintf("%b", value) })
This quickly becomes more difficult to read, especially if you want to chain some operations this way.But this applies to other languages as well, in JS (which has a function shorthand) I prefer to extract the predicates and give them a meaningful name. |
|