#!/usr/bin/env runhaskell main = validate_check_digits "4910099710741" validate_check_digits :: [Char] -> IO () validate_check_digits digits = validate_check_even_digits digits * 3 + validate_check_odd_digits validate_check_even_digits :: [Char] -> Int validate_check_even_digits [] = 0 validate_check_even_digits (x1:(_:(x2:(_:xs)))) = x1 + x2 + validate_check_even_digits xs validate_check_odd_digits :: [Char] -> Int validate_check_odd_digits [] = 0 validate_check_odd_digits (_::odd_digits) = validate_check_even_digits odd_digits