Page 1 of 1

Complete this function in Lisp to replace all numbers in a list with a given code, including sublists. (DEFUN HideNumbe

Posted: Mon May 09, 2022 6:59 am
by answerhappygod
Complete this function in Lisp to replace all numbers in a list with a given code, including sublists.

(DEFUN HideNumbers (L Code)
(COND ((NULL L) NIL)
; TBD -- Fill in this block
; Check for a number, an atom, otherwise recurse
)
)

(PRINT (HideNumbers '(1 2 SHOE (3 4 DOOR)) 'X)) returns (X X SHOE (X X DOOR))
(PRINT (HideNumbers '(((3)) (((ABC 5 6)))) 'X)) returns (((X)) (((ABC X X))))