3 ms·
> ...at least make a valid argument about it ;) Like other folks have said, show the equivalent C program and then we can have a discussion about implementatio
by simoncion 1y ago
> ...at least make a valid argument about it ;)
Like other folks have said, show the equivalent C program and then we can have a discussion about implementation complexity and comprehensibility.
Do note that the equivalent C program permits IPC between two instances of the program that could be either running on the same machine or could be running on different machines connected by an IP network.
Edit: For general information, here's an Erlang implementation of increment and swap. Swap is made a bit complicated because Erlang doesn't support multiple returns... returning a tuple or list is the way that's handled, so I had it accept a two-element tuple for consistency with what it returns:
increment(A) -> A + 1.
swap({A, B}) -> {B, A}.