Merge and aggregate datasets: Difference between revisions

m
→‎Reading and merging: simplified a bit
(→‎{{header|Haskell}}: added solution)
m (→‎Reading and merging: simplified a bit)
Line 591:
 
<lang haskell>import Data.List
import Data.Maybe (mapMaybe, maybeToList)
import System.IO (readFile)
import Text.Read (readMaybe)
Line 622:
 
instance Semigroup Patient where
Patient p1 n1 v1 s1 <> Patient p2 =n2 Patientv2 s2 =
Patient (iffromJust null$ (pidJust p1) then<|> pidJust p2 else pid p1)
(name p1 (n1 <|> name p2n2)
(visits p1 (v1 <|> visits p2v2)
(scores p2 (s1 <|> scores p1s2)
 
instance Monoid Patient where
Anonymous user