PragDave Fibonacci solution

See this explanation.

Also now I’m curious why they’re not generally useful?

  • They don’t manage their own state - i.e. the state can be corrupted by any one of their “clients”. I typically prefer for a process to be in charge of it’s own state. As such agent just strikes me as a glorified “global state” that anybody can trash. I prefer processes to exercise total autonomy over their own state.

  • I’m not particularly fond of sending functions in messages. Anonymous functions belong to the creating module and the function closure can reference other modules. The message can travel to a process in another node which may not have the requisite module dependencies - and therefore kill any process trying to execute it.

See also:
Looking for clarity around using agent