(require 2htdp/image)
(define serp0
(circle 15 "solid" "green"))
(define (serp d)
(if
(zero? d)
serp0
(above
(serp (sub1 d))
(beside
(serp (sub1 d))
(serp (sub1 d))))))
it will produce as followed:
Personally, the best way to understand the complicated function is to do it again by your own and change some arguments in the function. Here is a classical and complicated example.
(define (k d)
(cond
[(> d 0)
(beside/align
"bottom"
(k (- d 1))
(rotate 60 (k (- d 1)))
(rotate -60 (k (- d 1)))
(k (- d 1)))]
[else (line 5 0 "blue")]))
This week, we will begin to do some programming project. I hope I can share some thoughts with you guys in this blog when I begin to touch the assignment.


No comments:
Post a Comment