Map Function in Erlang with PBC

Kresten Krab Thorup krab at trifork.com
Wed Feb 9 09:42:25 EST 2011


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