[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lengths and other stuff
From: |
Daniel Brooks |
Subject: |
lengths and other stuff |
Date: |
Sun, 27 Dec 2020 15:05:59 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Tomas Hlavaty <tom@logand.com> writes:
> On Sun 27 Dec 2020 at 17:49, "Alfred M. Szmidt" <ams@gnu.org> wrote:
>> However, if somebody writes such code, it is almost trivial to fix
>> it with search and replace:
>>
>> "(= (length" -> "(length="
>> "(< (length" -> "(length<"
>> "(> (length" -> "(length>"
>> "(/= (length" -> "(length/="
>> "(<= (length" -> "(length<="
>> "(>= (length" -> "(length>="
>>
>> (plus extra closing paren)
>>
>> Users will assume that these length>= hacks will make their code
>> magically better, when they just hide a problematic form -- doing a
>> possibly complicated operation inside a predicate call.
>
> It will make their code better. I do not see any magic there, it is
> pretty simple and logical.
>
> Do you have some other solution on mind?
Some of them can no doubt be replaced by multiple-value-bind and other
such things. This one from ido.el:1518, for example:
(if (and (listp (car l))
(> (length (car l)) 2)
(let ((dir (car (car l)))
(time (car (cdr (car l))))
(files (cdr (cdr (car l)))))
could be (multiple-value-bind (dir time files) (car l) …).
But those kinds of improvements take a lot more thought about each
occurrence.
Incidentally, I find it hard to believe that someone typed all of that
out without at least using cadar and cddar.
db48x
- Re: Internationalize Emacs's messages (swahili), (continued)
- Re: Internationalize Emacs's messages (swahili), Stefan Monnier, 2020/12/26
- Re: Internationalize Emacs's messages (swahili), Lars Ingebrigtsen, 2020/12/26
- Re: Internationalize Emacs's messages (swahili), Lars Ingebrigtsen, 2020/12/26
- Re: Internationalize Emacs's messages (swahili), Lars Ingebrigtsen, 2020/12/26
- Re: Internationalize Emacs's messages (swahili), Lars Ingebrigtsen, 2020/12/27
- Re: Internationalize Emacs's messages (swahili), Eli Zaretskii, 2020/12/27
- Re: Internationalize Emacs's messages (swahili), Lars Ingebrigtsen, 2020/12/27
- Re: Internationalize Emacs's messages (swahili), Tomas Hlavaty, 2020/12/27
- Re: Internationalize Emacs's messages (swahili), Alfred M. Szmidt, 2020/12/27
- Re: Internationalize Emacs's messages (swahili), Tomas Hlavaty, 2020/12/27
- lengths and other stuff,
Daniel Brooks <=
- Re: lengths and other stuff, Lars Ingebrigtsen, 2020/12/27
- Re: lengths and other stuff, Daniel Brooks, 2020/12/27
- Re: lengths and other stuff, Lars Ingebrigtsen, 2020/12/27
- Re: lengths and other stuff, Daniel Brooks, 2020/12/27
- Re: lengths and other stuff, Stefan Monnier, 2020/12/27
- Re: lengths and other stuff, Stefan Monnier, 2020/12/27
- Re: lengths and other stuff, Daniel Brooks, 2020/12/27
- Re: lengths and other stuff, Stefan Monnier, 2020/12/27
- Re: lengths and other stuff, Tomas Hlavaty, 2020/12/27
- Re: lengths and other stuff, Daniel Brooks, 2020/12/27