Re: printing readably an array of type bit!
- From: Barry Margolin <barmar@xxxxxxxxxxxx>
- Date: Fri, 31 Oct 2008 15:54:50 -0400
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 ***
.
- References:
- printing readably an array of type bit!
- From: \"(typep 'nil (statisfies 'identity))\"
- Re: printing readably an array of type bit!
- From: Barry Margolin
- Re: printing readably an array of type bit!
- From: \"(typep 'nil (statisfies 'identity))\"
- Re: printing readably an array of type bit!
- From: \"(typep 'nil (statisfies 'identity))\"
- printing readably an array of type bit!
- Prev by Date: Re: Growing a data type?
- Next by Date: Re: printing readably an array of type bit!
- Previous by thread: Re: printing readably an array of type bit!
- Next by thread: Re: printing readably an array of type bit!
- Index(es):