Skip to content

Instantly share code, notes, and snippets.

@x3ro
Created November 4, 2011 13:14
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 x3ro/1339281 to your computer and use it in GitHub Desktop.
Save x3ro/1339281 to your computer and use it in GitHub Desktop.
set_neighbors([VeryFirst | [VerySecond | Tail]]) ->
set_neighbors([VeryFirst | [VerySecond | Tail]], VeryFirst, VerySecond).
set_neighbors([SecondToLast | [Last | []]], VeryFirst, VerySecond) -> % Only two elements left
%.io:format("L: ~p M: ~p R: ~p~n", [SecondToLast, Last, VeryFirst]),
%.io:format("L: ~p M: ~p~n", [Last, VeryFirst]),
log ! { "GGT Prozess (~p) über linken (~p) und rechten (~p) Nachbarn informiert~n", [Last, SecondToLast, VeryFirst] },
log ! { "GGT Prozess (~p) über linken (~p) und rechten (~p) Nachbarn informiert~n", [VeryFirst, Last, VerySecond] },
ok;
set_neighbors([First | [Second | [Third | Tail]]], VeryFirst, VerySecond) ->
%.io:format("L: ~p M: ~p R: ~p~n", [First, Second, Third]),
log ! { "GGT Prozess (~p) über linken (~p) und rechten (~p) Nachbarn informiert~n", [Second, First, Third] },
set_neighbors([Second | [Third | Tail]], VeryFirst, VerySecond).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment