[Swift-devel] Call function.

Mihael Hategan hategan at mcs.anl.gov
Sun Aug 14 15:03:41 CDT 2011


On Sun, 2011-08-14 at 23:24 +0530, Yadu Nand wrote:

> int results[int];
> foreach v,i in [1,2,3,4,5] {
>       results [i] = square (v) ;
> }
> 
> What I'm hoping to achieve is to make this simpler like :
> int results[int] = map ( square , [1,2,3,4,5] );
> 
> How does this look ? Will this be useful ?
> 

I'm not sure I would say useful as much as convenient. But it goes back
to an issue mentioned earlier: what is the type signature of "map"?




More information about the Swift-devel mailing list