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

Re: Higher order functions in zsh (article link)



On Thu, Mar 7, 2013 at 12:25 AM, rahul <rahul2012@xxxxxxxxx> wrote:
> THis has been posted on reddit programming, thought I'd share with you.
>
> http://yannesposito.com/Scratch/en/blog/Higher-order-function-in-zsh/index.html

Seems promising.  I added in notes about a case on which it breaks, at this
point.

> touch f1 f2\ with\ space f3\'with\'quotes
> map echo *
f1
f2 with space
f3withquote

The "obvious" change to map is thus:

cbbrowne@cbbrowne /tmp/maptest> function map {
    local func_name=$1
    shift
    for elem in $@; print -- $(eval $func_name "${elem}")
}

But somewhat curiously that doesn't help :-(.
-- 
When confronted by a difficult problem, solve it by reducing it to the
question, "How would the Lone Ranger handle this?"



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