Jump to content

Remove the points that are repeated in a list.


Recommended Posts

Posted

Hello. I need get two list:

1º-. I have a list:

(setq lista1 '((10 20) (30 40) (25 63) (78 45) (30 40) (12 36) (25 63) (33 70)))

Remove the points that are repeated in a list.

Result:

lista1-A '((10 20) (30 40) (25 63) (78 45) (12 36) (33 70))

2º-. I have a list:

 
(setq lista2 '((10.05 20.35) (30.48 40.69) (25.74 63.09) (78.42 45.60) (10.03 20.35) (12.72 36.44) (25.78 63.12) (33.22 70.99)))

Remove the points that are repeated in a list (margen of error in the distance between points = 0.10m.)

Result:

lista2-A '((10.05 20.35) (30.48 40.69) (25.74 63.09) (78.42 45.60) (12.72 36.44) (33.22 70.99))

Regards

Posted
(foreach x lista1
 (if (not (member x lst))
   (setq lst (cons x lst))
   )
)
(reverse lst)

Posted

O.K., tharwat. The first case is perfect. For the segond case???

Regards.

Posted
O.K., tharwat. The first case is perfect. For the segond case???

Regards.

 

Your second issue is not that clear to me , more specifications needed . :)

Posted

Thank you very much to two. Lee, your website is very interesting. It's what he wanted. I will give an overview. Thank you very much. A greeting.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...