This is my function:
(define (remove-digit digit list)
(cond ((null? list ...))
(( = (car list) digit) (remove-digit digit (cdr list)))
(else (cons (car list) (if (null? list) (cons(remove-digit digit (cdr list))))))is:
and it should do this:
(1 2 4 5 2 5 6) after (remove-digit 2 list) should be (1 4 5 5 6)
but I can’t think what to do when the list becomes null.
Can you please give me a little help or some kind of idea? Thank you very much!
Return an empty list (or the
listitself). It is the base case for your function.To deduce base case easily think about “minimal” case of
remove-digitwith an empty list as a parameter.It should return
'()obviously for anydigitvalue one supplies.