Skip to content
Browse files

preparing for the pretty print problem

  • Loading branch information...
1 parent a0475b4 commit af32c11df1eaf8a332b1236b02fbc1785280c411 @ollielo committed Mar 5, 2012
Showing with 19 additions and 0 deletions.
  1. +7 −0 DynamicProgramming/poem.txt
  2. +12 −0 DynamicProgramming/prettyprint.hs
View
7 DynamicProgramming/poem.txt
@@ -0,0 +1,7 @@
+Call me Ishmael.
+Some years ago,
+never mind how long precisely,
+having little or no money in my purse,
+and nothing particular to interest me on shore,
+I thought I would sail out a little
+and see the watery part of the world.
View
12 DynamicProgramming/prettyprint.hs
@@ -0,0 +1,12 @@
+main :: IO ()
+
+slack :: Int -> [String] -> Int
+slack llimit ws = (llimit - (length $ unwords ws))^2
+
+main =
+ do
+ contents <- readFile "poem.txt"
+ let ls = lines contents
+ ws = words contents
+ mapM_ (putStrLn . show . slack 50 . words) ls
+

0 comments on commit af32c11

Please sign in to comment.
Something went wrong with that request. Please try again.