help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: no empty (zero) string predicate in Elisp


From: Emanuel Berg
Subject: Re: no empty (zero) string predicate in Elisp
Date: Sun, 26 Apr 2015 14:36:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I do wonder, why you'd rather write (empty-string-p
> foo) instead of (equal "" foo) or (string= "" foo)
> ... It's longer

I don't mind typing. It is one of my favorite
activities (in very stiff competition), especially
when it only involves common words with chars that are
close and super-fast to type: 'empty-string-p' is
definitely more pleasant to type (and read) than
'string= ""' whereas 'equal ""' should be about
"equally" pleasant to type, but still less so to read.

> slower

If that is true, which I suppose it is because it
requires an extra function call, the difference should
be close to infinitely small. I don't consider such
quantities. Actually, I don't consider speed at all
when I write Elisp. (But I never did any one big
project that could gain from optimization, either.
Still, I don't think I write slow code, in general.)

When I told the other guy the other day that
(make-string 10 ? ) is better than `dotimes' and
(insert " ") 10 times, there I focus on the code
rather than the speed - but those two (?) ways of
thinking should work to each other's advantage
most often.

> 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).

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.

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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