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 20:34:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

"Pascal J. Bourguignon" <address@hidden>
writes:

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

Indeed! You have to read what I think, not what
I write...

OK, let's try again: I want a *unary* function because
this involves a *single* argument (sounds logical,
right?) - the function's value only depends on
a property of this single argument.

In math notation:


            /  true       x = ""
    f(x) = 
            \  false        else


The implementation one the other hand may contain
everything else that is needed, including the "" for
comparison (in this case and in that implementation).

While the *implementation* can be optimized for speed,
the *function* and its interface should be formulated
for clarity and "building blockness" as to facilitate
ease of combination with other functions...

This is the building block, toolchain, bottom-up
approach which is the opposite of the fancy game of
"programming" by drawing super-ambitious UML and class
diagrams - "if you don't do it, it won't work
ultimately", which is wrong - that approach very often
fails, and when it does, instead of simply replacing
the failing link, the whole thing must be done again,
maybe with some slightly modified approach, "new
ideas", etc.

> and when this unary operator returns a boolean, you
> call it a predicate
>
>     (emptyp s)

Cool. "Predicate" is a word from the grammars of human
languages, but I don't know its exact meaning, neither
there or in programming languages (until now as for
programming).

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


reply via email to

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