Skip to content

Instantly share code, notes, and snippets.

@ConnorBaker
Last active February 23, 2019 00:50
Show Gist options
  • Select an option

  • Save ConnorBaker/625e8b76dd91ca8942f64c8ce0e1ec88 to your computer and use it in GitHub Desktop.

Select an option

Save ConnorBaker/625e8b76dd91ca8942f64c8ce0e1ec88 to your computer and use it in GitHub Desktop.
Programming in Haskell, 2nd ed.: Chapter 5: Problem 9
chisqr :: [Float] -> [Float] -> Float
chisqr os es = sum [((o-e)^2)/e | (o,e) <- zip os es]
scalarproduct :: [Int] -> [Int] -> Int
scalarproduct xs ys = sum [x*y | (x,y) <- zip xs ys]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment