CS计算机代考程序代写 DNA — You must enter your student ID number here: uXXXXXXX

— You must enter your student ID number here: uXXXXXXX
module DNA where

data Base = A | G | C | T deriving (Eq, Show)
data DNA = Nil | Next Base (DNA) deriving (Eq, Show)

— | Define a function lenSeq that takes a DNA sequence and returns its length
— Examples:
— >>> lenSeq (Next T (Next C (Next A Nil)))
— 3
— >>> lenSeq Nil
— 0
lenSeq :: DNA -> Int
lenSeq Nil = undefined — TODO

— | Define a function numEqLetters that counts the number of matching letters
— in the headers of two sequences i.e. until either one of the sequences reaches
— the end (Nil) or the letters do not match.
— Empty sequence is not equal to anything including itself
— Examples:
— >>> numEqLetters (Next T (Next C (Next A Nil))) (Next T (Next C (Next A Nil)))
— 3
— >>> numEqLetters (Next T (Next C (Next A Nil))) (Next T (Next C Nil))
— 2
— >>> numEqLetters (Next A (Next A Nil)) (Next T (Next C (Next A Nil)))
— 0
— >>> numEqLetters Nil Nil
— 0
numEqLetters :: DNA -> DNA -> Int
numEqLetters = undefined — TODO

— | Define a function numSubSeqs that countes the number occurences of a contiguous
— subsequence (2nd argument) in an input sequence (1st argument)

— Examples:
— >>> numSubSeqs (Next A (Next A (Next T (Next C (Next C (Next G (Next C (Next T (Next A (Next A (Next G Nil))))))))))) (Next A (Next A Nil))
— 2
— >>> numSubSeqs (Next T (Next C (Next A Nil))) (Next T (Next C Nil))
— 1
— >>> numSubSeqs (Next C (Next A Nil)) (Next A (Next C Nil))
— 0
numSubSeqs :: DNA -> DNA -> Int
numSubSeqs = undefined — TODO