Too complicated code for generating a random string?

Jens Mueller jens.k.mueller at gmx.de
Sat Feb 23 03:57:49 PST 2013


bearophile wrote:
> 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;

This looks almost like a Cartesian product but only specifying the
sizes.
I assume you have an enhancement request? Couldn't find it.

Jens


More information about the Digitalmars-d mailing list