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: Pascal J. Bourguignon
Subject: Re: no empty (zero) string predicate in Elisp
Date: Sun, 26 Apr 2015 17:03:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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 via email to

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