elem (1,2,3) [(1,2,3)] -> works (true)
elem (1,2,_) [(1,2,3)] -> doesnt work (want it return true as well)
What Im trying to do is if the first two elements of tuple matches one in the list return true.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the prelude function
anyto find out whether at least one element in a list meets a given condition (the condition in this case being “it matches the pattern(1, 2, _)“).An example for this case would be:
Or a bit more concisely: