Skip to content

Instantly share code, notes, and snippets.

@astynax
Created September 14, 2018 11:28
Show Gist options
  • Save astynax/9b574ef3e6ef929808b5aaebed6f96b5 to your computer and use it in GitHub Desktop.
Save astynax/9b574ef3e6ef929808b5aaebed6f96b5 to your computer and use it in GitHub Desktop.
#lang racket
(require 2htdp/image)
(define (dot s)
(lambda (a)
(underlay
(circle (/ s 4) 'solid 'gray)
(square s (truncate a) 'black))))
(define (sq2x2 i)
(lambda (s)
(lambda (a)
(let ((ii (i (/ s 2))))
(above (beside (ii a) (ii (* 0.9 a)))
(beside (ii (* 0.7 a)) (ii (* 0.8 a))))))))
(define (step i)
(lambda (s)
(lambda (a)
(let* ([i2 (sq2x2 i)]
[i4 (sq2x2 i2)]
[i8 (sq2x2 i4)])
(above (beside ((i s) a) ((i2 s) a))
(beside ((i8 s) a) ((i4 s) a)))))))
(((step (step dot)) 200) 255)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment