Dnia 30-08-2010 o 21:16:15 Tomek Sowiński <j...@ask.me> napisał(a):
Dnia 30-08-2010 o 21:10:10 Tomek Sowiński <j...@ask.me> napisał(a):
How about reduce!fun(range)? It's pure/nothrow when fun is
pure/nothrow. Plenty of std.algorithm would benefit.
Eh, nevermind. popFront() must mutate the range so it can't be pure.
Need to get some sleep...
But wait! It can be auto(nothrow). So my sleepy-head argument didn't suck
after all:)
And I do like the auto(qual) syntax.
BTW, isn't it surprising? Think of sum of squares, I mean reduce!"a + b *
b"(range) -- it should be pure, it's natural. Come to think of it, if pure
functions required arguments to be @tail immutable**, not from-head
immutable as it is now, popFront() being also @tail immutable would
advance the range and it would just work... Damn, now I can't sleep.
** @tail immutable doesn't exist in the language. It was proposed in the
great const debate not too long ago.
Tomek