Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7699201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:25:23+00:00 2026-05-31T22:25:23+00:00

Here’s a simplified version of the 3 data sets I have: Set A =

  • 0

Here’s a simplified version of the 3 data sets I have:

Set A = [1, 1, 2, 2, 1, 2, 2, 1]
Set B = [2, 2, 1, 2, 2, 1, 1, 3]
Set C = [8, 4, 4, 4, 4, 9, 8, 4]

Does Haskell have any built in features for finding unspecified patterns between data sets? I’d like to run my program over 2 or more data sets, and have it report back which ones are similar, which, in this case, would be sets A and B.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:25:24+00:00Added an answer on May 31, 2026 at 10:25 pm

    If you are not talking about finding consequent intersection.

    For each 2 lists we can use intersect function from Data.List, which takes intersection of them.

    So, idea is to calculate intersection of all list and sort them.

    > snd . last . sort $ [ (length $ intersect x y, (x,y)) | let list = [[1,1,2,2,1,2,2,1],[2,2,1,2,2,1,1,3],[8,4,4,4,4,9,8,4]], x <- list, y <- list, x /= y ]
    ([1,1,2,2,1,2,2,1],[2,2,1,2,2,1,1,3])
    

    If you are interested in founding the consequent intersection, you can use something like that:

    import Data.List (sort, subsequences)
    
    intersectCons :: (Ord a) => [a] -> [a] -> [a]
    intersectCons x y = snd . last . sort $
      [ (length x1, x1) | x1 <- subsequences x
                        , x2 <- subsequences y
                        , x1 == x2 ]
    

    For example:

    > intersectCons [1, 1, 2, 2, 1, 2, 2, 1] [2, 2, 1, 2, 2, 1, 1, 3]
    [2,2,1,2,2,1]
    

    Also we can use it for finding most similar pair of lists:

    > snd . last . sort $ [ (length $ intersectCons x y, (x,y)) | let list = [[1,1,2,2,1,2,2,1],[2,2,1,2,2,1,1,3],[8,4,4,4,4,9,8,4]], x <- list, y <- list, x /= y ]
    ([2,2,1,2,2,1,1,3],[1,1,2,2,1,2,2,1])
    

    Actually, if you want to get not only one pair of lists, but all pairs that are “similar”, you can remove snd . last . sort $ and get all of them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my simplified data structure: Object1.h template <class T> class Object1 { private:
Here's my proposed (very simplified to illustrate the problem space) design for a C#
Here is a complete example. I want to forbid using A::set from objects casted
Here's the method. I want to know if I am violating any best practices
Here's the basic setup: I have a thin bar at the top of a
Here is my persistence.xml : <?xml version=1.0 encoding=UTF-8?> <persistence xmlns=http://java.sun.com/xml/ns/persistence xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd version=1.0>
Here is my problem : I have a post controller with the action create.
Here's my Manifest: <?xml version=1.0 encoding=utf-8?> <manifest xmlns:android=http://schemas.android.com/apk/res/android package=com.mappp.mobile android:versionCode=1 android:versionName=1.0 > <supports-screens android:largeScreens=true
Here is an example: I have the generic type called Account. I wish to
Here's a problem I ran into recently. I have attributes strings of the form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.