Skip to content

Instantly share code, notes, and snippets.

@dmwit
Created March 17, 2019 21:20
Show Gist options
  • Save dmwit/18f199735123728bd40525eebc5d65a7 to your computer and use it in GitHub Desktop.
Save dmwit/18f199735123728bd40525eebc5d65a7 to your computer and use it in GitHub Desktop.
\xs -> sum $ map (sum . toDigits) xs
= { f $ x = f x }
\xs -> sum (map (sum . toDigits) xs)
= { function application associates to the left }
\xs -> sum ((map (sum . toDigits)) xs)
= { (f . g) x = f (g x), with f = sum, g = (map (sum . toDigits)) }
\xs -> (sum . (map (sum . toDigits))) xs
= { eta reduction }
(sum . (map (sum . toDigits)))
= { remove unnecessary clarifying parentheses }
sum . map (sum . toDigits)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment