incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <...@apache.org>
Subject Re: The sum function (used in reduce)
Date Thu, 23 Apr 2009 15:53:14 GMT

On 22 Apr 2009, at 07:25, Zachary Zolton wrote:

> I've also expressed interest in both:
>
> 1) Adding/devising more helper functions
>
> 2) Upgrading SpiderMonkey to JavaScript version 1.8

We're linking against whatever lib[moz]js can be found in the
library paths. If there are no incompatible API changes,
1.8 should "just work". If there's work required, we can
start putting it in place for the forthcoming stable release
of 1.8.

Cheers
Jan
--


>
> This would add a LOT features useful for succinct JavaScript Map/ 
> reduce code:
>  * More functional methods on Array objects, such as reduce()
>  * Destructuring assignments
>  * Short-cut Lambda notation (ooh la la!)
>
> Of course, SpiderMonkey 1.8 is still in RC1, however anyone who's been
> using Firefox 3 has been exposed to it!
>
> On Wed, Apr 22, 2009 at 9:00 AM, Thomas Heller <th.heller@gmail.com>  
> wrote:
>> Hey,
>>
>> you can find it in COUCH_HOME/share/server/main.js
>>
>> sum = function(values) {
>>  var rv = 0;
>>  for (var i in values) {
>>    rv += values[i];
>>  }
>>  return rv;
>> }
>>
>> And no, its the only "helper" function.
>>
>> Regards,
>> /thomas
>>
>>
>> On Wed, Apr 22, 2009 at 3:55 PM, Rangachari Anand  
>> <rxanand@gmail.com> wrote:
>>
>>> I searched all over the wiki and did not see any description of the
>>> sum function that can be called in the reduce method of
>>> a view. I can guess what it does but a pointer to more
>>> concrete information would be appreciated.
>>>
>>> There is only a passing reference to it in the page
>>> http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views
>>>
>>> Are there any other handy functions that could be called from inside
>>> map or reduce?
>>>
>>> Thanks
>>> Rangachari Anand
>>>
>>
>


Mime
View raw message