I would like to know how i can determine if two elements in a list exist. For example the setup would look like this:

liste = {"b", "d1", "a","z"}
MemberQ[{{"b", "a"}}, liste]

One problem i have is that it should not depend on the order of the two element, i.e. {"b", "a"} == {"a", "b"} that i want to check. I just want to know if these exist in a given list.

  • 8
    $\begingroup$ Hello, have a look at the documentation for ContainsAll , cheers! $\endgroup$ Nov 16 '21 at 19:57
  • $\begingroup$ Intersection can do this: Intersection[liste, {"b", "a"}] != {} $\endgroup$ Nov 17 '21 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.