summaryrefslogtreecommitdiff
path: root/io/addmatrix.io
diff options
context:
space:
mode:
Diffstat (limited to 'io/addmatrix.io')
-rw-r--r--io/addmatrix.io21
1 files changed, 21 insertions, 0 deletions
diff --git a/io/addmatrix.io b/io/addmatrix.io
new file mode 100644
index 0000000..9944b75
--- /dev/null
+++ b/io/addmatrix.io
@@ -0,0 +1,21 @@
+List deepSum := method(
+ total := 0
+ self foreach(e,
+ if(e type == "List") then(
+ total = total + e deepSum
+ ) else(
+ total = total + e
+ )
+ )
+ return total
+)
+
+a := list(1,2,3)
+b := list(4,5,6)
+c := list(7,8,9)
+a deepSum println
+b deepSum println
+c deepSum println
+
+c := list(a,b,c)
+c deepSum println