[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [nongnu] elpa/hyperdrive b5294b4354 4/4: Tidy: Use zerop instead of
From: |
Emanuel Berg |
Subject: |
Re: [nongnu] elpa/hyperdrive b5294b4354 4/4: Tidy: Use zerop instead of = 0 |
Date: |
Sat, 14 Oct 2023 23:33:11 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Philip Kaludercic wrote:
> FWIW this doesn't matter that much, you can check the
> disassembly to see what is going on after byte compilation:
>
> (disassemble (byte-compile (lambda (a) (= a 0))))
byte code:
args: (a)
0 varref a
1 constant 0
2 eqlsign
3 return
> (disassemble (byte-compile (lambda (a) (zerop a))))
byte code:
args: (a)
0 varref a
1 constant 0
2 eqlsign
3 return
They are identical, is that what you mean it doesn't matter
that much?
To use `zerop' is maybe more classy - the attitude being to
minimize everything as much as possible - as it is a unary
function (1 argument) while `=', as it is used here, is binary
(2 arguments).
BTW = can be used unary as well, then it always returns t -
even for nil. (= nil) ; t
But why do that? As it is more classy to just use t :)
--
underground experts united
https://dataswamp.org/~incal