Design the following functions:
;; characters-in : Sos -> Number
;; characters-in-loss : Loss -> Number
;; RETURNS: the total number of characters in the strings
;; EXAMPLE/TEST:
(begin-for-test
(check-equal?
(characters-in
(list "alice"
(list (list "alice" "bob") "carole")
"dave"))
23)
;; subst : Sos String String -> Sos
;; GIVEN: a Sos and two strings, old and new
;; RETURNS: a sos just like the given one, except that
;; all instances of old are changed to new.
;; EXAMPLE/TEST:
(begin-for-test
(check-equal?
(subst
(list "alice"
(list (list "alice" "bob") "dave")
"eve"
"bob")
"bob"
"ted")
(list "alice"
(list (list "alice" "ted") "dave")
"eve"
"ted")))
Last modified: Thu Aug 21 22:26:27 Eastern Daylight Time 2014