Advertisement
Guest User

Untitled

a guest
May 17th, 2018
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.32 KB | None | 0 0
  1. (defun p-match (p v)
  2.        (cond
  3.          ((eql p '_) nil)
  4.          ((null p) nil)
  5.          ((atom p) (cons p v))
  6.          ((consp p)
  7.           (let ((first (p-match (car p) (car v)))
  8.             (rest  (p-match (cdr p) (cdr v))))
  9.         (unless (listp (cdr p))
  10.           (setf rest (list rest)))
  11.         (if first
  12.             (cons first rest)
  13.             rest)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement