This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Bioinformatics.DNANucleotide as D | |
hammingDistance :: (Eq a) => [a] -> [a] -> Int | |
hammingDistance l1 l2 = length . filter (not) $ zipWith (==) l1 l2 | |
main = do | |
string1 <- getLine | |
string2 <- getLine | |
let dnaString1 = map D.charToDNANucleotide string1 | |
let dnaString2 = map D.charToDNANucleotide string2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Bioinformatics.DNANucleotide as D | |
hammingDistance :: (Eq a) => [a] -> [a] -> Int | |
hammingDistance l1 l2 = sum . map (\(f,s) -> if f == s then 0 else 1) $ zip l1 l2 | |
main = do | |
string1 <- getLine | |
string2 <- getLine | |
let dnaString1 = map D.charToDNANucleotide string1 | |
let dnaString2 = map D.charToDNANucleotide string2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Bioinformatics.DNANucleotide ( | |
DNANucleotide (..), | |
charToDNANucleotide, | |
nucleotideComplement, | |
calculateGCContent, | |
findMotif | |
) where | |
import Data.Char | |
import Data.List |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Bioinformatics.RNANucleotide ( | |
RNANucleotide (..), | |
charToRNANucleotide, | |
rnaToProtein | |
) where | |
import Data.Char | |
import Data.List | |
import qualified Data.Map as M | |
import qualified Data.Maybe as Mb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Bioinformatics.DNANucleotide ( | |
DNANucleotide (..), | |
charToDNANucleotide, | |
nucleotideComplement, | |
calculateGCContent | |
) where | |
import Data.Char | |
import Data.List |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rabbitFib :: Integer -> Integer -> Integer | |
rabbitFib 0 _ = 0 | |
rabbitFib 1 _ = 1 | |
rabbitFib n k = | |
rabbitFib (n-1) k + k * rabbitFib (n-2) k |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fib :: Integer -> Integer | |
fib 0 = 0 | |
fib 1 = 1 | |
fib n = fib (n-1) + fib (n-2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "AppDelegate.h" | |
@interface AppDelegate () | |
@end | |
@implementation AppDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mendelsFirstLaw :: Float -> Float -> Float -> Float | |
mendelsFirstLaw k m n = ((k**2 - k) + (2.0 * k * m) + (2.0 * k * n) + (m * n) + (0.75 * (m**2 - m))) / ((k + m + n) * (k + m + n - 1)) | |
main = do | |
k <- getLine | |
m <- getLine | |
n <- getLine | |
putStrLn . show $ mendelsFirstLaw (read k :: Float) (read m :: Float) (read n :: Float) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fac n = product [1..n] | |
combination 0 _ = 1 | |
combination _ 0 = 1 | |
combination n k = | |
let fn = fac n | |
fk = fac k | |
fnk = fac (n - k) | |
in fn / (fk * fnk) |