Juan Reynoso Elias
En 2017-02-25 14:05:39
Mapping

Mapping is a type of iteration in which a function is successively applied to pieces of one or more sequences. The result of the iteration is a sequence containing the respective results of the function applications.

Examples:
 
I want to a list of the list like
((1) (2) (3))
(map 'list (lambda (x) (list x)) '(1 2 3))

list to string

(map 'string (lambda (x) (char (write-to-string x) 0)) '(1 2 3))
 
string to list
(map 'list (lambda (x) (intern (string-upcase (string x)))) "lisp")
 
list to vector
(map 'vector (lambda (x) x) '( 1 2 3))
 
vector to string
(map 'list (lambda (x) x) #(1 2 3))
 
The cadr as alist
(map 'list (lambda (x)  (cons (first x) (second x))) '((1 "one") (2 "two")))

#lisp #map

También te podría interesar