Hi all,

I am planning to use CouchDB now, and coming into some thoughts today,
which may be silly.

1. One map, multiple reduces.

There are possibilities that multiple views share the same map
function. Then, I think these views could be combined, sharing the
same map function. The outcome is obvious: duplicated operations on
the same doc are eliminated.

2. Why "reduce", let's "fold"

The reduce function is a little ugly due to the existance of parameter
"rereduce".

The reduce process is much like the "fold" function in functional
programming languages, except that the function to be reduced is
required to be assocative and commutative (then, the reduce process
could be solved/implemented in map/reduce manner, in parallel, and
incrementally).

It's better to introduce an "Acc" parameter and remove the "rereduce"
flag (like fold), then the reduce function would be simpler:

fun (keys, values, Acc) -> updated Acc.

We just need to attach an "Acc" field for reduce in view doc.

-- 
Li Zhengji

Reply via email to