all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Thien-Thi Nguyen <ttn@gnuvola.org>
Cc: emacs-devel@gnu.org
Subject: Re: emacs lisp syntax rfc: (cond (EXPR => (lambda (X) ...)))
Date: Wed, 05 Jan 2011 16:29:30 -0500	[thread overview]
Message-ID: <jwv7hejm4g8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87tyhoa67u.fsf@ambire.localdomain> (Thien-Thi Nguyen's message of "Tue, 04 Jan 2011 19:12:21 +0100")

> - Functional style is not unlispy.  It's true that a

Agreed, and as a functional programmer (and implementer of functional
programming languages) the fact that the proposed cond => thingy is
naturally pure is an important aspect.  Richard's proposal fails pretty
poorly there.  Yet, Richard's proposal solves another problem as well:
often the value is needed not just for the body of a cond branch, but
also for subsequent branches (because the value is used in several of
the conditions, but not all (and more importantly not the first), so you
can't (or don't want to for efficiency reasons) lift it to before the
cond, yet you do want to share it between branches).

An alternative would be to add a way for a cond test to add a variable
so it's available to the cond's body and to subsequent branches, i.e.
a let in the middle of the cond.


  (cond
   (foo bar)
   ((special-let ((var exp1)) exp2) bla... exp1 ...bla)
   (bli... exp1 ...bli) ...)

Such a thing could still be pure, while providing more flexibility than
Richard's (since the var doesn't have to take the value returned as the
condition, but can take the value of any sub-expression needed to
compute that condition).


        Stefan



  parent reply	other threads:[~2011-01-05 21:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-02 21:45 emacs lisp syntax rfc: (cond (EXPR => (lambda (X) ...))) Thien-Thi Nguyen
2011-01-02 21:57 ` Fren Zeee
2011-01-02 22:00   ` Fwd: " Fren Zeee
2011-01-02 22:52 ` Harald Hanche-Olsen
2011-01-04 16:41   ` Thien-Thi Nguyen
2011-01-04 17:56     ` Harald Hanche-Olsen
2011-01-04 18:39       ` Thien-Thi Nguyen
2011-01-03  2:19 ` Stefan Monnier
2011-01-04 17:00   ` Thien-Thi Nguyen
2011-01-03 16:15 ` Richard Stallman
2011-01-04 18:12   ` Thien-Thi Nguyen
2011-01-05  1:55     ` Stephen J. Turnbull
2011-01-05  3:21       ` Thien-Thi Nguyen
2011-01-05  4:16         ` Stephen J. Turnbull
2011-01-05  5:15           ` Miles Bader
2011-01-05 21:29     ` Stefan Monnier [this message]
2011-01-05 22:40       ` Harald Hanche-Olsen
2011-01-06  0:10         ` Stefan Monnier
2011-01-06  8:24           ` Helmut Eller
2011-01-07  3:49             ` Stefan Monnier
2011-01-06 18:43         ` Richard Stallman
2011-01-05 23:36     ` Richard Stallman
2011-01-11 17:20       ` Andy Wingo
2011-01-05  5:17 ` Miles Bader
  -- strict thread matches above, loose matches on Subject: below --
2011-01-03  5:37 MON KEY
2011-01-04 17:20 ` Thien-Thi Nguyen

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=jwv7hejm4g8.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=ttn@gnuvola.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.