- ;; mht created on Nov 15, 2011
-
-
;; convert-euro : list-of-numbers -> list-of-numbers
-
;; exchange rate is 1.22 euro for each dollar
-
(define (convert-euro a-list-of-nums)
-
(cond
-
[(empty? a-list-of-nums) empty]
-
[else
-
(cons
-
( * 1.22 (first a-list-of-nums))
-
(convert-euro (rest a-list-of-nums)))]))
-
-
;; test
-
(convert-euro (cons 10 (cons 20 empty)))
-
-
;; convert-euro : number list-of-numbers -> list-of-numbers
-
(define (convert-euro-1 rate a-list-of-nums)
-
(cond
-
[(empty? a-list-of-nums) empty]
-
[else
-
(cons
-
( * rate (first a-list-of-nums))
-
(convert-euro-1 1.22 (rest a-list-of-nums)))]))
-
-
;; test
- (convert-euro-1 1.22 (cons 10 (cons 20 empty)))