[Top][All Lists]

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

Re: Elisp string function question

From: Emanuel Berg
Subject: Re: Elisp string function question
Date: Sun, 20 Jun 2021 03:26:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> What I want is
> (defun string-data-p (str)
>   (and (stringp str)
>        (not (string= str "")) ))
> Is it a string?
> Does it have data?

(string-data-p nil)                 ; nil
(string-data-p "")                  ; nil
(string-data-p "ready for takeoff") ; t

But that is actually much better! It is much clearer to ask if
something is ready than to ask if something isn't empty!

Now I can use `when' instead of `unless', or have it as the
first branch of `if's without an`not'!

Much better!

underground experts united

reply via email to

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