What does "Non-exhaustive patterns in function scalarNew" mean in this context?
scalarNew :: [Integer]->[Integer]->Integer
scalarNew (x:xs) (y:ys)
| (length xs == length ys) = x * y + scalarNew xs ys
| otherwise = error "error"
What does "Non-exhaustive patterns in function scalarNew" mean in this context?
scalarNew :: [Integer]->[Integer]->Integer
scalarNew (x:xs) (y:ys)
| (length xs == length ys) = x * y + scalarNew xs ys
| otherwise = error "error"
You have to add the base case when using recursion. In this situation, the base case is when both are empty lists.
scalarNew :: [Integer] -> [Integer] -> Integer
scalarNew [] [] = 0
scalarNew [] (y:ys) = error "error"
scalarNew (x:xs) [] = error "error"
scalarNew (x:xs) (y:ys)
| length xs == length ys = x * y + scalarNew xs ys
| otherwise = error "error"
edit: handle only-one-empty-list case