Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Higher order functions in zsh (article link)
- X-seq: zsh-users 17676
- From: Christopher Browne <cbbrowne@xxxxxxxxx>
- To: rahul <rahul2012@xxxxxxxxx>
- Subject: Re: Higher order functions in zsh (article link)
- Date: Thu, 7 Mar 2013 11:59:50 -0500
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=ENzU1ue3K/wsBvzbfbuiNfCTVwhRlNNCFaZeC4eXMY0=; b=AEhdICKgShuI6+tWmZdpR2VU8jhTA6lYwAzOTozWd7Dfc22YaWpDnywgG61J14QxNP isgNMQKlM/OSnVpLWVLlR9/twu3cMO1xYr+z70x2TwjSZV8WE6b0wFq2a/Kv7W/osEn6 /D5oDZqjbKu2K5zdDgHlVMvuZtNWsiucxasigVBbiQ7X8xfCgQ3GIiFp2WZxHJ9QewAM c/sfgWrJ4M0rHQaaGFTGDLV6Cnq27VTsiaSzPcFiKnAin1P7lkWwYP76ozMAfrxSHgFb RXHwzH5mXVosouerbROHIjl15gxJ9OxD9JfeyEyYatZjXwiyfYzxfhpMmeWdFojbB1ps k8Pw==
- In-reply-to: <CACQNQ9NWxOUsF_iZ++ygUVmDpdRgnrezyDJpPg4cfJ4tiqDu1g@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CACQNQ9NWxOUsF_iZ++ygUVmDpdRgnrezyDJpPg4cfJ4tiqDu1g@mail.gmail.com>
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