reza Posted October 22, 2022 Share Posted October 22, 2022 HI everyone I have this list: ((0.0 70.8187) (0.0 -119.977) (61.875 44.4858)) or ((88.21 0.0) (19.80 0.0) (61.875 44.4858)) I want remove all member if x=0 or y=0 then remove members of list==> ((61.875 44.4858)) Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted October 22, 2022 Share Posted October 22, 2022 With that I want to remove, you pretty much don't need computer or state of mind... Quote Link to comment Share on other sites More sharing options...
reza Posted October 22, 2022 Author Share Posted October 22, 2022 dear marko: It is possible to say what you mean more clearly. Unfortunately, I did not understand what you mean. Quote Link to comment Share on other sites More sharing options...
Jonathan Handojo Posted October 22, 2022 Share Posted October 22, 2022 (defun foo (lst) (vl-remove-if '(lambda (x) (or (zerop (car x)) (zerop (cadr x)))) lst) ) 1 1 Quote Link to comment Share on other sites More sharing options...
reza Posted October 22, 2022 Author Share Posted October 22, 2022 Hi Jonathan Handojo: thx for reply I used your advice and my problem was solved. thanks again. Quote Link to comment Share on other sites More sharing options...
reza Posted October 22, 2022 Author Share Posted October 22, 2022 Dear Jonathan: thanks a lot again. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 22, 2022 Share Posted October 22, 2022 Given that we're working with reals, I would suggest the use of the equal function with an appropriate tolerance - I would reserve zerop for when testing integer values. Hence: (vl-remove-if '(lambda ( x ) (or (equal (car x) 0.0 1e-8) (equal (cadr x) 0.0 1e-8))) lst) Or, for any coordinate: (vl-remove-if '(lambda ( x ) (vl-some '(lambda ( y ) (equal y 0.0 1e-8)) x)) lst) 2 1 Quote Link to comment Share on other sites More sharing options...
Jonathan Handojo Posted October 22, 2022 Share Posted October 22, 2022 3 hours ago, reza said: Dear Jonathan: thanks a lot again. No worries. Glad to help. However, I do agree with what Lee mentioned. His function should be slightly more bulletproof than mine. Quote Link to comment Share on other sites More sharing options...
reza Posted October 23, 2022 Author Share Posted October 23, 2022 HI Everyone: Thx Lee Mac for reply and attention Thx Jonathan Quote Link to comment Share on other sites More sharing options...
troggarf Posted December 16, 2022 Share Posted December 16, 2022 (edited) On 10/21/2022 at 11:37 PM, marko_ribar said: With that I want to remove, you pretty much don't need computer or state of mind... Deleted Edited January 12, 2023 by troggarf Quote Link to comment Share on other sites More sharing options...
reza Posted December 18, 2022 Author Share Posted December 18, 2022 Dear troggarf: I'm sorry that I paid attention to your reply so late. I have used the advice of experts like you and dear Marko many times in different forums. I think it's my fault that I bore Marco with very simple questions. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.