Scheme for all (3): Why not make sense, female ?, Scheme for all

Source: Internet
Author: User

Scheme for all (3): Why not make sense, female ?, Scheme for all


The best thing in life is his friendship with others. -- Lincoln

(Define set?
(Lambda (l)
(Cond
(Null? L) # t)
(Member? (Car l) (cdr l) # f)
(Else (set? (Cdr l ))))))
(Set? '(Apples peaches pear plums ))
(Set? '(Apple peaches apple plum ))
(Define makesetx
(Lambda (lat)
(Cond
(Null? Lat )'())
(Member? (Car lat) (cdr lat) (makesetx (cdr lat )))
(Else (cons (car lat) (makesetx (cdr lat )))))))
(Makesetx' (apple peach pear peach plum apple lemon peach ))
(Define makeset
(Lambda (lat)
(Cond
(Null? Lat )'())
(Member? (Car lat) (cdr lat) (cons (car lat) (makeset (multirember (car lat) (cdr lat )))))
(Else (cons (car lat) (makeset (cdr lat )))))))
(Makeset '(apple peach pear peach plum apple lemon peach ))
(Makeset '(apple 3 pear 4 9 apple 3 4 ))
(Define subset?
(Lambda (set1 set2)
(Cond
(Null? Set1) # t)
(Member? (Car set1) set2) (subset? (Cdr set1) set2 ))
(Else # f ))))
(Subset? (4 pounds of horseradish) '(four pounds chicken and 5 ounces horseradish ))
(Subset? '(5 chicken wings)' (5 hamburgers 2 pieces fried chicken and light duckling wings ))
(Define subsetx?
(Lambda (set1 set2)
(Cond
(Null? Set1) # t)
(Else (and (member? (Car set1) set2)
(Subsetx? (Cdr set1) set2 ))))))
(Define eqset?
(Lambda (set1 set2)
(Cond
(Subset? Set1 set2)
(Subset? Set2 set1 ))
(Else # f ))))
(Define eqsetx?
(Lambda (set1 set2)
(And (subsetx? Set1 set2) (subsetx? Set2 set1 ))))
(Define intersect?
(Lambda (set1 set2)
(Cond
(Null? Set1) # f)
(Else
(Or (member? (Car set1) set2)
(Intersect? (Cdr set1) set2 ))))))
(Intersect? '(Stewed tomatoes and macaroni)' (macaroni and cheese ))
(Define union
(Lambda (set1 set2)
(Cond
(Null? Set1) set2)
(Member? (Car set1) set2)
(Union (cdr set1) set2 ))
(Else (cons (car set1)
(Union (cdr set1) set2 ))))))


Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.