I am trying to implement the Walk
function from here which is implemented in Go into erlang.
Here is the result:
-module(tree).
-export([walk/1,test/0]).
walk({Left, Value, Right}) ->
spawn(tree,walk,[Left]),
io:format(Value),
spawn(tree,walk,[Right]);
walk({}) -> continue.
test() ->
B = {{}, alina, {}},
D = {{},vlad,{}},
C = {D, tea, {}},
A = {B,maria,C},
walk(A).
I'm not sure if this belongs to the code review section as I'm not sure that what I did is what I wanted. The code works as expected (in the sense that it does walk a tree) however I'm not sure if the design of the function is concurrent.