Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 97776 invoked from network); 22 Apr 2009 14:00:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Apr 2009 14:00:34 -0000 Received: (qmail 40726 invoked by uid 500); 22 Apr 2009 14:00:32 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 40632 invoked by uid 500); 22 Apr 2009 14:00:32 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 40622 invoked by uid 99); 22 Apr 2009 14:00:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Apr 2009 14:00:32 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of th.heller@gmail.com designates 209.85.198.228 as permitted sender) Received: from [209.85.198.228] (HELO rv-out-0506.google.com) (209.85.198.228) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Apr 2009 14:00:25 +0000 Received: by rv-out-0506.google.com with SMTP id l9so1582008rvb.3 for ; Wed, 22 Apr 2009 07:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=o/738UviLRFCKiPlLnotIi24sBcot8NmNNloOOWzkNc=; b=o6KS6PLWC+Mj/3lxZ2yPSw9uubhHpI9WBhUt6N9Dw/gSgKpY0ooMl+vYSmJrwhjSsP WuNo26qAvxOXT04LTC7fI2oJlWJ3hQ/5VL1PBLA82pn3xCrg3DBguINjI9lKw2b8x3OG /KuApmSSNDdHB3cWNkW8ONuQgnBgbzz35LyUo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ZZlk0QpbkhHHjreMak/RyEhCjFDBLn/u2nZmIdiPmE0JUbcUVPU5OsHw2658ClP2aq wCYQDHdCOJYdgtNoJ7X+c1H8/Al9k2HiymPIcBKw0mt794iioqTFCG9Q+0m6n09iT9qk k3Ylk7aBrWLDak5aaZngbmjJfCnqnoSOaNmZM= MIME-Version: 1.0 Received: by 10.220.90.83 with SMTP id h19mr11144865vcm.30.1240408804533; Wed, 22 Apr 2009 07:00:04 -0700 (PDT) In-Reply-To: <51fbc8f50904220655r2d05f439n1ac9b71784ef9baf@mail.gmail.com> References: <51fbc8f50904220655r2d05f439n1ac9b71784ef9baf@mail.gmail.com> Date: Wed, 22 Apr 2009 16:00:04 +0200 Message-ID: <9acd6e550904220700m2657cca8sdf51dae370e84d48@mail.gmail.com> Subject: Re: The sum function (used in reduce) From: Thomas Heller To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0016e64611c42bac520468252efa X-Virus-Checked: Checked by ClamAV on apache.org --0016e64611c42bac520468252efa Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 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 > --0016e64611c42bac520468252efa--