Skip to content

Instantly share code, notes, and snippets.

@audreyt
Created January 8, 2012 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save audreyt/1579130 to your computer and use it in GitHub Desktop.
Save audreyt/1579130 to your computer and use it in GitHub Desktop.
mul_n_sum :: String -> Int
mul_n_sum str = result
where
result = sum value_of_lines
value_of_lines = [ field1 * field2 | [field1, field2] <- field_lines ]
field_lines = [ [read txt1, read txt2] | [txt1, txt2] <- txt_lines ]
txt_lines = [ words line | line <- lines str ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment