fold - Foldr issues (Haskell) -
I am trying to convert from a table that is type of I am using plateau (as the title means), but I have to use the exact function to do something Problems are coming - that is, my errors look like this: Output table should be each letter, one colon, then Where Any help has been received with gratitude. After the following minor fixes: one ?? ?? But whatever you want does not produce that much. You might think this better: Then your test example: ([Char, Int]) < / Code>
tab2str :: table for a string - & gt; String (which adheres to a specific formatting pattern.)
tab2str xs = foldr (++) '' $ map (\ char count -> 4 ++ ' : '++ show calculation ++' N ') xs
\ n on one Can be a string:
Tab 2 Strct Test 1 == "F: 1 \ n: 1 \ nl: 1 \ nd: 1 \ nr: 1 \ n"
test1 == [(F, 1), (O, 1), (L, 1), (D, 1), (R, 1)]
tab2str xs = foldr (++) $ Map (\ (char, count) -> & gt; show four ++: "++ show count ++" \ n ") xs
tab2 String table = CONSATAT $ map format table where formula (four, count) = [four] ++ ":" ++ Show count ++ "\ n"
ghci & gt; Test 1 = [('F', 1), ('O', 1), ('L', 1), ('D', 1), ('R', 1)] GB & gt; Tab 2 String Test 1 "F: 1 \ No: 1 \ nl: 1 \ nd: 1 \ nr: 1 \ n" Gaasi & GT; PutStr $ tab2str test1F: 1O: 1L: 1D: 1R: 1GSC & gt;
Comments
Post a Comment