浏览代码

Implement a function to sum Liste elements

DricomDragon 5 年之前
父节点
当前提交
ee01510045
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      list.hs

+ 4 - 0
list.hs

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