Explorar o código

Implement a function to sum Liste elements

DricomDragon %!s(int64=5) %!d(string=hai) anos
pai
achega
ee01510045
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  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
+