[erlang-questions] code sample request

黃耀賢 (Yau-Hsien Huang) g9414002.pccu.edu.tw@REDACTED
Tue Jan 19 15:11:02 CET 2010


Great work! And, I think that the processes-ring problem can be extended to
several alternatives, including a sequential message ring and an
asynchronous one.


2010/1/19 Mazen Harake <mazen.harake@REDACTED>

Interesting, I did something similar a while back.
>
> Check this out:
> http://www.trapexit.org/index.php?title=Process_Ring_Across_Nodes
>
> /Mazen
>
>
> On 18/01/2010 20:00, 黃耀賢 (Yau-Hsien Huang) wrote:
>
>> And my solution:
>>
>> *** The Code
>>
>> -export([round_nodes/3]).
>>
>> round_nodes(M, N, Msg) ->
>>     Pids = get_nodes(M, [N, Msg]),
>>     [P|Ps] = Pids,
>>     Pids1 = lists:append(Ps, [P]),
>>     Pids2 = lists:zip(Pids, Pids1),
>>     [ S ! T || {S, T}<- Pids2 ].
>>
>>


More information about the erlang-questions mailing list