[Issue 10466] Optional "[]" syntax for std.range.iota too
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 25 15:23:50 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10466
--- Comment #3 from bearophile_hugs at eml.cc 2013-08-25 15:23:48 PDT ---
(In reply to comment #2)
> I like this idea, though there are some corner cases we need to clarify,
> namely, what should iota!"(]"(0.0, 1.0, 0.3) and iota!"()"(0.0, 1.0, 0.3) do?
I don't use iota with floating point arguments, it's too much tricky. I prefer
to write code that doesn't make my head hurt trying to understand its exact
semantics months later.
So my first answer is: disallow FP types for iota(). I know this probably will
not happen, so let's see. This is what the arange() function of the Python good
numpy library gives for those intervals:
>>> from numpy import arange
>>> arange(0.0, 1.0, 0.3)
array([ 0. , 0.3, 0.6, 0.9])
>>> arange(0.0, 1.0, 0.3)
array([ 0. , 0.3, 0.6, 0.9])
So I presume your iotas should give:
iota!"(]"(0.0, 1.0, 0.3)
==>
[0.3; 0.6; 0.9]
iota!"()"(0.0, 1.0, 0.3)
==>
[0.3; 0.6; 0.9]
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list