On Wed, Oct 29, 2003 at 07:03:27AM +0100, Robert STRANDH wrote:
> Hello,
>
> When using portable AllegroServe (very new CVS version) on CMUCL to
> publish a file (type "image/png"), I get the following error :
>
> got error Type-error in WRITE-SEQUENCE:
> 137 is not of type (OR CHARACTER (UNSIGNED-BYTE 8))
>
> Normally, I would think there was a problem with AllegroServe, but it
> looks to me like 137 IS of type (OR CHARACTER (UNSIGNED-BYTE 8)).
>
> Perhaps this is a problem of CMUCL that has been fixed? I am using
> release 18d at the moment.
>
> Thanks for any help.
I was having the same troubles a while back. I think it's been fixed in CVS
now, but I was using this for older versions:
(in-package #:CL)
#+cmu
(defun write-sequence (seq stream &key (start 0) (end nil))
"Write the elements of SEQ bounded by START and END to STREAM."
(declare (type sequence seq)
(type stream stream)
(type index start)
(type sequence-end end)
(values sequence))
(when (not (cl::lisp-stream-p stream))
(return-from write-sequence (stream-write-sequence stream seq start end)))
(let ((end (or end (length seq))))
(declare (type index start end))
(etypecase seq
(list
(let ((write-function
(if (subtypep (stream-element-type stream) 'character)
#'write-char
#'write-byte)))
(do ((rem (nthcdr start seq) (rest rem))
(i start (1+ i)))
((or (endp rem) (>= i end)) seq)
(declare (type list rem)
(type index i))
(funcall write-function (first rem) stream))))
(string
(write-string* seq stream start end))
(vector
(let ((write-function
(if (subtypep (stream-element-type stream) 'character)
#'write-char
#'write-byte)))
(do ((i start (1+ i)))
((>= i end) seq)
(declare (type index i))
(funcall write-function (aref seq i) stream)))))))
--
; Matthew Danish <[EMAIL PROTECTED]>
; OpenPGP public key: C24B6010 on keyring.debian.org
; Signed or encrypted mail welcome.
; "There is no dark side of the moon really; matter of fact, it's all dark."