Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

common lisp awareness

Name: Anonymous 2013-03-23 5:19


(coerce (list #\a #\b #\a #\b) 'string) ==> "abab"
(coerce (vector #\a #\b #\a #\b) 'string) ==> "abab"
(coerce "abab" 'list) ==> (#\a #\b #\a #\b)
(coerce "abab" 'vector) ==> "abab"
(map 'string #'char-invertcase "Abab") ==> "aBAB"
(map 'list #'char-invertcase "Abab") ==> (#\a #\B #\A #\B)
(map 'string #'character (list 48 49 50 51)) ==> "0123"
(sort (list 3 1 5 4) #'<) ==> (1 3 4 5)
(sort (vector 3 1 5 4) #'<) ==> #(1 3 4 5)
(sort "zzzxyxyyxyzz" #'char<) ==> "xxxyyyyzzzzz"
(elt "abafb" 3) ==> #\f
(elt (list 'a 'b 'a 'f 'b) 3) ==> F
(elt (vector 'a 'b 'a 'f 'b) 3) ==> F

Name: Anonymous 2013-03-23 17:49

>>18
I'm not sure if I follow. Are you saying all vectors contain elements that are 32 bits wide? What about pointers on 64 bit machines? Or 16 bit machines?

But aside from unicode strings, there's also use for binary strings, and strictly ASCII strings. By parameterizing element-type, you can have an optimal implementation for all.

>>19
bit vectors are also useful.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List