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

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

Re: Adding String to Beginning of Lines


From: Jean Louis
Subject: Re: Adding String to Beginning of Lines
Date: Wed, 11 Nov 2020 00:22:24 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Michael Heerdegen <michael_heerdegen@web.de> [2020-11-10 22:42]:
> If you look at the definition:
> 
> (defsubst string-empty-p (string)
>   "Check whether STRING is empty."
>   (string= string ""))

I looked as my thing collided and I did not know what is happening
that suddenly everything is breaks. I cannot even see how that helps,
it just gives better meaning maybe:

(string-empty-p string)
(string= st "") -- shorter and does same

> and check the doc of `string=' you'll see that for symbols (like `nil')
> their name is used as string.  This is surely not useful for
> `string-empty-p', but thus a symbol which has the empty string as name
> (the interned one has a reader syntax "##") fulfills the predicate:
> 
> (string-empty-p '##) ==> t
> 
> No, that's not useful, just a side effect of the implementation.
> 
> | (defun rcd-string-empty-p (s)
> |   "Returns T if string is empty or NIL"
> |   (let ((s (if (null s) "" s)))
> |     (if (stringp s)
> |     (if (zerop (length s)) t nil))))
> 
> That's more or less the same as
> 
> (defun rcd-string-empty-p (s)
>   (or (null s) (and (stringp s) (zerop (length s)))))

Alright.

> But why handling an empty list specially, and not other empty sequences,
> like the empty vector?  That's what `seq-empty-p' in seq.el does,
> btw.

If I understand well I can simply remove my function and instead use
seq-empty-p? It looks that it does what we discussed here.





reply via email to

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