Browse Source

Implement a function to sum Liste elements

DricomDragon 5 years ago
parent
commit
ee01510045
1 changed files with 4 additions and 0 deletions
  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
+