Results 1 to 4 of 4

Thread: compare two lists

  1. #1
    jayasree Guest

    compare two lists

    i got two lists which has the insertion point and the end point

    ex ins_pt (-3.5432 4.5678)
    end_pt (-3.5432 4.5678)

    When i use (equal ins_pt end_pt) it returns nil.

    Is there any other way to compare both lists and return T.

    Thanks,
    Jayasree

  2. #2
    Join Date
    Jul 2005
    Posts
    31
    Hi jayasree,test it
    Code:
    (setq ex_ins_pt '(-3.5432 4.5678))
    (setq end_pt '(-3.5432 4.5678))
    (if
      (equal ex_ins_pt end_pt 0.0001)
      (princ "\nThat right,it's same value")
      (princ "\nThat wrong,it's not same value")
      )
    Quote Originally Posted by jayasree
    i got two lists which has the insertion point and the end point

    ex ins_pt (-3.5432 4.5678)
    end_pt (-3.5432 4.5678)

    When i use (equal ins_pt end_pt) it returns nil.

    Is there any other way to compare both lists and return T.

    Thanks,
    Jayasree

  3. #3
    Join Date
    Sep 2005
    Posts
    121
    If your points are calculated, you may think they're equal but they may differ in the 16th decimal point. You may want to use a fuzz factor, as in (equal PtA PtB 0.0000001)

  4. #4
    mguzik@nospamlawson-fishe Guest
    If my memory is correct equal is used for comparing list and eq for
    variables.

    So using the two points above in the following will yield true:

    (setq ins_pt '(-3.5432 4.5678)
    end_pt '(-3.5432 4.5678))
    (if (equal ins_pt end_pt)
    (princ "\nThey are equal ")
    (princ "\nThey are not equal")
    )
    (princ)

    Also try with two lists that are not exactly the same with the optional
    fuzz input variable of equal:

    (setq ins_pt '(-3.5432 4.567)
    end_pt '(-3.5432 4.566))
    (if (equal ins_pt end_pt 0.005)
    (princ "\nThey are equal ")
    (princ "\nThey are not equal")
    )

    Hope this helps comparing lists

Similar Threads

  1. Drawing Lists
    By CADmanCol in forum Drafting
    Replies: 0
    Last Post: 01-09-2012, 01:08 AM
  2. Trouble searching lists...
    By Ray Schiska in forum Customization
    Replies: 7
    Last Post: 12-10-2005, 02:18 PM
  3. compare 2 configuration
    By sssjonnie in forum SolidWorks
    Replies: 5
    Last Post: 11-16-2005, 01:10 PM
  4. Replies: 1
    Last Post: 09-22-2005, 01:10 PM
  5. Replies: 20
    Last Post: 10-18-2004, 04:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other forums: Access Forum - Microsoft Office Forum - Exchange Server Forum