chickadee » chicken » number-vector » #c64

#u8read
#u16read
#u32read
#s8read
#s16read
#s32read
#f32read
#f64read
#c64read
#c128read

The external representation of instances of the datatype XXXvector is #XXX( ...elements... ).

For example,

#u8(0 #e1e2 #xff)}}  ; a {{u8vector}} of length 3 containing 0, 100, 255
#f64(-1.5)           ; a {{f64vector}} of length 1 containing -1.5.

This external representation is also available in program source code. For example,

(set! x '#u8(1 2 3))

will set x to the object #u8(1 2 3). Since CHICKEN 4.9.0, literal homogeneous vectors do not have to be quoted. Homogeneous vectors can appear in quasiquotations but must not contain unquote or unquote-splicing forms. I.e.,

`(,x #u8(1 2))        ; legal
`#u8(1 ,x 2)          ; illegal

Elements may also be characters, lists, number vectors or strings, in that case they are interpreted as a sequence of numerical character codes. For example,

'#u8(#\x7f "EL" #\F 2 1)

is equivalent to

'#u8(#\x7f #\x45 #\x4c #\x46 2 1)

Character literals inside numeric vectors expand into the UTF-8 sequence of the characters they represent, for strings the contained characters are interpreted as UTF-8. Embedded bytevectors or numerical vectors are spliced directly into the result, without further translation. Lists are spliced as well, recursively, so:

'#u8(1 #;header (2 #;lengths (3 4) #u16(#xABCD)) )

will result in

 #u8(1 2 3 4 #xCD #xAB)

on a little endian machine.

Note that #u8"..." can be used as an abbreviation for the special case #u8("...").