별의 공부 블로그 🧑🏻‍💻

samesetp

Source Code/LISP (CL) 2017. 5. 31. 02:18
728x90
728x170
(defun samesetp (lis1 lis2)
(if (and (not (null lis1)) (not (null lis2)))
(let ((x (first lis1)) (y (first lis2)))
(cond ((and (listp x) (listp y))
(and (samesetp x y) (samesetp (rest lis1) (rest lis2))))
(t (and (eq x y) (samesetp (rest lis1) (rest lis2))))))
(= (length lis1) (length lis2))))


(defun samesetp (lis1 lis2)
"Another Version of samesetp."
(if (null lis1) (null lis2)
(let ((x (remove (first lis1) lis2)))
(if (equal lis2 x) nil (equivalence (rest lis1) x)))))


Checking the equality of sets in 2 lists without considering the order.

728x90
그리드형(광고전용)

'Source Code > LISP (CL)' 카테고리의 다른 글

Block's World  (0) 2017.06.08
Tic Tac Toe Game  (0) 2017.05.30
입출력 (INPUT / OUTPUT)  (0) 2017.05.18
순환 (Recursion)  (0) 2017.05.16
Checking whether an input element is a number or not with using DO macro. (Infinite Loop)  (0) 2017.04.21
⚠️AdBlock이 감지되었습니다. 원할한 페이지 표시를 위해 AdBlock을 꺼주세요.⚠️
starrykss
starrykss
별의 공부 블로그 🧑🏻‍💻


📖 Contents 📖