[erlang-questions] closures and list comprehensions
Harold Ship
haroldship@REDACTED
Sun Feb 17 23:05:51 CET 2008
Hello
I'm fairly new to Erlang, and I'm just starting to get the hang of it.
I have a question about using spawn/1, giving it a fun which is a
closure that contains a list comprehension. The example is like this:
my_func([First|Rest]) ->
Me = self(),
spawn(fun() -> Me ! do_something([X || X <- Rest, X < First]) end),
do_something_else(),
receive
Result ->
do_something_with(Result)
end.
My question is, in which process is the list comprehension evaluated?
It seems to me that it should be evaluated in the spawned process but
I can't reason it out.
Thanks in advance,
Harold Ship
More information about the erlang-questions
mailing list