コード風プロンプト例8c Erlangのactor:メッセージパッシング(直接記述)
Simulates Erlang message passing by spawning a process that processes "foo" and returns "processed_foo", then prints "bar". Use this to demonstrate actor model patterns in Erlang.
/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(message_passing).
-export([main/0]).
main() ->
Self = self(),
Pid = spawn(fun() ->
receive
{request, From, Data} ->
Result = "processed_" ++ Data,
From ! {response, Result}
end
end),
Pid ! {request, Self, "foo"},
receive
{response, Result} ->
io:format("~s~n", [Result])
end,
io:format("bar~n").