Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with Lisp type system

3 views
Skip to first unread message

Bob Felts

unread,
Dec 5, 2008, 1:04:17 PM12/5/08
to
Given +foo+ and +bar+ (2 constants, value not really important here),
I'd like to make an unsigned-byte 8 sequence containing these two
values. The brute force way:

(let ((blob (make-array 2 :element-type '(unsigned-byte 8))))
(setf (aref blob 0) +foo+)
(setf (aref blob 1) +bar+)
blob))

But surely I ought to be able to use :initial-contents to populate the
array. I just haven't been able to find the right incantation that
makes everyone happy.

Any help appreciated.

Thomas M. Hermann

unread,
Dec 5, 2008, 1:25:21 PM12/5/08
to

Not sure how you are specifying the initial-contents, but this worked
for me:

(make-array 2 :element-type '(unsigned-byte 8) :initial-contents (list
+foo+ +bar+))

or

(make-array 2 :element-type '(unsigned-byte 8) :initial-contents
(vector +foo+ +bar+))

HTH,

Tom

Alberto Riva

unread,
Dec 5, 2008, 1:27:15 PM12/5/08
to

What about:

(let ((blob (make-array 2 :element-type '(unsigned-byte 8)

:initial-contents (list +foo+ +bar+))))
blob)

?

Alberto

Bob Felts

unread,
Dec 5, 2008, 1:28:43 PM12/5/08
to

I could have sworn I tried that. Thanks for the help.

Message has been deleted
0 new messages