From: Nathan F. <fr...@cs...> - 2005-05-13 22:57:34
|
On Sat, May 14, 2005 at 12:17:40AM +0200, R. Mattes wrote: > How is that? Doesn't a base-string consist entirely of base-chars (with > code-points <= 127)? How _can_ i construct an array of characters with > code-point <= 127 that has a different internal representation? (Assuming a SB-UNICODEd SBCL) You do this all the time, simply by typing strings at the REPL: CL-USER> (type-of "DAD") (SIMPLE-ARRAY CHARACTER (3)) Such a string has a layout that looks roughly like: [tag] [length] [00 00 00 44] [00 00 00 41] [00 00 00 44] [00 00 00 00] where [...] is a 32-bit quantity, with values written in hexadecimal when necessary. If you instead said something like: CL-USER (type-of (coerce "DAD" '(simple-array base-char (3))) (SIMPLE-BASE-STRING (3)) The memory layout of such a string would look like: [tag] [length] [44 41 44 00] which is more like what you are expecting. But that doesn't mean that you get to pun such a string into being a sequence of bytes like C. > I _hope_ i don't sound stubborn but i somehow miss to see the half- > bakedness of this interface [1]. Somehow i expect > > (sb-md5:md5sum-sequence "Blah") to act equivalent to > (sb:md5sum-sequence (string-to-octets "Blah" :encoding :default)) > > but i might be wrong. Don't expect; read the documentation! :) CL-USER> (documentation 'sb-md5:md5sum-sequence 'function) "Calculate the MD5 message-digest of data bounded by START and END in SEQUENCE , which must be a vector with element-type (UNSIGNED-BYTE 8)." -- Nathan | From Man's effeminate slackness it begins. --Paradise Lost The last good thing written in C was Franz Schubert's Symphony Number 9. --Erwin Dieterich |