4 ms·
It's a bit strange to complain about lack of use for "lambda functions" in a language where there's a keyword that generally accepts a function reference, most
by nine_k 14y ago
It's a bit strange to complain about lack of use for "lambda functions" in a language where there's a keyword that generally accepts a function reference, most often a function literal? (This keyword coincidentally is the language name lower-cased.)
WRT generators: have you tried using channels? "The tour of Go" seems to instill you with the idea that you should not iterate over lists and use channels instead.
I also miss list comprehensions and, for that matter, type-parametrized functions.
OTOH, static duck typing is brilliant: best of both worlds.
- swah 14y agoMaybe I used the wrong terms; what I mean't was that I didn't see stuff like "filter(lambda x:x>=50, s)"
- voidlogic 14y agoYou might find this interesting: http://blog.burntsushi.net/type-parametric-functions-golang http://blog.burntsushi.net/type-parametric-functions-golang
- nine_k 14y agoThis is indeed interesting, and this is why I'm missing something like func <A, B> Map(f func(A) B, input []A) []B that would statically check the A and B types at a call site. BTW it looks like less work at compile time than the elaborate run-time solution that you linked to. It probably will not even require generation of specialized versions for primitive types.
- nijk 14y agoIt is called func.