[Swift-devel] Call function.

Mihael Hategan hategan at mcs.anl.gov
Fri Aug 12 11:48:50 CDT 2011


On Fri, 2011-08-12 at 17:55 +0530, Yadu Nand wrote:

> >> I'm inclined to think some function type (rather than strings) does, (but
> >> I'm very into compile time safety so that's unsurprising) but I'm not sure
> >> if its worth the effort for what I think is a fairly restricted use case.
> Well, how else would we do the map - reduce style functionality. Sure, we
> can probably do map by writing a separate procedure for applying a function
> over every item in a list, but I think map is easier (and cooler!)

We have to distinguish between "map" as it appears in standard
functional languages (i.e. map(S -> T, [S]) -> [T]) and "map" as in
Google map/reduce function signature (i.e. map(K1, T1) -> [(K2, T2)]).

The semantics of the functional map can be achieved in swift using
foreach.




More information about the Swift-devel mailing list