zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh list <zsh-workers@zsh.org>
Subject: Re: anonymous functions
Date: Fri, 11 Feb 2011 10:17:29 -0800	[thread overview]
Message-ID: <110211101729.ZM525@torch.brasslantern.com> (raw)
In-Reply-To: <m3zkq2bidh.fsf_-_@klanderman.net>

On Feb 11, 12:17pm, Greg Klanderman wrote:
} Subject: anonymous functions
}
} >>>>> On February 11, 2011 Bart Schaefer <schaefer@brasslantern.com> wrote:
} 
} > If your zsh is recent enough to have anonymous functions
} 
} Why are these things called 'anonymous functions'?  That name connotes
} lambda, which would create an unnamed function you could store in a
} variable

Unfortunately it really only means an unnamed function for scoping, so
you can use "local" and "return" to save/restore variables and set the
status.  It does not connote a closure (is not like a lambda expression).

This is partly for simplicity of the implementation, but partly because
the shell language doesn't really provide a syntax for returning values
from functions or commands (except in the limited context of $(( ... ))
math expressions) -- hence all the hacks with $REPLY.

See zsh-users/15575 from last November:
	http://www.zsh.org/mla/users/2010/msg00874.html


  reply	other threads:[~2011-02-11 18:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTikFsJGitoiU49kJphErOsxbCN_BrerNcaHcb2kR@mail.gmail.com>
     [not found] ` <AANLkTinerHxXBs4vc_+UXFMxsrui7EKBNhdH01a0wqn6@mail.gmail.com>
2011-02-11 17:17   ` Greg Klanderman
2011-02-11 18:17     ` Bart Schaefer [this message]
2011-02-11 18:21       ` Bart Schaefer

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=110211101729.ZM525@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@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).