fork(2) download
  1. lis:: [[Int]] -> Int -> Int
  2. lis [] n= 0
  3. lis(xs:xss) n = contiene xs n+lis xss n
  4.  
  5. contiene:: [Int] -> Int -> Int
  6. contiene [] n = 0
  7. contiene(x:xs) n
  8. | n == x = n + contiene xs n
  9. | otherwise = contiene xs n
  10. main = do
  11. let l = [[2,6,1,2,7],[3,8,9,2,1],[2,4,6]]
  12. print(lis l 2)
  13.  
  14.  
Success #stdin #stdout 0s 5516KB
stdin
Standard input is empty
stdout
8