Created
February 22, 2012 14:37
-
-
Save falsetru/1885373 to your computer and use it in GitHub Desktop.
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 H 300) | |
(define r (/ H 2)) | |
(define (ypos x) | |
(if (<= x 1) | |
(/ (sqrt (- 1 (sqr (- (* 2 x) 1)))) 2) | |
(/ (sqrt (- 1 (sqr (- (* 2 x) 3)))) -2))) | |
(define (ypos-as-posn x) | |
(make-posn (* x r) | |
(* (+ 1 (ypos x)) r))) | |
(define (div-by n) | |
(lambda (x) (/ x n))) | |
(define (range start stop) | |
(if (<= start stop) | |
(cons start (range (+ 1 start) stop)) | |
(list))) | |
(define (do-pairwise action lst) | |
(if (>= (length lst) 2) | |
(begin (action (car lst) (cadr lst)) | |
(do-pairwise action (cdr lst))) | |
'done)) | |
(start H H) | |
(draw-circle (make-posn r r) r 'black) | |
(do-pairwise (lambda (a b) (draw-solid-line a b 'black)) | |
(map ypos-as-posn | |
(map (div-by r) (range 0 H)))) | |
(draw-solid-string (make-posn (* r 0.3) r) "EVAL") | |
(draw-solid-string (make-posn (* r 1.3) r) "APPLY") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment