Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (setq my-data '((0 A) (1 B) (2 C)))
- (loop for (x y) in my-data
- collect (list y x))
- ;=> ((A 0) (B 1) (C 2))
- (mapcan (lambda (z)
- (destructuring-bind (x y) z
- (list (list y x))))
- my-data)
- ;=> ((A 0) (B 1) (C 2))
- ;; (setq my-data '((0 A) (1 B) (2 C)))
- (let (res)
- (dolist (z my-data (nreverse res))
- (destructuring-bind (x y) z
- (push (list y x) res))))
- ;=> ((A 0) (B 1) (C 2))
Add Comment
Please, Sign In to add comment