Map Function in Erlang with PBC

Ryan Maclear ryan at lambdasphere.com
Thu Feb 10 02:18:19 EST 2011


After giving this a bit more thought, the "TrapExit" method is not going to work for me. The rpc:multicall() function evaluates the function on all visible nodes. My client app is not on the riak cluster, so cannot access the cluster directly. I will have to follow the method of creating the function in a string.

Cheers,
Ryan

 
On 09 Feb 2011, at 4:42 PM, Kresten Krab Thorup wrote:

> It looks like your problem is that the code is not on the server, so yes, ... I think that your guess is right.  Here's a blg I wrote a while back on this topic
> 
> http://www.javalimit.com/2010/05/passing-funs-to-other-erlang-nodes.html
> 
> ... which also describes why it works for the case where you enter the code in the shell; it creates an interpreted function structure which *is* usable across erlang nodes.
> 
> Kresten
> 
> 
> On Feb 9, 2011, at 9:22 , Ryan Maclear wrote:
> 
> If I copy the function body, line for line into the erlang shell, replacing values as I go along, the code works fine, and I get results back correctly.
> 
> However, If I call the function, in the same shell, I get the following error:
> 
> {error,<<"{error,\n    {error,undef,\n        [{#Fun<mapreduce_play.0.108144614>,\n          [{r_object,<<\"family\">>,<<"...>>}
> 
> This is not what I expected to happen. Has this got something to do with the nature of the anonymous function, one being defined in the shell and the other in a module? I've seen this link:
> 
> 




More information about the riak-users mailing list