Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: db module
- X-seq: zsh-workers 17777
- From: Hans Dieter Pearcey <hdp@xxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxx>
- Subject: Re: db module
- Date: Sun, 6 Oct 2002 08:24:51 -0400
- In-reply-to: <20021006053229.GA14350@xxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <E17w1iC-00012d-00@xxxxxxxxxxxxxxxxxx> <20021006053229.GA14350@xxxxxxxx>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author