Answered step by step
Verified Expert Solution
Question
1 Approved Answer
It's a LISP Programming problem please help me! I need to make remove-2nd function! The result must be like this!! (remove-2nd a (b a n
It's a LISP Programming problem please help me!
I need to make remove-2nd function!
The result must be like this!!
(remove-2nd a (b a n a n a)) => (b a n n a)
(remove-2nd a (b (a n) a n a) => (b (a n) a n)
(remove-2nd (1 2) (1 2 (1 2) 3)) => (1 2 (1 2) 3)
i made the code like this...
(defun remove2nd (x y) (if (null y) '() (if(eq x (car y)) (setq mycount (+ mycount 1)) (if(eq mycount 2) (remove2nd x (cdr y)) (cons(car y) (remove2nd x (cdr y)))) (cons(car y) (remove2nd x (cdr y))))))
But it doesn't work.... help me
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started