+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Full Member
    Using
    AutoCAD 2016
    Join Date
    Feb 2016
    Location
    Australia
    Posts
    30

    Default Duplicate in a list

    Registered forum members do not see this ad.

    hi all, i need a function to find duplicate value or text in a list.
    can someone help me??

    thanks in advance.

  2. #2
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2017
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,249

    Default

    Hi,

    Can you give a real example?

  3. #3
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    1,068

    Default

    http://www.cadtutor.net/forum/showth...-items-on-list


    If you scroll down the page of a (any) thread you see 'Similar Threads' ... this should help you in your search


    or :


    http://www.lee-mac.com/uniqueduplicate.html


    gr. Rlx
    Last edited by rlx; 12th Jan 2018 at 09:16 am.

  4. #4
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    900

    Default

    Maybe something as simple as this:
    Code:
    (defun foo (item lst) (vl-remove-if-not '(lambda (x) (equal item x)) lst))
    ;; (foo "1" '("1" "2" "3" "1" "1" "5" "1.0"))

  5. #5
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,478

    Default

    Ron,
    Code:
    _$ (foo "1" '("1" "2" "3" "1" "1" "5" "1.0"))
    ("1" "1" "1")
    If he ment 'duplicate value' then "1.0" should be returned aswell, I think.
    The OP should provide a sample list... and what he expects to be returned.

  6. #6
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    900

    Default

    Agreed .. just a quick example, not full blown solution. My guess is the OP probably want's a fuzz value too for numbers that should be 'equal'.

  7. #7
    Full Member
    Using
    AutoCAD 2016
    Join Date
    Feb 2016
    Location
    Australia
    Posts
    30

    Default

    Thank you all guys, i used lee mac function that rlx introduced.

  8. #8
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Win 7 Pro / Win 10 Pro / Linux Mint
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2018
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,600

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by amir0914 View Post
    Thank you all guys, i used lee mac function that rlx introduced.
    Glad it helped! Thanks for the recommendation rlx
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

Similar Threads

  1. Lisp to list duplicate points
    By Baber62 in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 27th Oct 2015, 10:40 am
  2. duplicate items on list
    By pBe in forum AutoLISP, Visual LISP & DCL
    Replies: 28
    Last Post: 24th Oct 2010, 12:43 pm
  3. Duplicate Items
    By Ells in forum AutoCAD General
    Replies: 3
    Last Post: 27th Jan 2010, 05:24 pm
  4. Duplicate Avatars
    By eldon in forum Feedback
    Replies: 13
    Last Post: 30th Aug 2007, 10:04 pm
  5. Arx Duplicate
    By FIFTHTEXAS in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 26th Jun 2007, 02:15 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts