Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Re: Associative array ordering and selective unset (Re: Example function)



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