From ... From: Erik Naggum Subject: Re: read-sequence & ACL Date: 1998/12/24 Message-ID: <3123476229321813@naggum.no>#1/1 X-Deja-AN: 425452188 References: mail-copies-to: never To: Sam Steingold Organization: Naggum Software; +47 8800 8879; http://www.naggum.no Newsgroups: comp.lang.lisp * Sam Steingold | `read-sequence' is under-specified: it is unclear whether it reads bytes | or chars, so ACL5 refuses to read-sequence from a socket to a vector of | unsigned-byte. Sam Steingold is under-intelligent: it is unclear whether he can read a single bit of documentation, or, god forbid, a sequence of characters, so ACL 5.0 refuses to do what he tries to pound it into doing. but since it's Christmas, let's even help the retarded with Common Lisp questions. | is there a way around this? yeah, there actually is. you could (re)boot your brain, read the very good documentation and the standard, think for maybe 14 ms if you're really slow, and then not post the same stupid question anymore since you would have understood the point. oh, you meant around _your_ problem. well, my suggestion actually works for yours, too. but, in the spirit of Christmas and all, here's a gift quote from the Description clause in the standard under READ-SEQUENCE: Destructively modifies sequence by replacing the elements of sequence bounded by start and end with elements read from stream. "element" is a glossary term. let's look it up. aaah, there's a special case just for us! that's _so_ nice, don't you think? now, read it. element n. ... 5. (of an input stream) a character or number (as appropriate to the element type of the stream) that is among the ordered series of objects that can be read from the stream (using read-char or read-byte, as appropriate to the stream). and here's _another_ sentence, now in the Exceptional Situations clause in the standard under READ-SEQUENCE: Might signal an error of type type-error if an element read from the stream is not a member of the element type of the sequence. what _could_ this _possibly_ mean? could it be that element types of streams and sequences have to agree? nah, that would be quite smart, and some people just _aren't_ smart at all, now, are they? just getting the idea that objects in Common Lisp are _typed_ and that type mismatches are fixable by getting the types right is obviously too much for some people. | what do I do? well, since you appear to be the kind of guy who copies examples instead of understanding them, and I'm nice to you today, it being Christmas and all, here's one example so trivial that even copyright protection won't apply to it. it has worked as long as I have used Allegro CL, i.e., from 4.3 through 5.0: (let ((universal-time (make-array 4 :element-type '(unsigned-byte 8)))) (with-open-stream (time (socket:make-socket :FORMAT :BINARY :remote-host "127.1" :remote-port "time")) (read-sequence universal-time time)) universal-time) please excuse the lack of boldface. I have tried to highlight the important aspect of this example with uppercase letters, instead. I hope that is sufficient for you when you copy the example. feel free to complain about case insensitivity, by the way, if the example doesn't work until you downcase the two symbols. | [CLISP provides lisp:read-byte-sequence and lisp:read-char-sequence for | this exact purpose.] another great disservice to the Common Lisp community from CLISP, by people who don't really understand what's going on around them. #:Erik -- Nie wieder KrF! Nie wieder KrF! Nie wieder KrF! Nie wieder KrF!