bitvector vs u1vector Per Bothner (22 May 2018 22:03 UTC)
Re: bitvector vs u1vector John Cowan (22 May 2018 23:45 UTC)
Re: bitvector vs u1vector Per Bothner (23 May 2018 00:07 UTC)
(missing)
(missing)
Re: bitvector vs u1vector John Cowan (27 Aug 2018 18:31 UTC)

Re: bitvector vs u1vector Per Bothner 23 May 2018 00:06 UTC

On 05/22/2018 04:45 PM, John Cowan wrote:
> That's a good point, and I will consider it.  However, it might make more sense for bitvectors to have the SRFI 151 API rather than the SRFI 133 API.  Then the only difference between bitvectors and SRFI 151 would be that bitvectors would be mutable, whereas integers are immutable.  What do you think?

Not the only difference: Bit vectors have finite length, while integers don't.  Thus you can't
convert an integer to a bitvector without also specifying a length.  Converting a bitvector
to an integer can be done in two meaningful ways: Sign-extending or zero-extending.

Common Lisp and SRFI-151 also has bit-field operations which are a hybrid in that they take a length.

Common Lisp and some Schemes have both bitvectors and integer bitwise operations.
I think mutable bitvectors are useful.

It might be useful to add a (bit-field->bitvector i start end) function (which would
return a fresh bitvector of length (- end start)).  And maybe (bitvector->integer bvec [sign-entend])
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/