lua-users home
lua-l archive

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


Roberto Ierusalimschy <roberto@inf.puc-rio.br> writes:
>> Yup ... the bit-shifting functions in Emacs-lisp are of the "only one
>> function with the shift-count sign determining direction" variety, and I
>> have to check the documentation _every_ time I use them, or when I read
>> code using them, to see what the "main" direction is -- even though I've
>> using them (occasionally) for probably decades...
>
> It shifts to the left for positive countings, does it not? It is not
> dificult to figure out, although I have never used Emacs-lisp. If you
> remember that shifting is basically a multiplication by a power of 2,
> it becomes quite intuitive that 1 shifts to the left and -1 shifts to
> the right.

Yeah, it shifts to the left.

Anyway, my point was that this convention, however intuitive/reasonable
it may seem when you explain it (and I agree, it's reasonable enough),
doesn't seem to stick.  If I used the shift function a lot, I'd probably
remember it -- but I don't, I use it "sometimes."

-Miles

-- 
Acquaintance, n. A person whom we know well enough to borrow from, but not
well enough to lend to.