Skip to content

Instantly share code, notes, and snippets.

@anton0xf
Created November 13, 2012 13:01
Show Gist options
  • Select an option

  • Save anton0xf/4065651 to your computer and use it in GitHub Desktop.

Select an option

Save anton0xf/4065651 to your computer and use it in GitHub Desktop.
inverted optional
(defun test(&rest ab)
(let ((len (length ab))
(a 2) b)
(cond ((< 2 len) (error "Too many args"))
((= 2 len)
(setf a (first ab)
b (second ab)))
((= 1 len) (setf b (first ab)))
(t (error "B arg is mandatory")))
(format t "a: ~W, b: ~W~%" a b)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment