emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is there no `until' in elisp?


From: Stefan Monnier
Subject: Re: Why is there no `until' in elisp?
Date: Tue, 16 Oct 2018 17:28:28 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> [0] such as: (defmacro until (test &rest body) (declare (indent 1))
> `(while (not ,test) ,@body))

I like `until`.  As a matter of fact, I think `until` is more important
than `while` for the following reason: it should not behave like the one
you have above but rather like:

    (defmacro until (test &rest body)
      (let (res)
        (while (not (setq res ,test)) ,@body)
        res))

While `while` doesn't have much else to return than nil, `until` does
have a useful value to return, which is the non-nil value that caused it
to exit.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]