For
Looping constructs in Racket.
All of these are Google Docs.
- Presentation on For, includes information and some exercises.
- For Loop Exercises 1
- For Loop Exercises 2
- Learning for/fold
Intermediate Student Mode
You can access the “for” command inside Intermediate Student Mode by using (require racket/base)
.
We used racket/base to get access to the “for” command. Unfortunately,
this takes away some of the nice things that picturing-programs
does. If you do something like (make-bubble (make-posn 10 20) "red" 30)
and see an output like (make-bubble …)
, without being able to see
specific information in the place of the dots, then you need to read
on.
In order for you to be able to see inside your structure in the Racket language, you need to tell Racket to make it “transparent”. You do that by adding a keyword, like this:
(define-struct person (name grade) #:transparent)
That takes care of the problem. No more changes are necessary.
Last modified August 24, 2021: intermediate cs and initial hugo changeover (1784229)