Explorar el Código

Implement a function to sum Liste elements

DricomDragon hace 5 años
padre
commit
ee01510045
Se han modificado 1 ficheros con 4 adiciones y 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
+