Skip to content

Instantly share code, notes, and snippets.

@MAGANER
Created December 29, 2022 16:10
Show Gist options
  • Save MAGANER/9f1d0387576f42cf5965a7f582040ea2 to your computer and use it in GitHub Desktop.
Save MAGANER/9f1d0387576f42cf5965a7f582040ea2 to your computer and use it in GitHub Desktop.
sum1::[Int] -> Int
sum1 seq = sum [x*x | x <- seq]
sum2::[Int] -> Int
sum2 seq =
let s = sum [x | x <- seq]
in s*s
main::IO()
main = print $ sum2 [1..100] - sum1 [1..100]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment