On Nov 22, 09 04:32, retard wrote:
Sat, 21 Nov 2009 21:49:21 +0200, Max Samukha wrote:

On Sat, 21 Nov 2009 18:51:40 +0000 (UTC), dsimcha<dsim...@yahoo.com>
wrote:

== Quote from Max Samukha (spam...@d-coding.com)'s article
On Fri, 20 Nov 2009 15:30:48 -0800, Walter Bright
<newshou...@digitalmars.com>  wrote:
Yigal Chripun wrote:
what about foreach_reverse ?

No love for foreach_reverse?<tear>
And no mercy for opApply

opApply **must** be kept!!!!  It's how my parallel foreach loop works.
This would be **impossible** to implement with ranges.  If opApply is
removed now, I will fork the language over it.

I guess it is possible:

uint[] numbers = new uint[1_000];

pool.parallel_each!((size_t i){
         numbers[i] = i;
     })(iota(0, numbers.length));

Though I agree it's not as cute but it is faster since the delegate is
called directly. Or did I miss something?

Sorry for asking this stupid question but why was 'iota' chosen for that
purpose? I was kind of expecting that D2 would have these extension
methods which would allow writing '0.to(numbers.length)' by defining
'auto to(int begin, int end) { ... }'. I looked at wikipedia (http://
en.wikipedia.org/wiki/Iota) and they seem to give credit for the Go
programming language which seems rather weird since they probably existed
in D long before Go was released. I've never heard of this APL being used
anywhere.

Because C++ used iota. Although "range" is easier to understand, and I would say an C++ programmer has higher chance to know what is range(1,10) than iota(1,10).

Also, "to" has been used in conversion (e.g. to!(string)(345))

Reply via email to