National Scheme (2): You from the stars

Source: Internet
Author: User


a programming language is not worth learning if you don't have an impact on how you think about programming. . --alan Perlis

(Define Rember*
(Lambda (a list)
(Cond
((null? list) ' ())
(Atom? (Car list)) (Cond
(eq. A (car list)) (rember* A (CDR list))
(Else (Cons car list) (rember* A (CDR list)))))
(Else (Cons (rember* A (car list)) (rember* A (CDR list))))))


(rember* ' Cup ' ((coffee) cup ((tea) cup) (and (Hick)) Cup))

(Define Insertr*
(Lambda (new old L)
(Cond
((null? l) ' ())
(Atom? (Car L)) (Cond
(eq? (car L) old) (Cons old (cons new (Cdr L)))
(Else (cons (car l) (insertr* new Old (Cdr L)))))
(Else (cons (insertr* new old (car L)) (insertr* new Old (Cdr L))))))

(insertr* ' Roast ' chuck ' (How much (Wood))
Could
((A (wood) chuck))
(((Chuck)))
(if (a) ((wood chuck)))
could chuck Wood))

(Define Occur*
(Lambda (A L)
(Cond
((null? l) 0)
(Atom? (Car L)) (Cond (eq. A (car L)) (+ 1 (occur* A (cdr L)))
(Else (occur* a (cdr L))))
(Else (+ (occur* A (car L)) (Occur* A (cdr L))))))

(occur* ' banana ' ((banana) (Split (((banana ice))
(Cream (banana))
Sherbet))
(banana)
(bread)
(banana brandy)))
(Define Subst*
(Lambda (new old L)
(Cond
((null? l) ' ())
(Atom? (Car L)) (Cond
(eq. old (Car L)) (Cons new (subst* new old (Cdr L)))
(Else (cons (car l) (subst* new Old (Cdr L)))))
(Else (cons (subst* new old (car L)) (subst* new Old (Cdr L))))))
(subst* ' Orange ' banana ' ((banana) (Split (((banana ice))
(Cream (banana))
Sherbet))
(banana)
(bread)
(banana brandy)))

(Define Insertl*
(Lambda (new old L)
(Cond
((null? l) ' ())
(Atom? (Car L)) (Cond
(eq. old (Car L)) (Cons new (cons-old (insertl* new-old (Cdr L))))
(Else (cons (car l) (insertl* new Old (Cdr L)))
))
(Else (cons (insertl* new old (car L)) (insertl* new Old (Cdr L))))))

(insertl* ' pecker ' Chuck ' (How much (Wood))
Could
((A (wood) chuck))
(((Chunck)))
(if (a) ((wood chuck)))
(could chuck Wood))

(Define Member*
(Lambda (A L)
(Cond
((null? l) #f)
(Atom? (Car L)) (Cond
(eq? (car L) a) #t)
(Else (member* a (cdr L))))
(Else (or (member* a (car l))
(Member* A (cdr L))))))

(member* ' Chips ' ((potato) (chips (with) fish) (chips)))

National Scheme (2): You from the stars

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.