コード風プロンプト例8b Erlangのactor:エージェント定義ありのspawn
Simulates Erlang actor spawning with two workers that output "foo1", "foo2", then "bar" after both complete. Use to test actor patterns and message passing in Erlang-style concurrency.
/plugin marketplace add kokuyouwind/claude-plugins/plugin install code-like-prompt@kokuyouwind-pluginsEmulate the following Erlang-style code internally (without using external tools or interpreter). Output only what io:format() commands would output. Do not show any explanations, code, variables, or other messages.
-module(actor_definition).
-export([main/0, worker/2]).
worker(Id, Parent) ->
io:format("foo~p~n", [Id]),
Parent ! {done, Id}.
main() ->
Self = self(),
spawn(?MODULE, worker, [1, Self]),
spawn(?MODULE, worker, [2, Self]),
receive
{done, 1} -> ok
end,
receive
{done, 2} -> ok
end,
io:format("bar~n").