I'm really new to Haskell and programming in general. I'm trying to add up the contents of a list without using the sum
function from Data.List. Here's what I've got so far:
module Summ
where
summ :: [Int] -> Int
summ xs =
if null xs == False
then let y = x + (head xs)
let xs = tail xs
else print y
I'm pretty sure there's a lot wrong with this code, but for now the latest error is "parse error on input" for the else
statement. What's wrong?
Aucun commentaire:
Enregistrer un commentaire