parmap/2

Luke Gorrie <>
Mon Feb 20 14:57:53 CET 2006


Howdy,

I just found this function and thought it was cute enough to share on
a rainy day:

  %% Map function F over list L in parallel.
  parmap(F, L) ->
      Parent = self(),
      [receive {Pid, Result} -> Result end
       || Pid <- [spawn(fun() -> Parent ! {self(), F(X)} end) || X <- L]].





More information about the erlang-questions mailing list