{"id":19,"date":"2007-07-26T22:58:21","date_gmt":"2007-07-27T05:58:21","guid":{"rendered":"http:\/\/www.elbeno.com\/haskell_soe_blog\/?p=19"},"modified":"2008-01-07T21:54:14","modified_gmt":"2008-01-08T05:54:14","slug":"exercise-55","status":"publish","type":"post","link":"https:\/\/www.elbeno.com\/haskell_soe_blog\/?p=19","title":{"rendered":"Exercise 5.5"},"content":{"rendered":"<pre lang=\"haskell\">doubleEach :: [Int] -> [Int]\r\ndoubleEach xs = map (\\x -> x * 2) xs\r\n\r\ndoubleEach' (x:xs) = (x * 2) : doubleEach' xs\r\ndoubleEach' [] = []\r\n\r\npairAndOne :: [Int] -> [(Int, Int)]\r\npairAndOne xs = zip xs (map (\\x -> x + 1) xs)\r\n\r\npairAndOne' (x:xs) = (x, x+1) : pairAndOne' xs\r\npairAndOne' [] = []\r\n\r\naddEachPair :: [(Int, Int)] -> [Int]\r\naddEachPair xs = map (\\(a,b) -> a + b) xs\r\n\r\naddEachPair' ((a,b):xs) = (a + b) : addEachPair' xs\r\naddEachPair' [] = []<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>doubleEach :: [Int] -> [Int] doubleEach xs = map (\\x -> x * 2) xs doubleEach&#8217; (x:xs) = (x * 2) : doubleEach&#8217; xs doubleEach&#8217; [] = [] pairAndOne :: [Int] -> [(Int, Int)] pairAndOne xs = zip xs (map (\\x -> x + 1) xs) pairAndOne&#8217; (x:xs) = (x, x+1) : pairAndOne&#8217; xs pairAndOne&#8217; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=\/wp\/v2\/posts\/19"}],"collection":[{"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":0,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elbeno.com\/haskell_soe_blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}