Changes between Version 13 and Version 14 of BitwiseCowan


Ignore:
Timestamp:
08/29/16 17:26:50 (12 months ago)
Author:
cowan
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BitwiseCowan

    v13 v14  
    1212consistent, portable set of ''names'' and ''parameter conventions'', however, is. 
    1313 
    14 Hence this SRFI, which is based mainly on [http://srfi.schemers.org/srfi-33/srfi-33.html SRFI 33], with some changes and additions from [http://srfi.schemers.org/srfi-33/mail-archive/msg00023.html Olin's late revisions to SRFI 33] (which were never consummated) and a few procedures from [http://srfi.schemers.org/srfi-60/srfi-60.html SRFI 60] and 
     14Hence this SRFI, which is based mainly on [http://srfi.schemers.org/srfi-33/srfi-33.html SRFI 33], with some changes and additions from [http://srfi.schemers.org/srfi-33/mail-archive/msg00023.html Olin's late revisions to SRFI 33] (which were never consummated). 
     15SRFI 33 was never finalized, but is a reasonably comprehensive proposal. 
     16A few procedures have been added from [http://srfi.schemers.org/srfi-60/srfi-60.html SRFI 60] and 
    1517the general vector [http://srfi.schemers.org/srfi-133/srfi-133.html SRFI 133].   
    16 SRFI 33 was never finalized, but is a reasonably comprehensive proposal. 
    1718SRFI 60 (based on SLIB) is smaller but has a few procedures of its own; 
    1819some of its procedures have both native (often CL) and SRFI 33 names. 
     
    147148* The procedures `copy-bit`, `integer->list` and `list->integer` are incorporated into this SRFI unchanged. 
    148149 
    149 * The procedure `booleans->integer` is a convenient way to specify a bitwise integer in the absence of datum syntax: it accepts an arbitrary number of boolean arguments and returns a non-negative integer.  So in this SRFI it has the short name `bits`, roughly analogous to `list`, `string`, and `vector`. 
     150* The procedure `booleans->integer` is a convenient way to specify a bitwise integer: it accepts an arbitrary number of boolean arguments and returns a non-negative integer.  So in this SRFI it has the short name `bits`, roughly analogous to `list`, `string`, and `vector`. 
    150151 
    151152=== Other sources === 
     
    432433Returns ''i'' with the order of the bits in the selected field reversed. 
    433434 
    434 `(bit-field-append `{ ''i start end '' }`)` 
    435  
    436 The number of arguments must be a multiple of three.  The field specified 
    437 by each triple of (''i, start, end'') arguments is extracted, and the 
     435`(bit-field-append `''i start end'' ...`)` 
     436 
     437It is an error if the number of arguments is not a multiple of three.  The field specified 
     438by each triple of ''i start end'' arguments is extracted, and the 
    438439fields are concatenated in left-to-right order and returned as an integer. 
    439440 
    440441=== Bits as booleans === 
    441442 
    442 `(integer->list `''i'' [ ''len'' ]`)` 
    443  
    444 Returns a list of ''len'' booleans corresponding to each bit of the non-negative integer ''i''. 
     443`(integer->list `''i'' [ ''len'' ]`)`[[BR]] 
     444`(integer->vector `''i'' [ ''len'' ]`)` 
     445 
     446Returns a list/vector of ''len'' booleans corresponding to each bit of the non-negative integer ''i''. 
    445447`#t` is returned for each 1; `#f` for 0. The len argument defaults to `(integer-length `''i''`)`. 
    446448 
     449`(list->integer `''list''`)`[[BR]] 
    447450`(list->integer `''list''`)` 
    448451 
    449 Returns an integer formed from the booleans in ''list''; 
    450 it is an error if ''list'' contains non-booleans. 
     452Returns an integer formed from the booleans in ''list/vector''; 
     453it is an error if ''list/vector'' contains non-booleans. 
    451454A 1 bit is coded for each `#t`; a 0 bit for `#f`. 
    452455Note that the result is never a negative integer. 
    453 `integer->list` and `list->integer` are inverses in the sense of `equal?`. 
     456`integer->list` and `list->integer` are inverses in the sense of `equal?`, 
     457and so are `integer->vector` and `vector->integer`. 
    454458 
    455459`(bits `''bool'' ...`)` 
     
    523527||Replace bit field||`dpb`||`replace-bit-field`||`bit-field-replace`||`copy-bit-field`||`bitwise-copy-bit-field`||`bit-field-replace`|| 
    524528||Replace corresponding bit field||`deposit-field`||`deposit-field`||`copy-bit-field`||---||---||`bit-field-copy-same`|| 
    525 ||Fill bit field||---||---||---||---||---||bit-field-fill|| 
     529||Fill bit field||---||---||---||---||---||`bit-field-fill`|| 
    526530||Rotate bit field||---||---||---||`rotate-bit-field`||`bitwise-rotate-bit-field`||`bit-field-rotate`|| 
    527531||Reverse bit field||---||---||---||`reverse-bit-field`||`bitwise-reverse-bit-field`||`bit-field-reverse`|| 
    528532||Append bit fields||---||---||---||---||---||`bit-field-append`|| 
    529533||Integer to boolean list||---||---||---||`integer->list`||---||`integer->list`|| 
     534||Integer to boolean vector||---||---||---||---||---||`integer->vector`|| 
    530535||Boolean list to integer||---||---||---||`list->integer`||---||`list->integer`|| 
     536||Boolean vector to integer||---||---||---||---||---||`vector->integer`|| 
    531537||Booleans to integer||---||---||---||`booleans->integer`||---||`bits`|| 
    532 ||Bitwise fold||---||---||---||---||---||`bitwise-fold`| 
     538||Bitwise fold||---||---||---||---||---||`bitwise-fold`|| 
    533539||Bitwise for-each||---||---||---||---||---||`bitwise-for-each`|| 
    534540||Bitwise unfold||---||---||---||---||---||`bitwise-unfold`||