plecs Posted November 8, 2014 Share Posted November 8, 2014 Can someone help me with count list if they are the same I list that I need count list if they are the same Thanks in advance (("123" "0" "0" "Hz" "0" "0" "0" "0" "ac" "0") ("123" "0" "0" "Hz" "0" "0" "0" "0" "ac" "0") ("122" "0" "0" "Hz" "0" "0" "0" "0" "ac" "0") ("122" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("122" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("223" "0" "0" "Hz" "0" "0" "0" "0" "ss" "0") ("223" "0" "0" "Hz" "0" "0" "0" "0" "ss" "0") ("223" "0" "0" "Hz" "0" "0" "0" "0" "ss" "0")) Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted November 8, 2014 Share Posted November 8, 2014 i'm not sure but can try Express tool :acetutil ([color="red"]acet-list-remove-duplicates[/color] '(("123" "0" "0" "Hz" "0" "0" "0" "0" "ac" "0") ("123" "0" "0" "Hz" "0" "0" "0" "0" "ac" "0") ("122" "0" "0" "Hz" "0" "0" "0" "0" "ac" "0") ("122" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("122" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("223" "0" "0" "Hz" "0" "0" "0" "0" "ss" "0") ("223" "0" "0" "Hz" "0" "0" "0" "0" "ss" "0") ("223" "0" "0" "Hz" "0" "0" "0" "0" "ss" "0")) [color="red"]0[/color] ) or For code learning try this could help? Unique&Duplicate Quote Link to comment Share on other sites More sharing options...
plecs Posted November 8, 2014 Author Share Posted November 8, 2014 thank you, goes well but how to count lists are identical Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted November 8, 2014 Share Posted November 8, 2014 thank you,goes well but how to count lists are identical I'm not very clear about identical, Maybe you can try these functions to test the list Vl-remove-if Vl-some Vl-every You can start test (length lst) compare etc.. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 8, 2014 Share Posted November 8, 2014 (setq l '(("123" "0" "0" "Hz" "0" "0" "0" "0" "ac" "0") ("123" "0" "0" "Hz" "0" "0" "0" "0" "ac" "0") ("122" "0" "0" "Hz" "0" "0" "0" "0" "ac" "0") ("122" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("122" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") ("223" "0" "0" "Hz" "0" "0" "0" "0" "ss" "0") ("223" "0" "0" "Hz" "0" "0" "0" "0" "ss" "0") ("223" "0" "0" "Hz" "0" "0" "0" "0" "ss" "0") ) ) (foreach x l (if (setq a (assoc x lst)) (setq lst (subst (cons x (1+ (cdr a))) a lst)) (setq lst (cons (cons x 1) lst)) ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 8, 2014 Share Posted November 8, 2014 how to count lists are identical You can use my Count Items functions from here: _$ (LM:countitems l) ( (("123" "0" "0" "Hz" "0" "0" "0" "0" "ac" "0") . 2) (("122" "0" "0" "Hz" "0" "0" "0" "0" "ac" "0") . 1) (("122" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") . 2) (("12" "0" "0" "Hz" "0" "0" "0" "0" "bb" "0") . 4) (("223" "0" "0" "Hz" "0" "0" "0" "0" "ss" "0") . 3) ) As hanhphuc has kindly recommended: try this could help?Unique&Duplicate Quote Link to comment Share on other sites More sharing options...
plecs Posted November 11, 2014 Author Share Posted November 11, 2014 wow it works thanks a lot Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 11, 2014 Share Posted November 11, 2014 wow it works thanks a lot Which codes you are indicating to ? 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.