This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
cs330_f2016:racketlists [2018/09/11 16:23] morse |
cs330_f2016:racketlists [2018/09/13 21:34] morse |
||
---|---|---|---|
Line 58: | Line 58: | ||
For example, ''(convert (list 1 2 3))'' should return the number 321. | For example, ''(convert (list 1 2 3))'' should return the number 321. | ||
+ | |||
+ | For your own learning, try not to write this using ''string->number''. In fact, don't use strings at all--try to do the calculation mathematically. For semesters after F18, this will not be allowed. | ||
=== duple === | === duple === | ||
Line 73: | Line 75: | ||
(define (average lst) ...) | (define (average lst) ...) | ||
</code> | </code> | ||
- | where ''lst'' is a list of numbers, and the result is the average of these numbers. | + | where ''lst'' is a non-empty list of numbers, and the result is the average of these numbers. |
For example, ''(average (list 1 2 3 4))'' returns 5/2. | For example, ''(average (list 1 2 3 4))'' returns 5/2. |