Error in vectors.lsp
jboyens opened this issue · comments
Great work, but I think I found an error:
Line 29 in 96e7659
(make-array '4 :element-type 'bit)
makes something like #*0000
not #*0011
Same here.
Should be #*0000
I wonder if they meant the line to read
(assert-equal ____ (make-array '4 :element-type 'bit :initial-contents '(0 0 1 1)))
This would make it easier to figure out the answer to list-to-bit-vector part.
This test invokes undefined behaviour.
CLHS MAKE-ARRAY states:
If initial-element is not supplied, the consequences of later reading an uninitialized element of new-array are undefined unless either initial-contents is supplied or displaced-to is non-nil.
Therefore, (make-array '4 :element-type 'bit)
is not guaranteed to return #*0000
. According to the standard, it is allowed to return #*1111
as well, as well as any 4-bit combination.