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 (entry tree) (car tree)) | |
(define (left-branch tree) (cadr tree)) | |
(define (right-branch tree) (caddr tree)) | |
(define (make-tree entry left right) | |
(list entry left right)) | |
(define (list->tree elements) | |
(car (partial-tree elements (length elements)))) | |
(define (partial-tree elts n) | |
(if (= n 0) |
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 (entry tree) (car tree)) | |
(define (left-branch tree) (cadr tree)) | |
(define (right-branch tree) (caddr tree)) | |
(define (make-tree entry left right) | |
(list entry left right)) | |
(define (tree->list-1 tree) | |
(if (null? tree) | |
'() | |
(append (tree->list-1 (left-branch tree)) |
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 a '(1 2 4 6)) | |
(define b '(3 4 5 6 7 8)) | |
(define (union-set x y) | |
(cond | |
((null? x) y) | |
((null? y) x) | |
((= (car x) (car y)) | |
(cons (car x) (union-set (cdr x) (cdr y)))) | |
((< (car x) (car y)) |
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 (element-of-set? x set) | |
(cond ((null? set) #f) | |
((= x (car set)) #t) | |
((< x (car set)) #f) | |
(else (element-of-set? x (cdr set))))) | |
(define a '(1 2 4 6)) | |
(define b '(3 4 5 6 7 8)) | |
(element-of-set? 3 a) |
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 (element-of-set? x set) | |
(cond ((null? set) #f) | |
((= x (car set)) #t) | |
(else (element-of-set? x (cdr set))))) | |
(define a '(1 2 3 4 6 6)) | |
(define b '(3 4 5 6 2)) | |
(element-of-set? 3 a) | |
(element-of-set? 5 a) |
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 (element-of-set? x set) | |
(cond ((null? set) #f) | |
((= x (car set)) #t) | |
(else (element-of-set? x (cdr set))))) | |
(define a '(1 2 3 4)) | |
(define b '(3 4 5 6)) | |
(element-of-set? 3 a) | |
(element-of-set? 5 a) |
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
;a | |
(define (variable? x) (symbol? x)) | |
(define (same-variable? v1 v2) | |
(and (variable? v1) (variable? v2) (eq? v1 v2))) | |
(define (exponentiation? x) | |
(and (pair? x) (eq? (car x) '**))) | |
(define (base p) (cadr p)) |
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 (variable? x) (symbol? x)) | |
(define (same-variable? v1 v2) | |
(and (variable? v1) (variable? v2) (eq? v1 v2))) | |
(define (sum? x) | |
(and (pair? x) (eq? (car x) '+))) | |
(define (exponentiation? x) | |
(and (pair? x) (eq? (car x) '**))) | |
(define (addend s) (cadr s)) | |
(define (augend s) | |
(if (null? (cdddr s)) |
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 (variable? x) (symbol? x)) | |
(define (same-variable? v1 v2) | |
(and (variable? v1) (variable? v2) (eq? v1 v2))) | |
(define (sum? x) | |
(and (pair? x) (eq? (car x) '+))) | |
(define (exponentiation? x) | |
(and (pair? x) (eq? (car x) '**))) | |
(define (addend s) (cadr s)) | |
(define (augend s) (caddr s)) | |
(define (product? 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
(car ''abracadabra) | |
;quote | |
;Интерпретатор печатает quote ибо это полное название оператора кавычки |