That's a hack. Complaining that they don't exist might eventually result in a better language.
There is a substantial set of changes happening out on this branch: https://github.com/clipperhouse/gen/tree/projection.
… for this reason: https://github.com/clipperhouse/gen/issues/8
- No min/max for integers (and Go doesn't have the ternary operator)
- No IsMember for checking if an object is in a collection
- Directly from the Gen page: Go’s sort package requires the fulfillment of three interface members, two of which are usually boilerplate. If you want to sort by different criteria, you need to implement multiple ‘alias’ types.
Also, unrelated to generics, but no multidimensional arrays.
That's not true, e.g. [4][4]byte is a multi-dimensional array. It's a contiguous block of 16 bytes of memory.
Edit: found it: https://github.com/droundy/gotgo
Fwiw, slices are inexpensive by design. The elements themselves are not copied. Allocating a new slice is really a small ‘struct’ which serves as a pointer to the underlying array: http://blog.golang.org/go-slices-usage-and-internals
(Gen’ing pointers is supported, which mitigates the potential for allocation.)
It is true that chained operations will be multiple iterations. Whether it will net out to more iterations than otherwise depends on the use.
I’d be interested to see if someone can come up with a pattern where the operations themselves are composed, with a ’.Results()’ method that can intelligently (lazily?) minimize iterations. That’d be impressive.
That being said, a systems programming language may not be the right place for FP concepts.
Uhm, what? No it's not.
Haskell has stream fusion, thereby generating assembler that looks a lot like the optimal imperative version.
If you're not using a language with Clojure's nifty datastructures, "effortlessly" probably isn't much better than OpenMP.
It's good enough for Rust.