Last active
April 23, 2025 08:20
-
-
Save rebekah/8d392f49f6c36f8e562e52e42fe9fe48 to your computer and use it in GitHub Desktop.
question8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (substitute s old new) | |
(define (helper val) | |
(define (final-val val old-val new-val) | |
(if (eq? val old-val) | |
new-val | |
val | |
) | |
) | |
(if (list? val) | |
(map helper val) | |
(final-val val old new) | |
) | |
) | |
(map helper s) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment