sierpinski's triangle images

Racket recursion videos

Some videos to explore recursion --- create Sierpinski's triangle, flatten nested lists, and learn the most natural technique for expressing certain ideas. If redundant function calls become a performance issue, learn how to memoize manually, then automatically.

racket triangle recursion video

Produce this complex, nested fractal using DrRacket and recursion. After you've watched the video, you should be able to:

  • With the video and DrRacket open, type the code as it appears, except change the first definition to:
    		  (define serp0 (circle 15 "solid" "green"))
    		
    Before you run DrRacket, predict what is produced by the following:
    • (serp 0)
    • (serp 1)
    • (serp 2)
    • (serp 3)

racket koch recursion video

Produce this complex jagged curve using DrRacket and recursion. Once you have watched the video, you should be able to:

  • With the video and DrRacket both open, type in the code for koch. Change (rotate 60 ...) and (rotate -60 ...) to (rotate 30 ...) and (rotate -30). Predict what will happen when the following are run:
    • (koch 0)
    • (koch 1)
    • (koch 2)
    • (koch 3)
  • What about other angles?

racket koch2 recursion video

racket flatten recursion video

racket manual memoization with recursion

racket automatic memoization with recursion


Danny Heap
Last modified: Thu Dec 8 21:46:03 EST 2016