console output out of order and slow
A module appears to run asynchronously
When run in ErlIde console:
sideeffects:print(140)
it sometimes returns numbers out of order like:
2
4
6
8
10
...
138
140
ok
(blab@wiernth-desktop)5> 130
128
126
It also seems to run relatively slowly (in comparison to Erlang shell).
Relevant code:
-module(sideeffects).
-export([print/1]).
case G(N) of
true -> io:format("~p~n",[N]);
false -> ok
end, printf(N+1,E,G);
printf(_,_,_) -> io:format("~n",[]).
iseven(N) -> N rem 2 == 0.
print1(0) -> true;
print1(N) -> print(N-1), io:format("~w~n", [N]).
aleksandra.lipiec@erlang-solutions.com
When run in ErlIde console:
sideeffects:print(140)
it sometimes returns numbers out of order like:
2
4
6
8
10
...
138
140
ok
(blab@wiernth-desktop)5> 130
128
126
It also seems to run relatively slowly (in comparison to Erlang shell).
Relevant code:
-module(sideeffects).
-export([print/1]).
- API Functions
- Local Functions
case G(N) of
true -> io:format("~p~n",[N]);
false -> ok
end, printf(N+1,E,G);
printf(_,_,_) -> io:format("~n",[]).
iseven(N) -> N rem 2 == 0.
print1(0) -> true;
print1(N) -> print(N-1), io:format("~w~n", [N]).
aleksandra.lipiec@erlang-solutions.com
Leave a comment