much appreciated
thanks
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
By "using closures", I hope you mean something like this:
Pid = spawn(fun () -> any_function(Any, Number, Of, Arguments) end)
How would that be limiting to your code structure?
/Richard
BoundVar1 = 1,
BoundVar2 = 2,
Fun_toSpawn = fun()->BoundVar1+BoundVar2 end,
...
...
lists:forEach(
fun(X)->
%and this was limiting me since I needed to use X and couldnt
pass it in
%except if I declared the fun itself inside this forEach
callback which is very innefficient
spawn(Fun_toSpawn)
end,List).
it seems a lot can be done by nesting functions inside very simple
fun's and referencing parameters like that
thank you very much
> erlang-questi...@erlang.orghttp://www.erlang.org/mailman/listinfo/erlang-questions
BoundVar1 = 1,
BoundVar2 = 2,
Fun_toSpawn = fun()->BoundVar1+BoundVar2 end,
...
...
lists:forEach(
fun(X)->
%and this was limiting me since I needed to use X and couldnt
pass it in
%except if I declared the fun itself inside this forEach
callback which is very innefficient
spawn(Fun_toSpawn)
end,List).
it seems a lot can be done by nesting functions inside very simple
fun's and referencing parameters like that
thank you very much
On Feb 20, 5:07 pm, Richard Carlsson <richa...@it.uu.se> wrote:
> erlang-questi...@erlang.orghttp://www.erlang.org/mailman/listinfo/erlang-questions