I'm working on something that could tell whether or not the given string is a valid de Bruijn sequence of order n
So I want to split the given string at every character into a list of size n Strings
Example : "011001100" order = 3
becomes {"011", "110", "100", "001", "110", "100"} Now I can easily check if the list contains one of the elements twice or more
I'm quite the newbie with haskell, I tried to do something myself but I don't know where to start. (if you have any other idea to do the given task i'm open to it)
Answering comment : What i've tried :
import Data.List
chunk :: Int -> [a] -> [[a]]
chunk _ [] = []
chunk n xs = first : chunk n rest where (first, rest) = splitAt n xs
Then I can get the list with:
print $ transpose $ chunk order sequence