Skip to content

Instantly share code, notes, and snippets.

@tnull
Created November 22, 2019 09:39
Show Gist options
  • Save tnull/7cded5f0ce8076900b9b1c92209b6bd2 to your computer and use it in GitHub Desktop.
Save tnull/7cded5f0ce8076900b9b1c92209b6bd2 to your computer and use it in GitHub Desktop.
data OwnRecord = OwnRecord { key :: String
, testList :: [Float]
}
testMap :: String -> [Float] -> M.Map String OwnRecord
testMap s fs = foldl (\acc x -> M.insertWith update s x acc) M.empty fs
where
update (OwnRecord s newList) (OwnRecord s oldList) = OwnRecord s (oldList ++ newList)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment