Skip to content

Instantly share code, notes, and snippets.

@bunyk
Created December 17, 2013 00:28
Show Gist options
  • Save bunyk/7997787 to your computer and use it in GitHub Desktop.
Save bunyk/7997787 to your computer and use it in GitHub Desktop.
Don't beet me too hard.
; while loop
(define (while condition body)
(if (condition)
(begin
(body)
(while condition body)
)
(list)
)
)
; for loop
(define (for setup condition increment body)
(begin
(setup)
(while condition
(lambda () (begin
(body)
(increment)
))
)
)
)
; importing turtle functions
(define turtle (import (quote turtle)))
(define forward (getattr turtle (quote forward)))
(define right (getattr turtle (quote right)))
(define (pentagram size)
(begin
(define i 0)
(for
(lambda () (set! i 0))
(lambda () (< i 5))
(lambda () (set! i (+ i 1)))
(lambda () (begin
(forward size)
(right (- 180 36))
))
)
)
)
(pentagram 100)
(forward 100)
(pentagram 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment