Skip to content

Instantly share code, notes, and snippets.

@leikind
Last active December 22, 2015 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leikind/6389093 to your computer and use it in GitHub Desktop.
Save leikind/6389093 to your computer and use it in GitHub Desktop.
your_map(Function, List) ->
ParentProcessPid = self(),
Pids = lists:map(
fun(Element) ->
spawn(
fun()->
ParentProcessPid ! {self(), Function(Element) }
end
)
end,
List
),
lists:map(
fun(Pid) ->
receive
{Pid, Result} -> Result
end
end,
Pids
).
@Bertg
Copy link

Bertg commented Nov 6, 2013

Ok,ok. This is my "pun" for the day.
If ruby has the "happy" gene, erlang must have the fun gene!

Get it? The anonymous functions are fun! :nudge:

Ok, I'll get back to work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment