Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 88849 invoked from network); 25 Apr 2009 22:20:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Apr 2009 22:20:32 -0000 Received: (qmail 57785 invoked by uid 500); 25 Apr 2009 22:20:31 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 57701 invoked by uid 500); 25 Apr 2009 22:20:30 -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 57691 invoked by uid 99); 25 Apr 2009 22:20:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 25 Apr 2009 22:20:30 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of b.candler@pobox.com designates 207.106.133.19 as permitted sender) Received: from [207.106.133.19] (HELO sasl.smtp.pobox.com) (207.106.133.19) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 25 Apr 2009 22:20:22 +0000 Received: from localhost.localdomain (unknown [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id C1490ADE4E for ; Sat, 25 Apr 2009 18:19:50 -0400 (EDT) Received: from mappit (unknown [80.45.95.114]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTPSA id 75925ADE4D for ; Sat, 25 Apr 2009 18:19:50 -0400 (EDT) Received: from brian by mappit with local (Exim 4.69) (envelope-from ) id 1LxqDs-0002BB-P0 for user@couchdb.apache.org; Sat, 25 Apr 2009 23:19:48 +0100 Date: Sat, 25 Apr 2009 23:19:48 +0100 From: Brian Candler To: user@couchdb.apache.org Subject: Re: Reduce limitations Message-ID: <20090425221948.GA8326@uk.tiscali.com> References: <20090425213912.GA22213@uk.tiscali.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090425213912.GA22213@uk.tiscali.com> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Pobox-Relay-ID: 31A32C42-31E7-11DE-86D2-C121C5FC92D5-28021239!a-sasl-fastnet.pobox.com X-Virus-Checked: Checked by ClamAV on apache.org On Sat, Apr 25, 2009 at 10:39:12PM +0100, Brian Candler wrote: > I am considering using a reduce function for a low-ordinality value Of course I meant low cardinality. FWIW, here's a working implementation: function(ks, vs, co) { if (co) { var result = vs.shift(); for (var i in vs) { for (var j in vs[i]) { result[j] = (result[j] || 0) + vs[i][j]; } } return result; } else { var result = {}; for (var i in ks) { var key = ks[i]; result[key[0]] = (result[key[0]] || 0) + 1; } return result; } } Regards, Brian.