Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 62421 invoked from network); 11 Mar 2009 17:05:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Mar 2009 17:05:30 -0000 Received: (qmail 76523 invoked by uid 500); 11 Mar 2009 17:05:30 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 76145 invoked by uid 500); 11 Mar 2009 17:05:29 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 76133 invoked by uid 99); 11 Mar 2009 17:05:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2009 10:05:29 -0700 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 jchris@gmail.com designates 74.125.46.28 as permitted sender) Received: from [74.125.46.28] (HELO yw-out-2324.google.com) (74.125.46.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2009 17:05:20 +0000 Received: by yw-out-2324.google.com with SMTP id 2so345500ywt.5 for ; Wed, 11 Mar 2009 10:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=YlaF7aDp0wKHAIg2VSJpBgWXRT9DFDOrKsSZJIE7pIc=; b=BpbdQHJtjuMOlrPXQ0yHtaQTfB8ZanrwEl3qIdpAAxr6WMIONjM6Jcoi9aHV7WR3A2 rjOCoIXELxkK39jqjgFKcFUSLJnp9c1uYM2I+cdMvqAZNUiglDAl+tLaFPzLJ+Q2/8ye jaqoJsXvqxM4TV+8sjC35vSp9Hj5bh2a9XqDE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=KIQ6aPHGUQ3JX+MF6BotQ2cdG9zM1ovv65rBZfnuofLlMl4vYQVwyqM2GS5GjKa3rs Gn3CmZ4htRCoRVmNEjpx0M1L9qGMjgREqN58lC/AsSTZzuFw+cWWu+bAVO3xSLANKNjH 8myEb3ACLspQbQ7c/w1neINvHNdV7N4Br5mcM= MIME-Version: 1.0 Sender: jchris@gmail.com Received: by 10.142.101.17 with SMTP id y17mr3770207wfb.69.1236791098626; Wed, 11 Mar 2009 10:04:58 -0700 (PDT) In-Reply-To: References: <9D33BADD-D73E-4DE9-8A98-7EF0622A2888@mooseyard.com> <7db9abd30903101818y7101ffaaq38500cccc5ec559f@mail.gmail.com> Date: Wed, 11 Mar 2009 10:04:58 -0700 X-Google-Sender-Auth: 1ea2e46745a296a9 Message-ID: Subject: Re: helper functions in reduce From: Chris Anderson To: dev@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Wed, Mar 11, 2009 at 6:59 AM, Zachary Zolton wrote: > I was a bit mislead by the title; this sounds like caching the > parsed/ready-to-go JavaScript view functions. > > However, I am interested in hearing how we can introduce helper code, > and reusable libraries, into our JavaScript views. > Check out the CouchApp script, which has macros for including helper code automatically in view functions when saving the design documents. This is really the best way to do it, as the functions as stored in the design doc can not depend on definitions elsewhere in the code. If there are a set of helpers you'd like to see as sort of a standard library for MapReduce, they'd make great candidates for inclusion in the CouchApp vendor package. Scan the README for mention of the !code macro: http://github.com/jchris/couchapp/blob/master/README.md -- Chris Anderson http://jchris.mfdz.com