Parcourir la source

Implement a function to sum Liste elements

DricomDragon il y a 5 ans
Parent
commit
ee01510045
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  1. 4 0
      list.hs

+ 4 - 0
list.hs

@@ -1,2 +1,6 @@
 data List = Ground | Leaf Integer List
 
+hyperSum xs = case xs of
+	Ground -> 0
+	Leaf x tail -> x + hyperSum tail
+