Re: printing readably an array of type bit!



In article
<083af91e-e516-42ea-881a-4c69adcd734c@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"\"(typep 'nil (statisfies 'identity))\"" <christophamort@xxxxxxxx>
wrote:

... here the non portable way to this:

(defmethod print-object ((array0 array) (stream0 stream))
(if (eq 'bit (array-element-type array0))
(format stream0 "~S"
`(make-array ',(array-dimensions array0)
:element-type ',(array-element-type array0)
:initial-contents ',(loop
with m of-type unsigned-
byte = (array-dimension array0 0)
for i from 0 below m
collect (loop for j from 0
below m
collect (bit
array0 i j)))))
(call-next-method)))

... it would be interesting to see in how many implementation this
code works!
c.

it would probably be safer if you did this as an :AROUND method rather
than a primary method. Otherwise, you run into trouble if the
implementation uses this method to implement the default #nA(...)
notation.

--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.