Advertisement
Guest User

Q2

a guest
Nov 27th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. repeat1 :: a -> [a]
  2. repeat1 x = xs where xs = x : xs
  3.  
  4. acc_repeat :: Int -> a -> [a]
  5. acc_repeat n x =  take n (repeat1 x)
  6.  
  7. q2 :: Int -> Int -> String
  8. q2 m n = acc_repeat n '*'++"\n"++
  9.             acc_repeat (1) '*'++
  10.             acc_repeat (n-2) ' '++
  11.             acc_repeat (1) '*'++"\n"++
  12.             acc_repeat n '*'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement