[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:39:09 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Rusi <rustompmody@gmail.com> writes:
> Rather befuddled here... Do you want or not want
> empty-string-p??
Of course I want it! That's why I wrote it myself and
then suggested it be included.
> Your first post said you've defined it and you want
> it not in ELPA but emacs. Now you are saying you
> want a binary -- presumably (== "" whatever).
No, I meant *unary* - I just wrote:
"Pascal J. Bourguignon" <pjb@informatimago.com>
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
- Re: no empty (zero) string predicate in Elisp, (continued)
Message not available
- Re: no empty (zero) string predicate in Elisp, Emanuel Berg, 2015/04/26
- Re: no empty (zero) string predicate in Elisp, Pascal J. Bourguignon, 2015/04/26
- Re: no empty (zero) string predicate in Elisp, Emanuel Berg, 2015/04/26
- Re: no empty (zero) string predicate in Elisp, Marcin Borkowski, 2015/04/26
- Message not available
- Re: no empty (zero) string predicate in Elisp, Emanuel Berg, 2015/04/26
- Re: no empty (zero) string predicate in Elisp, Marcin Borkowski, 2015/04/26
- Message not available
- Re: no empty (zero) string predicate in Elisp, Emanuel Berg, 2015/04/26
Re: no empty (zero) string predicate in Elisp, Rusi, 2015/04/26
Re: no empty (zero) string predicate in Elisp,
Emanuel Berg <=