From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29821 invoked from network); 6 Oct 2002 12:25:09 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 6 Oct 2002 12:25:09 -0000 Received: (qmail 23347 invoked by alias); 6 Oct 2002 12:24:57 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17777 Received: (qmail 23335 invoked from network); 6 Oct 2002 12:24:55 -0000 Date: Sun, 6 Oct 2002 08:24:51 -0400 From: Hans Dieter Pearcey To: Zsh workers Subject: Re: db module Message-ID: <20021006122451.GV24160@malachi.theoscape.net> References: <20021006053229.GA14350@dman.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021006053229.GA14350@dman.com> User-Agent: Mutt/1.4i On Sun, Oct 06, 2002 at 01:32:29AM -0400, Clint Adams wrote: > > typeset -A things -S db -f /tmp/newdb > > typeset string -S mapfile -f /tmp/file > > Someone suggested tying assocs to functions, so we could add something > like > > f() { print $(( $1 * 2 )) } > typeset -A twice -S function -f f > print $f[2] > > I'm not sure that there are any useful applications for this though. As demonstrated above, I can't see how it's any better than calling f() directly. However, if the function got an extra argument when an element was assigned to, it could be pretty neat, e.g.: f() { [ "$2" ] && echo $2 > $1; cat $1 } hdp.