Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to compare two list of elements in lisp without eq, equal, equalp, eql?

What I have tried:

Using macro or simple function
Posted
Updated 1-Jul-20 6:19am
Comments
Matt T Heffron 8-Jun-16 14:20pm    
This question doesn't quite make sense.
To compare requires some kind of comparison operation.
If you can't use any of the "eq"-type operations, how do you expect to compare the elements of the lists?
For numbers you could subtract and use (zerop ...), but that's an obvious HACK!
Is your question about how to walk the lists "in parallel"? How to structure the overall comparison? Looping vs. recursion vs. some of both?
Use the "Improve question" to clarify what you are really trying to solve.
(Since comparison of lists is already available in lisp, this looks like a homework assignment type of question.)

1 solution

in Autolisp
(vl-remove-if-not '(lambda (x) (member x list2)) list1)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900