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

Param ordering; < and <=

This page is part of the web mail archives of SRFI 32 from before July 7th, 2015. The new archives for SRFI 32 contain all messages, not just those from before July 7th, 2015.

"Operation currying" is a nice turn of phrase.  Chez gets the parameter
order right by taking the opportunity to make its SORT parameter order
agree with Scheme's MAP, FOR-EACH, and APPLY.  Yes, this is incompatible
with Common Lisp, but it means that I-- I mean, a Scheme programmer--
will guess the parameter sequence correctly.

Numerically, op< is less expensive than op<=.  Assuming that a fixnum
(lambda (x y) (< x y)) compiles to a signed-comparison sequence like

MOV ax, [esp-4]    ; y
SUB ax, [esp-8]    ; (< x y)
JL g01
MOV ax, BOOLEAN_T  ; #t
JMP g02
MOV ax, BOOLEAN_F  ; #f

On the x86 and ARM, JL (BLT) tests two flag bits, whereas JLE (BLE)
tests three.  (For unsigned comparisons, JB (BCC) tests one flag bit,
whereas JBE (BLS) tests two.)