I am working through UPenn CIS 194: Introduction to Haskell (Spring 2013). Since I am not able to take the course for real I am asking for CR (feedback) as it could be from teacher in that course.HW1 - Validating Credit Card Numbers - Full descriptiontoDigitsRev :: Integer -> [Integer]toDigitsRev 0 = []toDigitsRev n  | n < 0 = []  | n < 10 = [n]  | otherwise = n `mod` 10 : toDigitsRev (n `div` 10)toDigits :: Integer -> [Integer]toDigits n = reverse (toDigitsRev n)doubleEveryOther :: [Integer] -> [Integer]doubleEveryOther [] = []doubleEveryOther (x:[]) = [x]doubleEveryOther (x:y:zx)  | length (x:y:zx) `mod` 2 == 0 = 2*x : y : doubleEveryOther zx  | otherwise = x : 2*y : doubleEveryOther zxsumDigits :: [Integer] -> IntegersumDigits [] = 0sumDigits (x:[]) = xsumDigits (x:xs)  | x < 10 = x + sumDigits xs  | otherwise = sumDigits (toDigits x) + sumDigits xsvalidate :: Integer -> Boolvalidate 0 = Falsevalidate n = (sumDigits (doubleEveryOther (toDigits n))) `mod` 10 == 0type Peg = Stringtype Move = (Peg, Peg)hanoi :: Integer -> Peg -> Peg -> Peg -> [Move]hanoi n a b c  | n == 0 = []  | n == 1 = (a, b) : hanoi 0 a b c  | otherwise =  hanoi (n-1)  a c b ++ [(a, b)] ++  hanoi (n-1) c b a
UPenn CIS 194 Homework 1: Validating credit card numbers
haskell;homework;e commerce;checksum
toDigitsRevYou can combine these two cases:toDigitsRev 0 = []toDigitsRev n  | n < 0 = []I think having one case makes the code clearer:toDigitsRev  | n <= 0 = []doubleEveryOtherYou are correct to write doubleEveryOther as a recursive function, but ... you don't need to call length on every call!Think of a way to writing doubleEveryOther but with calling length at most once.length and reverseAs you become more familiar with Haskell you learn that you should be wary of calling length and reverse on lists. In this case it is not a big deal because the lists involved are very short, but, in general, if you find yourself using these functions a lot it's an indication that you are using the wrong data structure.As a bonus exercise, see if you can figure out a way to implement the validate function without using length or reverse.