Too complicated code for generating a random string?
bearophile
bearophileHUGS at lycos.com
Sat Feb 23 01:44:16 PST 2013
Ary Borenszweig:
>> 10.table!({ return letters.choice; }).writeln;
>
> Couldn't map! be used with a delegate that doesn't receive any
> arguments?
I think map() requires a callable that receives one argument.
table() doesn't need the iota() as map(), it accepts one or more
numerical arguments, so it's able to generate 2D arrays, 3D
arrays, etc.:
table!(() => letters.choice)(3, 4, 5).writeln;
Bye,
bearophile
More information about the Digitalmars-d
mailing list