Skip to content

Instantly share code, notes, and snippets.

@cchandler
Created July 25, 2009 23:26
Show Gist options
  • Save cchandler/155217 to your computer and use it in GitHub Desktop.
Save cchandler/155217 to your computer and use it in GitHub Desktop.
Basic Erlang clustering example
lists:foldl(fun(Elem,Acc) -> % Anonymous function taking two params
Pid = spawn(Elem, fun() -> io:format("Hello",[]) end ), % Spawn a process to run the fun
Acc ++ [Pid] % Add the Pid of the new remote process into our accumulator so we can get it again later
end, [], nodes()) % The [] is our empty accumulator and nodes() will be every node we're connected to
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment