Too complicated code for generating a random string?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Feb 23 08:29:48 PST 2013


On 2/23/13 5:56 PM, monarch_dodra wrote:
> On Saturday, 23 February 2013 at 14:28:28 UTC, Jens Mueller wrote:
>> Can we have a generic function/code that is as efficient as yours?
>
> Well, for now, we have "map" (and "iota"). This usually covers enough
> ground, but there remains cases where it is sub-optimal.
>
> What we would need is a "generate". Basically, a range that calls a
> function to generate the value of front on the fly. I've seen enough
> threads like this one that "abuse" iota/repeat/take/map (or sequence and
> recurrence for that matter), just to obtain a generic generator.
>
> Let's just write Generator/generator.

Make sure you copy Sequence/sequence :o).

Andrei


More information about the Digitalmars-d mailing list