I'm working on the famous clump finding problem to learn Haskell. Part of the problem involve breaking nucleotide sequences, called kmers, into subsequences as follows:
ACTGCA -> [ACT,CTG,GCA]
This sliding window generates all possible kmers of length k, 3 in the above example.
The problem is my very simple algorithm is too slow to work on the E. Coli genome. Other algorithms in slower languages can generate the kmer list in seconds.
Here is what I wrote:
kmerBreak k genome@(x : xs)
| k <= length genome = take k genome : kmerBreak k xs
| otherwise = []
I would love some feedback on how to improve the performance of this simple algorithm. As well as my use of Haskell in general.