Advertisement
Guest User

Untitled

a guest
Apr 8th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. (defun multiple-value-mapcar (fun list &rest other-lists)
  2. (values-list (apply (function mapcar) (function list)
  3. (loop
  4. :with all-lists := (cons list other-lists)
  5. :while (every (function identity) all-lists)
  6. :collect (multiple-value-list (apply fun (mapcar (function first) all-lists)))
  7. :do (setf all-lists (mapcar (function rest) all-lists))))))
  8.  
  9. (multiple-value-mapcar (function truncate) '(10 20 30) '(3 3 3))
  10. --> (3 6 10)
  11. (1 2 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement