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
| ;#lang planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (lookup key bt-data) | |
| (cond ((empty? bt-data) false) | |
| ((> key (key-of-root bt-data)) (lookup key (right-branch bt-data))) | |
| ((= key (key-of-root bt-data)) (entry-of-root bt-data)) | |
| ((< key (key-of-root bt-data)) (lookup key (left-branch bt-data))))) |
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
| ;#lang planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (make-code-tree left right) | |
| (list left | |
| right | |
| (append (symbols left) (symbols right)) | |
| (+ (weight left) (weight right)))) |
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
| ;#lang planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (make-leaf symbol weight) | |
| (list 'leaf symbol weight)) | |
| (define (leaf? obj) |
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
| ;#lang planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (make-leaf symbol weight) | |
| (list 'leaf symbol weight)) | |
| (define (leaf? obj) |
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
| ;#lang planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (make-leaf symbol weight) | |
| (list 'leaf symbol weight)) | |
| (define (leaf? obj) |
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
| ;#lang planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (make-leaf symbol weight) | |
| (list 'leaf symbol weight)) | |
| (define (leaf? obj) |
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
| ;#lang planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (make-leaf symbol weight) | |
| (list 'leaf symbol weight)) | |
| (define (leaf? obj) |
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
| ;#lang planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (deriv exp var) | |
| (cond ((number? exp) 0) | |
| ((variable? exp) (if (same-variable? exp var) 1 0)) | |
| (else ((get 'deriv (operator exp)) (operands exp) var)))) | |
| (define (operator exp) (car exp)) |
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
| ;#lang planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| (define (deriv exp var) | |
| (cond ((number? exp) 0) | |
| ((variable? exp) (if (same-variable? exp var) 1 0)) | |
| (else ((get 'deriv (operator exp)) (operands exp) var)))) | |
| (define (operator exp) (car exp)) |
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
| ;#lang planet neil/sicp | |
| #lang racket | |
| (require (planet soegaard/sicp:2:1/sicp)) | |
| (define wave einstein) | |
| ;; how division's file should structured | |
| ;;a '((name1 . rest-of-record) (name2 . rest-of-record) ...) | |
| (define (get-record name file) | |
| (define (read-file-as-list file) | |
| ;; 没有io操作的具体信息, 先这样 |