Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

Students also viewed these Databases questions