Advertisement
Guest User

Untitled

a guest
Feb 17th, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.30 KB | None | 0 0
  1. (defun extract-options (list)
  2.   (iter (for rest on list by #'cddr)
  3.     (while (keywordp (first rest)))
  4.     (collect (list (first rest) (second rest)) into args)
  5.     (finally (return (values args rest)))))
  6.  
  7. (extract-options '(:h 0 :w 2 (hello-world) (expr)))
  8. ;; => ((:H 0) (:W 2)), ((HELLO-WORLD) (EXPR))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement