25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

25 satır
808 B

  1. \ifger{Es gibt noch eine weitere sehr wichtige Rekursionsstruktur. Stellen wir uns vor wir wollen alle Zahlen einer Liste aufsummieren. Die Typsignatur sieht wie folgt aus:}{There's one more important recursion pattern. Imagine you want the sum of all numbers of a list, so the function type signature would be:}
  2. \begin{haskellcode}
  3. sum :: [Int] -> Int
  4. \end{haskellcode}
  5. \ifger{Lösung?}{Solution?}
  6. \pause
  7. \begin{haskellcode}
  8. sum :: [Int] -> Int
  9. sum [] = 0
  10. sum (x:xs) = x + sum xs
  11. \end{haskellcode}
  12. \pause
  13. \ifger{Oder das Produkt:}{Or the product:}
  14. \begin{haskellcode}
  15. prod :: [Int] -> Int
  16. prod [] = 1
  17. prod (x:xs) = x * prod xs
  18. \end{haskellcode}
  19. \pause
  20. \ifger{Oder die Länge:}{Or the length:}
  21. \begin{haskellcode}
  22. length :: [a] -> Int
  23. length [] = 0
  24. length (x:xs) = 1 + length xs
  25. \end{haskellcode}