list - Haskell recursion odd -
i have define own predicate function recursively searches list of numbers , returns true if finds odd number, false otherwise.
i have set x = [1..100] test data need show. however, bit unsure how recursion search list. i'm not looking definitive answer explanation on how recursion go around searching in list.
what want function any odd:
any :: (a -> bool) -> [a] -> bool odd :: integral => -> bool odd :: integral => [a] -> bool anyodd :: integral => [a] -> bool anyodd = odd if want define anyodd function have use recursion:
anyodd :: integral => [a] -> bool anyodd [] = undefined anyodd (x:xs) | odd x = undefined | otherwise = undefined you need replace undefined actual logic.
Comments
Post a Comment