Created
December 8, 2025 22:06
-
-
Save nicuveo/12733334bde8b4a8cea3a9a27d83b297 to your computer and use it in GitHub Desktop.
Circular programmin in Haskell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| distanceFromAverage :: [Int] -> [Int] | |
| distanceFromAverage values = | |
| let (result, mean) = go 0 0 [] mean values | |
| in result | |
| where | |
| go total amount result _ [] = (result, total `div` amount) | |
| go total amount result mean (x:xs) = | |
| go (total + x) (amount + 1) (result ++ [abs $ x - mean]) mean xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment