Jump to content

need help with count list if list mach


plecs

Recommended Posts

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"))

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

(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))
 )
)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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...