In the last section, we were all primed to explore spawning processes from the
REPL. Let's put the code from before into a module.
Save the code below to messenger.lfe:
Then start up lfe, compile your new module, and spawn our print function:
Great! It works as expected. Now let's play... by sending it a message from
the REPL:
The only problem with our solution is that it's a one-shot deal; subsequent
sends to the pid won't call our function, since that function is no longer
running. We can change that, though: let's make sure that once it prints the
message, it starts listening again:
Let's take it for a test drive:
Horray! You've just written a simple listener in LFE!