This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; capitalize | |
M-c | |
M-- M-c | |
;; Upper case | |
M-u | |
M-- M-u | |
;; lower case | |
M-l | |
M-- M-l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;sets as order lists | |
(define (element-of-set? x set) | |
(cond ((null? set) false) | |
((= x (car set)) true) | |
((< x (car set)) false) | |
(else (element-of-set? x (cdr set))))) | |
(define (intersection-set set1 set2) | |
(if (or (null? set1) (null? set2)) | |
'() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (union-set set1 set2) | |
(cond ((null? set1) set2) | |
((null? set2) set1) | |
((element-of-set? (car set1) set2) | |
(union-set (cdr set1) set2)) | |
(else | |
(cons (car set1) (union-set (cdr set1) set2))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; SICP 2.58 part.b | |
;;; | |
;; sum | |
(define (make-sum a1 a2) | |
(cond ((and (number? a1) (number? a2)) (+ a1 a2)) | |
((=number? a1 0) a2) | |
((=number? a2 0) a1) | |
(else (list a1 '+ a2)))) | |
(define (sum? x) | |
(and (pair? x) (eq? (cadr x) '+))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (=number? exp num) | |
(and (number? exp) (= exp num))) | |
(define (variable? x) (symbol? x)) | |
(define (same-variable? a b) | |
(and (variable? a) (variable? b) (eq? a b))) | |
(define (make-sum a1 a2) | |
(cond ((=number? a1 0) a2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp | |
2. Code: The Hidden Language of Computer Hardware and Software | |
3. An introduction to algorithms | |
4. Artificial Intelligence: a modern approach | |
5. ON LISP | |
6. ANSI COMMON LISP | |
7. LISP IN SMALL PIECES | |
8. THE LITTLE LISPER | |
9. THE SEASONED SCHEMER |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (equal? list1 list2) | |
(cond ((null? list1) (null? list2)) | |
((null? list2) #f) | |
((eq? list1 list2) #t) | |
((eq? (car list1) (car list2)) (equal? (cdr list1) (cdr list2))) | |
(else #f))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (make-vect x y) | |
(cons x y)) | |
(define (xcor-vect v) | |
(car v)) | |
(define (ycor-vect v) | |
(cdr v)) | |
(define (add-vect v1 v2) | |
(make-vect (+ (xcor-vect v1) (xcor-vect v2)) | |
(+ (ycor-vect v1) (ycor-vect v2)))) | |
(define (sub-vect v1 v2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (split op1 op2) | |
(lambda (painter n) | |
(if (= n 0) | |
painter | |
(let ((smaller ((split op1 op2) painter (- n 1)))) | |
(op1 painter (op2 smaller smaller)))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (up-split painter n) | |
(if (= n 0) | |
painter | |
(let ((smaller (up-split painter (- n 1)))) | |
(below painter (beside smaller smaller))))) | |