- For a concise guide to lists and recursion, see Beautiful Racket on Lists
Squaring the Circle.
- Prerequisites
- running
Follow steps 2-5 of the Quick Tutorial
Figure out how to have a default argument of 10 to
square
, i.e.(square)
should be equivalent to(square 10)
Functions as values
Complete
Part 6 of the Quick Tutorial
because the function series
defined there was used in part 7.
Let's try and reduce the repeated code in this definition.
(define (series mk)
(hc-append 4 (mk 5) (mk 10) (mk 20)))
Initial attempt fails. What to add?
(define (series2 mk)
(hc-append 4 (map mk '(5 10 20))))
This really starts to pay off with more repetition
(define (series3 mk)
(apply hc-append 1 (build-list 100 mk)))
Functions, Scope, and Lists
- Follow steps 7-9 of the Quick Tutorial
Macros
Complete Part 10 of the Quick Tutorial
There is more detail on this topic in macros