Adam D. Ruppe:
I guess if it takes an input range with lengths though it could
just as well do alloc.make(repeat(0).take(45))
This is OK if "make" recognizes the repeat.take type statically
and uses this information to allocate the array efficiently. In
general such pattern recognition tricks should be more present in
Phobos (in Haskell there is even a syntax to add them).
Bye,
bearophile
- API Andrei Alexandrescu via Digitalmars-d
- Re: API Adam D. Ruppe via Digitalmars-d
- Re: API Adam D. Ruppe via Digitalmars-d
- Re: API bearophile via Digitalmars-d
- Re: API Adam D. Ruppe via Digitalmars-d
- Re: API bearophile via Digitalmars-d
- Re: API Adam D. Ruppe via Digitalmars-d
- Re: API Orvid King via Digitalmars-d
- Re: API bearophile via Digitalmars-d
- Re: API H. S. Teoh via Digitalmars-d
- Re: API Brian Schott via Digitalmars-d
- Re: API Walter Bright via Digitalmars-d
- Re: API MattCoder via Digitalmars-d
- Re: API Andrei Alexandrescu via Digitalmars-d