Created
April 23, 2025 08:13
-
-
Save rebekah/951980ed88e389ee1e99c5bc9b2b8475 to your computer and use it in GitHub Desktop.
question9
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 (sub-all s olds news) | |
(define (helper val) | |
(define (final-val val old-vals new-vals) | |
(if (null? old-vals) | |
val | |
(if (eq? val (car old-vals)) | |
(car new-vals) | |
(final-val val (cdr old-vals) (cdr new-vals)) | |
) | |
) | |
) | |
(if (list? val) | |
(map helper val) | |
(final-val val olds news) | |
) | |
) | |
(map helper s) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment