Stupid little iota of an idea

bearophile bearophileHUGS at lycos.com
Sat Feb 12 14:15:25 PST 2011


Andrej Mitrovic:

> I'd maybe vote for the syntax change.
> 
> But maybe we could extend the array slice syntax to construct ranges:
> 
> filter!`a % 2 == 0`([1..5])
> auto r = [0 .. 5];
> 
> So if the slice sits on its own it becomes a range. Or is this too
> scary/ambiguous?

In Python there are list comp. and iterators, so for me a syntax like [1..5] means something like array(iota(1,5)) while 1..5 means something like iota(1,5). 

Bye,
bearophile


More information about the Digitalmars-d mailing list