listfct.hs 390 B

123456789101112131415161718
  1. -- Reverse list order
  2. myexchanger xs zs = case xs of
  3. [] -> zs
  4. y:ys -> myexchanger ys (y:zs)
  5. myreverse xs = myexchanger xs []
  6. -- Delete the first item
  7. mydelete l y = case l of
  8. [] -> []
  9. x:xs -> if x == y then xs else x:(mydelete xs y)
  10. -- Find the maximum
  11. mymaximum l = mymaximumof l 0
  12. mymaximumof l x = case l of
  13. [] -> x
  14. y:ys -> if y > x then mymaximumof ys y else mymaximumof ys x