Skip to content

Commit

Permalink
add new
Browse files Browse the repository at this point in the history
  • Loading branch information
green-93-nope committed May 21, 2017
1 parent 0755b59 commit 59241b6
Show file tree
Hide file tree
Showing 170 changed files with 11,051 additions and 30 deletions.
29 changes: 0 additions & 29 deletions #371.scm#

This file was deleted.

Empty file modified 116.scm
100644 → 100755
Empty file.
Empty file modified 129.scm
100644 → 100755
Empty file.
Empty file modified 130.scm
100644 → 100755
Empty file.
Empty file modified 131.scm
100644 → 100755
Empty file.
Empty file modified 132.scm
100644 → 100755
Empty file.
Empty file modified 133.scm
100644 → 100755
Empty file.
Empty file modified 217.scm
100644 → 100755
Empty file.
Empty file modified 218.scm
100644 → 100755
Empty file.
Empty file modified 220.scm
100644 → 100755
Empty file.
Empty file modified 221.scm
100644 → 100755
Empty file.
Empty file modified 223.scm
100644 → 100755
Empty file.
Empty file modified 224.scm
100644 → 100755
Empty file.
Empty file modified 227.scm
100644 → 100755
Empty file.
Empty file modified 228.scm
100644 → 100755
Empty file.
Empty file modified 229.scm
100644 → 100755
Empty file.
Empty file modified 230.scm
100644 → 100755
Empty file.
Empty file modified 232.scm
100644 → 100755
Empty file.
Empty file modified 233.scm
100644 → 100755
Empty file.
Empty file modified 234.scm
100644 → 100755
Empty file.
Empty file modified 235.scm
100644 → 100755
Empty file.
Empty file modified 236.scm
100644 → 100755
Empty file.
Empty file modified 237.scm
100644 → 100755
Empty file.
Empty file modified 238.scm
100644 → 100755
Empty file.
Empty file modified 239.scm
100644 → 100755
Empty file.
Empty file modified 240.scm
100644 → 100755
Empty file.
Empty file modified 241.scm
100644 → 100755
Empty file.
Empty file modified 242.scm
100644 → 100755
Empty file.
Empty file modified 256.scm
100644 → 100755
Empty file.
Empty file modified 257.scm
100644 → 100755
Empty file.
Empty file modified 258.scm
100644 → 100755
Empty file.
Empty file modified 259.scm
100644 → 100755
Empty file.
Empty file modified 260.scm
100644 → 100755
Empty file.
Empty file modified 261.scm
100644 → 100755
Empty file.
Empty file modified 262.scm
100644 → 100755
Empty file.
Empty file modified 263.scm
100644 → 100755
Empty file.
Empty file modified 264.scm
100644 → 100755
Empty file.
Empty file modified 265.scm
100644 → 100755
Empty file.
Empty file modified 266.scm
100644 → 100755
Empty file.
Empty file modified 267.scm
100644 → 100755
Empty file.
Empty file modified 268.scm
100644 → 100755
Empty file.
Empty file modified 269.scm
100644 → 100755
Empty file.
Empty file modified 270.scm
100644 → 100755
Empty file.
Empty file modified 273.scm
100644 → 100755
Empty file.
Empty file modified 275.scm
100644 → 100755
Empty file.
Empty file modified 277.scm
100644 → 100755
Empty file.
Empty file modified 278.scm
100644 → 100755
Empty file.
Empty file modified 279.scm
100644 → 100755
Empty file.
Empty file modified 280.scm
100644 → 100755
Empty file.
Empty file modified 281.scm
100644 → 100755
Empty file.
Empty file modified 282.scm
100644 → 100755
Empty file.
Empty file modified 31.scm
100644 → 100755
Empty file.
Empty file modified 312.scm
100644 → 100755
Empty file.
Empty file modified 313.scm
100644 → 100755
Empty file.
Empty file modified 314.scm
100644 → 100755
Empty file.
Empty file modified 316.scm
100644 → 100755
Empty file.
Empty file modified 317.scm
100644 → 100755
Empty file.
Empty file modified 318.scm
100644 → 100755
Empty file.
Empty file modified 319.scm
100644 → 100755
Empty file.
Empty file modified 32.scm
100644 → 100755
Empty file.
Empty file modified 321.scm
100644 → 100755
Empty file.
Empty file modified 322.scm
100644 → 100755
Empty file.
Empty file modified 323.scm
100644 → 100755
Empty file.
Empty file modified 324.scm
100644 → 100755
Empty file.
Empty file modified 325.scm
100644 → 100755
Empty file.
Empty file modified 326.scm
100644 → 100755
Empty file.
Empty file modified 326_compare.scm
100644 → 100755
Empty file.
Empty file modified 327.scm
100644 → 100755
Empty file.
Empty file modified 328.scm
100644 → 100755
Empty file.
Empty file modified 329.scm
100644 → 100755
Empty file.
Empty file modified 33.scm
100644 → 100755
Empty file.
Empty file modified 330.scm
100644 → 100755
Empty file.
Empty file modified 333.scm
100644 → 100755
Empty file.
Empty file modified 334.scm
100644 → 100755
Empty file.
Empty file modified 337.scm
100644 → 100755
Empty file.
Empty file modified 34.scm
100644 → 100755
Empty file.
Empty file modified 347.scm
100644 → 100755
Empty file.
Empty file modified 348.scm
100644 → 100755
Empty file.
Empty file modified 35.scm
100644 → 100755
Empty file.
Empty file modified 350.scm
100644 → 100755
Empty file.
Empty file modified 351.scm
100644 → 100755
Empty file.
Empty file modified 352.scm
100644 → 100755
Empty file.
Empty file modified 353.scm
100644 → 100755
Empty file.
Empty file modified 354.scm
100644 → 100755
Empty file.
Empty file modified 355.scm
100644 → 100755
Empty file.
Empty file modified 356.scm
100644 → 100755
Empty file.
Empty file modified 358.scm
100644 → 100755
Empty file.
Empty file modified 359.scm
100644 → 100755
Empty file.
Empty file modified 36.scm
100644 → 100755
Empty file.
Empty file modified 360.scm
100644 → 100755
Empty file.
Empty file modified 361.scm
100644 → 100755
Empty file.
Empty file modified 362.scm
100644 → 100755
Empty file.
Empty file modified 363.scm
100644 → 100755
Empty file.
Empty file modified 364.scm
100644 → 100755
Empty file.
Empty file modified 365.scm
100644 → 100755
Empty file.
Empty file modified 369.scm
100644 → 100755
Empty file.
Empty file modified 37.scm
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions 370.scm
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 20,7 @@
(stream-cdr s2)
weight)))))))

;; i <= j, and assume the first member of s1 and s2 is equal
(define (weighted-pairs s1 s2 weight)
(cons-stream (list (stream-car s1) (stream-car s2))
(merge-weighted (stream-map (lambda (x) (list (stream-car s1) x))
Expand Down
8 changes: 8 additions & 0 deletions 371.scm
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 1,7 @@
(load "354.scm")
(load "370.scm")
(load "ch351.scm")

(define (weight-sr pair)
( (cube (car pair))
(cube (cadr pair))))
Expand Down Expand Up @@ -26,3 30,7 @@
#f))))
(stream-filter equal-stream-formal
stream-pairs-cube)))

(define Ramanujan
(stream-map (lambda (pair) (weight-sr pair))
pairs-sr))
18 changes: 18 additions & 0 deletions 372.scm
Original file line number Diff line number Diff line change
@@ -0,0 1,18 @@
(load "354.scm")
(load "370.scm")
(load "ch351.scm")

(define (square x) (* x x))
(define (sum-square x) ( (square (car x)) (square (cadr x))))
(define (squaresn s)
(define (stream-cadr s) (stream-car (stream-cdr s)))
(define (stream-caddr s) (stream-cadr (stream-cdr s)))
(let ((scar (stream-car s))
(scadr (stream-cadr s))
(scaddr (stream-caddr s)))
(if (= (sum-square scar) (sum-square scadr) (sum-square scaddr))
(cons-stream (list (sum-square scar) scar scadr scaddr)
(squaresn (stream-cdr (stream-cdr (stream-cdr s)))))
(squaresn (stream-cdr s)))))
(define square-numbers
(squaresn (weighted-pairs integers integers sum-square)))
2 changes: 1 addition & 1 deletion 373.scm
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
(define (integral integrand initial-value dt)
o(define (integral integrand initial-value dt)
(define int
(cons-stream initial-value
(add-streams (scale-stream integrand dt)
Expand Down
Empty file modified 38.scm
100644 → 100755
Empty file.
13 changes: 13 additions & 0 deletions 41.scm
Original file line number Diff line number Diff line change
@@ -0,0 1,13 @@
(define (list-of-values exps env)
(if (no-operands? exps)
'()
(let ((first (eval (first-operand exps) env)))
(cons first
(list-of-values (rest-operands exps) env)))))

(define (list-of-values exps env)
(if (no-operands? exps)
'()
(let ((rest (list-of-values (rest-operands exps) env)))
(cons (eval (first-operand exps) env)
rest))))
7 changes: 7 additions & 0 deletions 411.scm
Original file line number Diff line number Diff line change
@@ -0,0 1,7 @@
(define (make-frame variables values)
(map cons variables values))
(define (frame-variables frame) (map car frame))
(define (frame-values frame) (map cdr frame))
(define (add-binding-to-frame! var val frame)
(cons (cons var val)
frame))
32 changes: 32 additions & 0 deletions 412.scm
Original file line number Diff line number Diff line change
@@ -0,0 1,32 @@
(define (lookup-variable-in-environment var env)
(if (eq? env the-empty-environment)
false
(let ((result (lookup-variable-in-frame var (first-frame env))))
(if (true? result)
result
(lookup-variable-in-frame var (enclosing-environment env))))))

(define (lookup-variable-in-frame var frame)
(define (scan-in-frame vars vals)
(cond ((null? vars) false)
((eq? var (car vars)) vals)
(else (scan-in-frame (cdr vars) (cdr vals)))))
(scan-in-frame (frame-variables frame) (frame-values frame)))

(define (lookup-variable-value var env)
(let ((pos (lookup-variable-in-environment var env)))
(if pos
(car pos)
(error "Unbound variable" var))))
(define (set-variable-value! var val env)
(let ((pos (lookup-variable-in-environment var env)))
(if pos
(set-car! vals val)
(error "Unbound variable --SET!" var))))

(define (define-variable! var val env)
(let ((first (first-frame env))
(pos (lookup-variable-in-frame var first)))
(if pos
(set-car! vals val)
(add-binding-to-frame! var val first))))
Loading

0 comments on commit 59241b6

Please sign in to comment.