On Feb 21, 2014, at 12:53 PM, Per Bothner wrote: > We should also update the Logical-Number-Operations section. > I'm inclined to replace the subsection name > "Deprecated Logical Number Operations" > by something like "SRFI-60 Logical Number Operations", and > adding something about having to use import or require. > (Not quite true right now, but it might be a plausible thing to do.) > And of course fix the logbit? description, and add any missing > functions. > > It's possible some of these "deprecated" functions aren't SRFI-60; > then we'll have to consider what to do. See attached. As it turns out, there's one "deprecated" function which is not a SRFI-60 name: bit-extract. The SRFI-60 equivalent is called bit-field. (Both are equivalent to R6RS bitwise-bit-field.) Of the non-deprecated Kawa functions, all but logop and logtest are mandated by R6RS (logtest is in SRFI-60 but has no equivalent in R6RS). Of the R6RS functions, five of them also appear in SRFI-60 with the same name: bitwise-not, bitwise-and, bitwise-ior, bitwise-xor, and bitwise-if. They all also have alternate names in SRFI-60 (lognot, logand, logior, logxor, bitwise-merge). I put in a SRFI-60 section as you suggested. For now, I marked the functions which are (old) builtins as such, with language saying that the rest are available via (require 'srfi-60) or (import (srfi :60)). I left the "deprecated" subsection there, but it only contains bit-extract now. It probably makes sense to just get rid of that function, but that feels like it should be a separate commit. BTW here's an org-mode table I made while figuring all this stuff out. |--------------------------------------------+------+------+---------| | Function | R6RS | Kawa | SRFI-60 | |--------------------------------------------+------+------+---------| | bitwise-not n | Y | Y | Y | | lognot n | | Dep | Y | |--------------------------------------------+------+------+---------| | bitwise-and n1 ... | Y | Y | Y | | logand n1 ... | | Dep | Y | |--------------------------------------------+------+------+---------| | bitwise-ior n1 ... | Y | Y | Y | | logior n1 ... | | Dep | Y | |--------------------------------------------+------+------+---------| | bitwise-xor n1 ... | Y | Y | Y | | logxor n1 ... | | Dep | Y | |--------------------------------------------+------+------+---------| | bitwise-if mask n0 n1 | Y | Y | Y | | bitwise-merge mask n0 n1 | | | Y | |--------------------------------------------+------+------+---------| | bitwise-bit-count n | Y | Y | | | logcount n | | Dep | Y | | bit-count n | | | Y | |--------------------------------------------+------+------+---------| | bitwise-length n | Y | Y | | | integer-length n | | Dep | Y | |--------------------------------------------+------+------+---------| | bitwise-first-bit-set n | Y | Y | | | log2-binary-factors n | | | Y | | first-set-bit n | | | Y | |--------------------------------------------+------+------+---------| | bitwise-bit-set? n index | Y | Y | | | logbit? index n | | Dep* | Y | | bit-set? index n | | | Y | |--------------------------------------------+------+------+---------| | bitwise-copy-bit from index bit (int) | Y | Y | | | copy-bit index from bit (boolean) | | | Y | |--------------------------------------------+------+------+---------| | bitwise-bit-field n start end | Y | Y | | | bit-field n start end | | | Y | | bit-extract n start end | | Dep | | |--------------------------------------------+------+------+---------| | bitwise-copy-bit-field to start end from | Y | Y | | | copy-bit-field to from start end | | | Y | |--------------------------------------------+------+------+---------| | bitwise-arithmetic-shift n count | Y | Y | | | arithmetic-shift n count | | Dep | Y | | ash n count | | Dep | Y | |--------------------------------------------+------+------+---------| | bitwise-arithmetic-shift-left n count | Y | Y | | | bitwise-arithmetic-shift-right n count | Y | Y | | |--------------------------------------------+------+------+---------| | bitwise-rotate-bit-field n start end count | Y | Y | | | rotate-bit-field n count start end | | | Y | |--------------------------------------------+------+------+---------| | bitwise-reverse-bit-field n start end | Y | Y | | | reverse-bit-field n start end | | | Y | |--------------------------------------------+------+------+---------| | logtest j k | | Y | Y | | any-bits-set? j k | | | Y | |--------------------------------------------+------+------+---------| | integer->list k [len] | | | Y | |--------------------------------------------+------+------+---------| | list->integer list | | | Y | |--------------------------------------------+------+------+---------| | booleans->integer bool1 ... | | | Y | |--------------------------------------------+------+------+---------| | logop op x y | | Y | | |--------------------------------------------+------+------+---------| -- Jamison Hope The PTR Group www.theptrgroup.com