(use doodle) (define cities (with-input-from-file "staedte.sexpr" read)) (define coord second) (define get-x first) (define get-y second) (define-constant +width+ 680) (define-constant +height+ 460) (define blue (list 0 0 1 1)) (new-doodle background: solid-white) (define min-x (fold (lambda (c s) (min s (get-x (coord c)))) most-positive-fixnum cities)) (define max-x (fold (lambda (c s) (max s (get-x (coord c)))) 0 cities)) (define min-y (fold (lambda (c s) (min s (get-y (coord c)))) most-positive-fixnum cities)) (define max-y (fold (lambda (c s) (max s (get-y (coord c)))) 0 cities)) (define (scale val min max mapped-min mapped-max) (* (+ mapped-min (- mapped-max mapped-min)) (/ (- val min) (- max min)))) (print "min-x: " min-x ", max-x: " max-x ", min-y: " min-y ", max-y: " max-y) (for-each (lambda (c) (let* ((xy (coord c)) (x (get-x xy)) (y (get-y xy)) (scaled-x (scale x min-x max-x +width+ +height+)) (scaled-y (scale y min-y max-y +width+ +height+))) (circle scaled-x (- +height+ scaled-y) 1 blue))) cities) (show!) (save-screenshot "germany.png") ; See http://pestilenz.org/~ckeen/germany.png