{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lisphw3 - T(memset(car lis1 lis2(eqset(cdr lis1 lis2 Sheet1...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 (defun len(lis) (cond ((null lis) 0 ) ( 'else (+ (len(cdr lis)) 1)) )) LEN > (len '(A B C)) 3 > (len '(A B (DS dsf sdf) (asdf f ds) (AAS) (asd (sada sadD)) )) 6 > (defun union1 (Set1 Set2) (cond ( (null Set1) Set2) ( (memset (car Set1) Set2) (union (cdr Set1) Set2) ) ( 'otherwise (cons (car Set1) (union (cdr Set1) Set2))) )) UNION1 (defun memset (S1 Set) (cond ( (null Set) nil) ( (equal S1 (car Set)) Set) ( (memset S1 (cdr Set))) )) makest (defun makeset (lis) (cond ((null lis) nil) ((memset (car lis) (cdr lis)) (makeset (cdr lis))) (T (cons (car lis) (makeset (cdr lis)))) )) (defun setdiff(lis1 lis2) (cond ((null lis1) nil) ( (memset (first lis1) lis2) (setdiff (cdr lis1) lis2) ) ( T (cons (car lis1) (setdiff (cdr lis1) lis2) ) ) )) (defun eqset(lis1 lis2) (cond ( (and (null lis1) (null lis1))
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: T ) ( (memset (car lis1) lis2) (eqset (cdr lis1) lis2) ) Sheet1 Page 2 ( nil ) )) (defun unnest(lis) (cond ((null lis) nil) ( (not(atom (car lis))) (unnest(car lis) ) ) ( T (cons (car lis) (unnest(cdr lis)) ) ) )) (defun unnest(lis) (cond ((null lis) nil) ( (and (not(atom (car lis))) (null(cdr lis)) ) (unnest(car lis) ) ) ( (and (not(atom (car lis))) (not(null(cdr lis))) ) (unnest(cdr lis) ) ) ( T (cons (car lis) (unnest(cdr lis)) ) ) )) (defun unnest(lis) (cond ((null lis) nil) ( (and (not(atom (car lis))) (null(cdr lis)) ) (unnest(car lis)) ) ( (and (not(atom (car lis))) (not(null(cdr lis))) ) (cons (unnest(car lis)) (unnest(cdr lis)) ) ) ( T (cons (car lis) (unnest(cdr lis)) ) ) ))...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern