
9 May
2016
9 May
'16
1:30 p.m.
Hi, I'm new in Haskell and I need help in recursion. That function below is returning "*** Exception: Prelude.head: empty list" and I need resolve that: execNTimes 0 [] = return() execNTimes n xs = if n<=0 || null xs then return() else do si <- getLine let s = words si l = read (s !! 1) :: Int r = read (s !! 2) :: Int if head s=="Q" then do let z = slice l r xs m = foldl lcm 1 z print (m `mod` (toInteger 1000000007)) else do let s1 = update l r xs execNTimes (n-1) s1 execNTimes (n-1) xs Anybody can me help? Thank you, Josenildo Silva