TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Andrea on August 05, 2005, 09:41:29 AM
-
what is the shorter way to do this...
I have a list...
(setq list1(list "item1" "item1" "item4" "item1" "item4" "item5" "item5" "item8"))
(setq list2(list "item1a" "item1a" "item4a" "item1a" "item4b" "item5b" "item5b" "item8a"))
now I need to know, how many item of each I have...
eg:
3 item1 for item1a
1 item4 for item4a
1 item4 for item4b
2 item5 for item5b
1 item8 for item8a
see ?
for the moment, i have made a (foreach.. and appen each same item in a list...and export all this to a temporary txt file
but not sure if there is a function doing that..
thanks.
-
(setq lst1 (list ("item1" "item1" "item4" "item1" "item4" "item5" "item5" "item8")))
(length lst1)
returns: 8
Moving thread to proper forum.
-
(setq lst1 (list ("item1" "item1" "item4" "item1" "item4" "item5" "item5" "item8")))
(length lst1)
returns: 8
Moving thread to proper forum.
thanks Daron....I know that...but need to specify...
how many item of each I have
-
If I understand you right, you first want to compare every nth member of list1 with the nth member of list2. Every different combination is counted seperately.
A temporary txt file seems slow to me. Why not keep the result in memory?
I can imagine that you want a result like:
'((3 . "item1")(1 . "item4")(1 . "item4")(2 . "item5")(1 . "item8"))
-
Crank,
Yes this is good..
don't use nth very often...
but thanks..
In fact i allready created mine, without exporting to a txt file but allow user to do-it.
:wink: