Name: Anonymous 2013-02-12 17:57
How do you do this shit /prog/?
Write a Scheme function update-info that consumes an info structure (called data, in which all field
values are numbers), and a nonnegative number (called upper-bound). The function produces the number of
fields in data which are negative or are strictly greater than upper-bound. In addition, all fields of data
which are negative are replaced with 0, and all fields of data that are greater than upper-bound are replaced
with upper-bound. Use field mutation operations to update data – you may not create any new info
structures in update-info. For example,
Write a Scheme function update-info that consumes an info structure (called data, in which all field
values are numbers), and a nonnegative number (called upper-bound). The function produces the number of
fields in data which are negative or are strictly greater than upper-bound. In addition, all fields of data
which are negative are replaced with 0, and all fields of data that are greater than upper-bound are replaced
with upper-bound. Use field mutation operations to update data – you may not create any new info
structures in update-info. For example,
(define d (make-info 11 9 -7))
(update-info d 10)
2
d
(make-info 10 9 0)