Commit 073613c4 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[PHYLO] parameters name

parent fde6d32d
...@@ -124,8 +124,11 @@ type Grain = Int ...@@ -124,8 +124,11 @@ type Grain = Int
type Step = Int type Step = Int
-- | Function to split a range into chunks -- | Function to split a range into chunks
-- if step == grain then linearity
-- elif step < grain then overlapping
-- else dotted with holes
chunkAlong :: Eq a => Grain -> Step -> [a] -> [[a]] chunkAlong :: Eq a => Grain -> Step -> [a] -> [[a]]
chunkAlong a b l = case a > 0 && b > 0 && a >= b of chunkAlong a b l = case a > 0 && b > 0 of
True -> chunkAlong_ a b l True -> chunkAlong_ a b l
False -> panic "ChunkAlong: Parameters should be > 0 and Grain > Step" False -> panic "ChunkAlong: Parameters should be > 0 and Grain > Step"
......
...@@ -59,9 +59,9 @@ phyloTerms = toPeriodes date 5 3 $ cleanHistory mapList phyloCorpus ...@@ -59,9 +59,9 @@ phyloTerms = toPeriodes date 5 3 $ cleanHistory mapList phyloCorpus
toPeriodes :: (Ord date, Enum date) => (event -> date) toPeriodes :: (Ord date, Enum date) => (event -> date)
-> Grain -> Step -> [event] -> Map (date, date) [event] -> Grain -> Step -> [event] -> Map (date, date) [event]
toPeriodes _ _ _ [] = panic "Empty history can not have any periods" toPeriodes _ _ _ [] = panic "Empty history can not have any periods"
toPeriodes f s o as = DM.fromList $ zip hs $ map (inPeriode f as) hs toPeriodes f g s es = DM.fromList $ zip hs $ map (inPeriode f es) hs
where where
hs = steps s o $ both f (DL.head as, DL.last as) hs = steps g s $ both f (DL.head es, DL.last es)
inPeriode :: Ord b => (t -> b) -> [t] -> (b, b) -> [t] inPeriode :: Ord b => (t -> b) -> [t] -> (b, b) -> [t]
inPeriode f h (start,end) = inPeriode f h (start,end) =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment