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

Re: A way to apply function to each element of an array



On Thu, 29 Aug 2019 at 02:49, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> ...
> assigns to REPLY, assuming that func can take some arguments (i.e. the
> $MATCH in the use case):

This is not needed – the function could use $MATCH directly.

I was assuming that adding such substitution would require parser
alteration, however it doesn't seem to:

% echo ${|foo;}
zsh: bad substitution

So the syntax correctly passes the parser and meets paramsubst() or
stringsubst(). So adding such substitution should be easy – just a
doshfunc(() followed by getstrvalue("REPLY"). If there are any
pitfalls in it then let me know it.

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org



Messages sorted by: Reverse Date, Date, Thread, Author