Phobos2: zip, integral ranges, map, Any, All, Map

bearophile bearophileHUGS at lycos.com
Tue Apr 28 07:19:57 PDT 2009


dsimcha:

>Whether they should be, I don't know.<

In my D1 dlibs most things digest static arrays too (but they don't let you iterate on them or return them, that's a limit of the language). I don't know D2 enough yet to give you a better answer, but I think it's better to remove similar limits from the language. zip-ing two static arrays has to be a legit operation.


>I think you're looking for std.range.iota,<

Yes, sorry, I have found it few seconds after sending the post. I am dumb.


>although it doesn't work so well right now because of bug 2871.<

And I have found the bug, of course... :-)
I can also see Denis Koroskin has suggested a small fix:
http://d.puremagic.com/issues/show_bug.cgi?id=2871


Regarding iota: it's better for the third argument of iota to defult to 1, becasuse most of the times you want a step = 1.
In Python range() goes one step further: if you give just one argument it's meant to be the second one and the first defaults to zero. In practice this causes no problems because in Python you use range()/xrange() all the time. In D I may accept iota to have 2-3 arguments because it will probably used much less often.

Bye and thank you,
bearophile



More information about the Digitalmars-d mailing list