MU Soapbox

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Muxify
    • Mustard

    One List Entirely In Another List?

    MU Code
    4
    4
    1320
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Thenomain
      Thenomain last edited by Thenomain

      Goddammit, Mux. I want to know if the list '1.3' (%qm) is entirely in the list '1.2.3.4.5' (%qv).

      The best I have so far:
      eq( words( setinter( %qv, %qm, . ), . ), words( %qm, . )

      There has to be a better way.

      “If you wish to make an apple pie from scratch, you must first invent the universe.”
      ― Carl Sagan, Cosmos

      1 Reply Last reply Reply Quote 0
      • I
        Ide last edited by

        Don't think so, you'd have to munge your first list with wildcards to use strmatch and I don't know if that's a gain at all over what you got.

        1 Reply Last reply Reply Quote 0
        • Sponge
          Sponge last edited by Sponge

          strmatch(setinter(%qm,%qv,.),sort(%qm,,.))
          

          Edit: tablet typos

          1 Reply Last reply Reply Quote 0
          • Glitch
            Glitch last edited by

            You could reverse it:

            setdiff(%qm, %qv, .)
            

            If anything returns, it's not a subset, otherwise it is.

            1 Reply Last reply Reply Quote 3
            • 1 / 1
            • First post
              Last post