From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4787 invoked by alias); 7 Mar 2013 17:01:11 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17676 Received: (qmail 293 invoked from network); 7 Mar 2013 17:01:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.128.49 as permitted sender) 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== MIME-Version: 1.0 X-Received: by 10.49.60.136 with SMTP id h8mr43721980qer.31.1362675590958; Thu, 07 Mar 2013 08:59:50 -0800 (PST) In-Reply-To: References: Date: Thu, 7 Mar 2013 11:59:50 -0500 Message-ID: Subject: Re: Higher order functions in zsh (article link) From: Christopher Browne To: rahul Cc: Zsh Users Content-Type: text/plain; charset=ISO-8859-1 On Thu, Mar 7, 2013 at 12:25 AM, rahul 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?"