Created
May 17, 2013 00:27
-
-
Save irneh/5596165 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
#lang racket | |
;#lang web-server/insta | |
;(get-uri (calc g-i (car rings) cogs) (calc g-i (car (cdr rings)) cogs)) | |
(define rings (list 38 50)) | |
(define cogs (list 23 21 19 17 16 15 14 13 12 11)) | |
(define max-x (/ 55 11.0)) | |
(define axis (list 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0)) | |
(define nums->csv | |
(lambda (lat) | |
(cond | |
((null? lat) "") | |
((null? (cdr lat)) (string-append (number->string (car lat)))) | |
(else (string-append (number->string (car lat)) "," (nums->csv (cdr lat))))))) | |
(define cogs-ratios | |
(lambda (a lat) | |
(map (lambda (x) (/ a x)) lat))) | |
(define builder | |
(lambda (a lat) | |
(cond | |
((null? lat) null) | |
(else (cons (/ a (car lat) max-x) (builder a (cdr lat))))))) | |
(define get-uri | |
(lambda () | |
(string-append | |
"http://chart.googleapis.com/chart?cht=lxy&chd=t:" | |
(nums->csv (builder (car rings) cogs)) "|" | |
(nums->csv axis) "|" | |
(nums->csv cogs) "|" | |
(nums->csv axis) "|" | |
"&chs=350x350&chds=0,1&chxt=x,y&chxr=0,0,50|1,32,11"))) | |
(get-uri) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment