Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Re: Associative array ordering and selective unset (Re: Example function)
- X-seq: zsh-workers 8257
 
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
 
- To: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>,        zsh-workers@xxxxxxxxxxxxxx
 
- Subject: Re: PATCH: Re: Associative array ordering and selective unset (Re: Example function)
 
- Date: Thu, 14 Oct 1999 15:07:54 +0000
 
- In-reply-to: <199910141425.QAA16346@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
 
- References: <199910141425.QAA16346@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
 
On Oct 14,  4:25pm, Sven Wischnowsky wrote:
} Subject: PATCH: Re: Associative array ordering and selective unset (Re: Ex
}
} Bart Schaefer wrote (in 5156, hah!):
} 
} >         typeset -A map
} >         map=('*.(gz|Z)' zcat
} >              '*.bz2' 'bzip2 -dc'
} >              '*.bz' 'bzip -dc'
} >              '*' '<')
} > 
} > then ${map[(q)$argv[i]]} returns the value for the first subscript match
} > found, and ${map[(Q)$argv[i]]} returns the array of values for every key
} > that matches the subscript.
} 
} This implements that -- but uses the characters `k' and `K' although I 
} don't know if this is better.
I almost implemented this a while ago, but I stopped because of this:
}  scanparamvals(HashNode hn, int flags)
}  {
} +	if (!(prog = patcompile(tmp, 0, NULL)) || !pattry(prog, scanstr))
} +	    return;
It just seemed so unpleasant to recompile the pattern for every key ...
-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author