zsh-users
 help / color / mirror / code / Atom feed
From: Christopher Browne <cbbrowne@gmail.com>
To: rahul <rahul2012@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Higher order functions in zsh (article link)
Date: Thu, 7 Mar 2013 11:59:50 -0500	[thread overview]
Message-ID: <CAFNqd5WwOHg3aed8OrbFdwfJ5cxemu6DzBOS5uxuDgGWH41HgQ@mail.gmail.com> (raw)
In-Reply-To: <CACQNQ9NWxOUsF_iZ++ygUVmDpdRgnrezyDJpPg4cfJ4tiqDu1g@mail.gmail.com>

On Thu, Mar 7, 2013 at 12:25 AM, rahul <rahul2012@gmail.com> 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?"


  reply	other threads:[~2013-03-07 17:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07  5:25 rahul
2013-03-07 16:59 ` Christopher Browne [this message]
2013-03-07 19:08   ` Phil Pennock
2013-03-07 21:12     ` Oliver Kiddle
2013-03-08  8:40 ` Stephen Blott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFNqd5WwOHg3aed8OrbFdwfJ5cxemu6DzBOS5uxuDgGWH41HgQ@mail.gmail.com \
    --to=cbbrowne@gmail.com \
    --cc=rahul2012@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).