[erlang-questions] Getting rid of some repetition.
Ulf Wiger (TN/EAB)
ulf.wiger@REDACTED
Tue Mar 18 17:13:08 CET 2008
Christian S skrev:
> On Tue, Mar 18, 2008 at 2:55 PM, Kenneth Lundin
> <kenneth.lundin@REDACTED> wrote:
>> loop(A0, B0, C0)->
>> {A,B,C} =
>> receive
>> {msg1, A1}-> {A1,B0,C0};
>> {msg2, B1}-> {A0,B1,C0};
>> {msg3, C1}-> {A0,B0,C1};
>> {msg4, A1, C1}-> {A1,B0,C1};
>> end,
>> loop(A1, B1, C1).
>
> I spot a little bug and a syntax error! But I leave it as an exercise
> to the reader to find what they are.
FWIW, the compiler would spot it too.
BR,
Ulf W
More information about the erlang-questions
mailing list