TCL compare 2 lists for any matches?

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf TCL compare 2 lists for any matches?

  • Creator
    Topic
  • #54665
    Mike Wilson
    Participant

      Can anyone point me in the right direction.  I am looking to see if any element in LISTA matches ANY element in LISTB.  How would this be accomplished?  Thanks!

    Viewing 1 reply thread
    • Author
      Replies
      • #82492
        James Cobane
        Participant

          Mike,

          Take a look at the ‘intersect’ or ‘intersect3’ commands.

          Thanks,

          Jim Cobane

          Henry Ford Health

        • #82493
          Mike Wilson
          Participant

            James Cobane wrote:

            Mike,

            Take a look at the ‘intersect’ or ‘intersect3’ commands.

            Thanks,

            Jim Cobane

            Henry Ford Health

            Ok, here is what I came up with. As long as something in the lists matches I pass the message.  Is there a more efficient way to do this?

            set LISTA { 1 2 3}

            set LISTB { 3 4 5}

            set MATCHES [intersect $LISTA $LISTB]

            if {([llength $MATCHES]) > 0}

                continue

            else

                kill

            Thanks for all the help.

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.