Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun custom-proper-cons (a b)
- "Return a proper cons of A and B, but avoid consing NIL."
- (etypecase a
- (null (etypecase b
- (null nil)
- (atom (list b))
- (list b)))
- (atom (etypecase b
- (null (list a))
- (atom (list a b))
- (list (cons a b))))
- (list (etypecase b
- (null a)
- (atom (cons a (list b)))
- (list (cons a b))))))
Add Comment
Please, Sign In to add comment