Jelajahi Sumber

Implement a function to sum Liste elements

DricomDragon 5 tahun lalu
induk
melakukan
ee01510045
1 mengubah file dengan 4 tambahan dan 0 penghapusan
  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
+