views:

1944

answers:

2

How can I write map-reduce functions in Erlang for CouchDB? I am sure Erlang is faster than JavaScript.

+5  A: 

You can do so using erlview, which is within the top ten hits on Google for "couchdb erlang view" and is listed on the CouchDB wiki page for other-language view servers.

Jim Puls
Snarky Jim is snarky. And correct.
James A. Rosen
With the next release of CouchDB erlang views will be built in. You won't even have to download and setup erlview to make it work.
Jeremy Wall
CouchDB 0.10 (released October 2009) and later support Erlang views natively. A good writeup is at http://blog.echolibre.com/2010/02/couchdb-custom-erlang-map-functions/
jhs
+7  A: 
pmap(F, L) ->
    Parent = self(),
    Pids = [spawn(fun() ->
                     Parent ! {self(), F(X)}
                  end) || X -> L],
    [receive {Pid, Res} -> Res end || Pid < - Pids].

I believe I did, Bob.

Fu
Needs the cartoon pasted in there for added value :D
madlep
Lulz...consider my afternoon laugh provided for.
Joshua Noble