I'm not sure what you're asking for; it looks like you have to implement the functions from the specifications.
On Thu, Oct 21, 2010 at 6:11 PM, Yaadallah Khan <[email protected]> wrote: > I am Studying for an exam, and i have just come accross the following 3 > questions, i am not familiar with the functions, therefore i would > appreciate any help. > !! i have already created painting 2 & 3 all i need is the 3 functions, for > the three different tasks as shown below. the functions are the showPic, > sizeRaw and isPic. > questions are: > 1) – Define showPic :: Canvas -> IO () for displaying pictures on the > terminal. Examples: > Cw2010> showPic (painting 2) > +---+---+---+---+---+ > | a | n | e | x | a | > +---+---+---+---+---+ > | m | p | l | e | t | > +---+---+---+---+---+ > | e | x | t | i | s | > +---+---+---+---+---+ > | s | h | o | w | n | > +---+---+---+---+---+ > Cw2010> showPic (painting 3) > +---+---+---+---+---+---+---+ > | A | n | o | t | h | e | r | > +---+---+---+---+---+---+---+ > | | t | e | s | t | ! | | > +---+---+---+---+---+---+---+ > 2) – Furthermore, define sizeRaw :: Canvas -> (Int, Int) for finding > out the size of a raw picture as demonstrated here. > Cw2010> sizeRaw ["anexa","mplet","extis","shown"] > (5,4) > 3) – Finally, define isPic :: Canvas -> Bool for checking a particular > necessary condition which items of type Canvas must satisfy (full or > raw). The condition you should check for is whether all the ‘rows’ of > the input have the same length. (It may be assumed that the input > of isPic is of type Canvas.) Examples: > Cw2010> isPic (painting 3) > True > Cw2010> isPic (painting 4) > False > Suggestion. I found it useful in my implementation to define and use > here the auxiliary function isEqual :: [Int] -> Bool; example: > Cw2008> isEqual [8,8,8,8] > True > Cw2008> isEqual [8,8,4,8] > False > You may wish to define and use isEqual in your implementation of > isPic too. > _______________________________________________ > Haskell-Cafe mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe > > _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
