all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: no empty (zero) string predicate in Elisp
Date: Sun, 26 Apr 2015 17:03:01 +0200	[thread overview]
Message-ID: <87oambhqze.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: 87wq0zkqxa.fsf@debian.uxu

Emanuel Berg <embe8573@student.uu.se> writes:

>> not higher-level either
>
> I don't know the scientific definition of "high-level"
> - or how it applies to these three Elisp functions.
>
> The reason I want a binary operator is that it is more
> intuitive: it refects my way of thinking - "is the
> string empty?" vs. "is the string equal to another
> string that is empty?" - also, because a binary
> operator reduces the number of data items in the code
> (with one, the empty string).

The only problem with that, is that a binary operator has 2 arguments:
    
    (binop a b)

therefore if you want a binary operator, you want:

    (string= s "")

On the other hand, if you want only one argument, then you want a unary
operator:

    (unary a)

and when this unary operator returns a boolean, you call it a predicate:

    (emptyp s)


> In general, I don't want the same function to be
> spelled out over and over to do the same thing -
> instead, I want it factored out, named, and invoked
> with a "minimal", that is, sufficient, interface.

Definitely.


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


  reply	other threads:[~2015-04-26 15:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-25  3:44 no empty (zero) string predicate in Elisp Emanuel Berg
2015-04-25  9:26 ` Nicolas Petton
2015-05-16  9:23   ` Nicolas Petton
2015-05-16 13:22     ` Bozhidar Batsov
2015-05-16 13:28       ` Bozhidar Batsov
2015-05-16 13:36         ` Bozhidar Batsov
2015-05-16 13:46           ` Eli Zaretskii
2015-05-16 16:17             ` Bozhidar Batsov
2015-05-16 13:43     ` Stefan Monnier
2015-05-16 15:27     ` Drew Adams
     [not found] ` <mailman.1583.1429954907.904.help-gnu-emacs@gnu.org>
2015-04-25 11:22   ` Emanuel Berg
2015-04-25 13:30 ` Stefan Monnier
     [not found] ` <mailman.1591.1429968677.904.help-gnu-emacs@gnu.org>
2015-04-25 14:48   ` Pascal J. Bourguignon
2015-04-26  2:52     ` Stefan Monnier
2015-04-27 10:28       ` zerop: compiler macro vs defsubst (was: no empty (zero) string predicate in Elisp) Nicolas Richard
2015-04-27 12:19         ` zerop: compiler macro vs defsubst Stefan Monnier
     [not found]     ` <mailman.1626.1430016741.904.help-gnu-emacs@gnu.org>
2015-04-26  4:06       ` no empty (zero) string predicate in Elisp Pascal J. Bourguignon
2015-04-26 21:25         ` Stefan Monnier
2015-04-26  4:26       ` Rusi
2015-04-26 12:36   ` Emanuel Berg
2015-04-26 15:03     ` Pascal J. Bourguignon [this message]
2015-04-26 18:34       ` Emanuel Berg
2015-04-26 18:59         ` Marcin Borkowski
     [not found]         ` <mailman.1658.1430074770.904.help-gnu-emacs@gnu.org>
2015-04-26 19:06           ` Emanuel Berg
2015-04-26 20:11             ` Marcin Borkowski
     [not found]             ` <mailman.1662.1430079142.904.help-gnu-emacs@gnu.org>
2015-04-27  1:00               ` Emanuel Berg
2015-04-26 17:28     ` Rusi
2015-04-26 18:39       ` Emanuel Berg

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=87oambhqze.fsf@kuiper.lan.informatimago.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.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.