Heartfelt thanks for the Erlang tips!
This is what makes the Internet such a nice place. I'm working with a new language and environment because in a simple experiment, it showed promise for addressing a real problem at work, something involving concurrency and network connections i.e. the sort of arena Erlang was made to play in. My trouble then is, with no other in-house expertise, I can't get a code review for that which gives any great degree of cross-checking -- and I can't (obviously) put the real code out in the public arena for review.
By putting a separate piece of code -- nothing to do with the real work -- out on this blog, I have at least managed to get something of an arm's length review of style at least.
Having reflected on Vat's comment on the first post, I'm more minded to move the bit masking into the print_swap/2
function, to localise the concern (determining which side of the traverse one is going to) into one single scope, rather than spreading that process around two different functions, even though that loses the option to pattern match on a simple argument:-
The issue of localization-of-concerns wasn't such an issue with the Python version, since that was less aggressively broken into functions.
1 comment :
I would break that further into
print_swap(Swap, To) when To band 1 =:= 0 ->
io:format( " ~s -->~n", [display(Swap)]);
print_swap(Swap, To) when To band 1 =:= 1 ->
io:format( "<-- ~s~n", [display(Swap)]).
Post a Comment