Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. (defun mixed (arg1 &rest arguments &aux (arg3 24) arg3-supplied (arg2 30) arg2-supplied)
  2. (loop :while arguments
  3. :do (case (first arguments)
  4. (:arg3
  5. (pop arguments)
  6. (unless arguments (error "Missing argument after :arg3"))
  7. (setf arg3 (pop arguments) arg3-supplied t))
  8. (otherwise
  9. (cond
  10. ((not arg2-supplied) (setf arg2 (pop arguments) arg2-supplied t))
  11. (t (error "Too many arguments, remaining: ~S" arguments))))))
  12. (list arg1 arg2 arg3 arg2-supplied arg3-supplied))
  13.  
  14. (mixed 22 44) --> (22 44 24 t nil)
  15. (mixed 22 44 :arg3 33) --> (22 44 33 t t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement