Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 18th, 2013  |  syntax: Haskell  |  size: 0.91 KB  |  views: 58  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. data Sequenz = Sequenz String deriving Show
  2.  
  3. data RawGenom = RawGenom [Sequenz] deriving Show
  4.  
  5. data Data a = Error | Data a
  6.  
  7. --data EvalGenom = EvalGenom [Data a]
  8.  
  9. unpackGenom :: RawGenom -> [Sequenz]
  10. unpackGenom (RawGenom a) = a
  11.  
  12. unpackSequenz :: Sequenz -> String
  13. unpackSequenz (Sequenz a) = a
  14.  
  15. packSequenz :: String -> Sequenz
  16. packSequenz = Sequenz
  17.  
  18. lookupSequenz :: String ->
  19. lookupSequenz x = case x of
  20.             "0001" -> Data 1
  21.             "0010" -> Data 2
  22.             "0011" -> Data 3
  23.             "0100" -> Data 4
  24.             "0101" -> Data 5
  25.             "0110" -> Data 6
  26.             "0111" -> Data 7
  27.             "1000" -> Data 8
  28.             "1001" -> Data 9
  29.             "1010" -> Data (+)
  30.             "1011" -> Data (-)
  31.             _      -> Error
  32.  
  33. evalGenom :: RawGenom -> [String]
  34. evalGenom x = map lookupSequenz . unpackSequenz unpackGenom $ x
  35.  
  36. --lookupSequenz :: String ->