iota and BigInt

monarch_dodra monarchdodra at gmail.com
Tue May 28 07:50:00 PDT 2013


On Tuesday, 28 May 2013 at 10:41:46 UTC, Russel Winder wrote:
> Is this a symptom of Phobos being predicated on hardware data 
> types? If
> so there is a mass of applications out there that D cannot 
> handle
> sensible (unlike Python (especially SciPy), Julia, R, Matlab,
> Mathematica, etc.

I think it is a problem is that iota is over parametrize-able.

iota can takes a lower bound (B), and upper bound (E), and a step 
(S), and returns a value (R).

The problem is that none of these parameters actually need to be 
the same. This forces the code to have to mess with things like 
"CommonType", which it really wouldn't have to if the only 
parameter(s) where "Type" and "Step".

The none-step version only requires that Type be incrementable, 
and the Step one needs to support "Type+=Step" (which returns 
type "Type")

Also: iota doesn't work with chars:

iota('k', 't'); //Nope.

Technically, the types don't even need to be "integer-like": as 
long as ++ or += works, it's all good.


More information about the Digitalmars-d mailing list