Skip to content

Instantly share code, notes, and snippets.

@rebekah
Created April 23, 2025 08:13
Show Gist options
  • Save rebekah/951980ed88e389ee1e99c5bc9b2b8475 to your computer and use it in GitHub Desktop.
Save rebekah/951980ed88e389ee1e99c5bc9b2b8475 to your computer and use it in GitHub Desktop.
question9
(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