[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 10 problems with Elisp, part 10
From: |
Emanuel Berg |
Subject: |
Re: 10 problems with Elisp, part 10 |
Date: |
Fri, 09 Aug 2024 10:36:58 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Dr. Arne Babenhauserheide wrote:
>> (unless end
>> (setq end 73))
>> (unless step
>> (setq step (min 10 (max 2 (/ end 10)))))
>> (unless i
>> (setq i 0))
>
> This could already be trimmed a lot:
>
> (setq
> end (or end 37)
> step (or step (min 10 (max 2 (/ end 10))))
> i (or i 0))
>
> → start optimizing where no syntax breakage is needed.
That's the thing, one shouldn't have to optimize anything, and
in particular not such common and everyday things, the language
should optimize that for you.
Besides what you did is almost nothing. For that part, it is
from 108 to 82 chars, a mere 26 chars.
Please write all this in Lisp anywhere near this 88 chars, and
then I'm even generous with the whitespace.
[
end :r 0< :d 73 :pa
step :rc 2-10 :d (/ end 10)
i :r 0<= :d 0
]
:r means signal error if outside of the interval.
:rc means set to min or max if outside of the interval.
Defaults should be the same for interactive and
non-interactive use.
:pa means both M-x, C-u M-x, and C-u x M-x should work.
--
underground experts united
https://dataswamp.org/~incal
- Re: 10 problems with Elisp, part 10, Abraham S.A.H., 2024/08/06
- 10 problems with Elisp, part 10, Abraham S.A.H., 2024/08/07
- Re: 10 problems with Elisp, part 10, Sebastián Monía, 2024/08/08
- Re: 10 problems with Elisp, part 10, Eli Zaretskii, 2024/08/08
- Re: 10 problems with Elisp, part 10, Emanuel Berg, 2024/08/09
- Re: 10 problems with Elisp, part 10, Dr. Arne Babenhauserheide, 2024/08/09
- Re: 10 problems with Elisp, part 10,
Emanuel Berg <=
- Re: 10 problems with Elisp, part 10, Eli Zaretskii, 2024/08/09
- Re: 10 problems with Elisp, part 10, Emanuel Berg, 2024/08/10
- Re: 10 problems with Elisp, part 10, Eduardo Ochs, 2024/08/09
- Re: 10 problems with Elisp, part 10, Emanuel Berg, 2024/08/09
- Re: 10 problems with Elisp, part 10, Bob Rogers, 2024/08/09
- Re: 10 problems with Elisp, part 10, Emanuel Berg, 2024/08/10
- Re: 10 problems with Elisp, part 10, Eli Zaretskii, 2024/08/10
- Re: 10 problems with Elisp, part 10, Richard Stallman, 2024/08/10