On 7/10/12 12:38 PM, Jacob Carlborg wrote:
Can't "map" and "filter" return a random-access range if that's what
they receive?
(replied to by others)
Now I understand if you come from a place where there's no concern over
hidden allocations and extra work for the benefit of convenience, you
may find std.algorithm less easy to work with. But drawing the
conclusion that std.algorithm is badly designed or gratuitously
difficult to use would be a mistake. I opine I can recognize a good vs.
bad design even when it's mine, and in my opinion std.algorithm is a
good design and that most of your opposing impressions derive from a
misunderstanding of its charter.
I don't think I've struggled as much with any other API I've used. In
many cases I had to resort to foreach-loops because that was more
convenient than using std.algorithm.
That's fine. I don't see std.algorithm as a competitor against simple
loops, but instead of work that would be very verbose and difficult to
do with loops. I mean I clearly recall at a point I wanted to define a
forAll algorithm, but then I was like, "people can use foreach for that".
Andrei