-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiev.hs
More file actions
32 lines (26 loc) · 784 Bytes
/
Copy pathiev.hs
File metadata and controls
32 lines (26 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{-
Given: Six positive integers, each of which does not exceed 20,000.
The integers correspond to the number of couples in a population
possessing each genotype pairing for a given factor.
In order, the six given integers represent the number of
couples having the following genotypes:
AA-AA
AA-Aa
AA-aa
Aa-Aa
Aa-aa
aa-aa
Return: The expected number of offspring displaying
the dominant phenotype in the next generation,
under the assumption that every couple has exactly two offspring.
-}
-- Parents:
-- * AA - AA -> 1
-- * AA - Aa -> 1
-- * AA - aa -> 1
-- * Aa - Aa -> 3/4
-- * Aa - aa -> 1/2
-- * aa - aa -> 0
main = readFile "rosalind_iev.txt" >>=
print . (*2) . sum . (zipWith (*) prob) . (map read) . words
where prob = [1, 1, 1, 3/4, 1/2, 0]