This code works:
(define list-of-events
(for/list ([(date code)
(in-query odc "select date, code from attendance
where student_id = ? and term_code = ?"
"12345" "654321")])
(make-attendance-event date code)))
However, when I try to duplicate the behavior for another table, the parallel item to make-attendance-event complains about it being an "unbound identifier".
Now, where does make-attendance-event come from?
The identifier make-attendance-event came from a (define-struct attendance-event (...)).
A structure definition such as
(define-struct foo (a b))
will expand into multiple definitions.
In the Advanced language you also get:
See more here: http://docs.racket-lang.org/htdp-langs/advanced.html?q=define-struct#%28form._%28%28lib._lang%2Fhtdp-advanced..rkt%29._define-struct%29%29
Note that you can hover over the identifier make-attendance-event in DrRacket, right click and choose "Jump to Binding Occurrence" to see where an identifier is defined.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With