summaryrefslogtreecommitdiff
path: root/io/addmatrix.io
diff options
context:
space:
mode:
authorGuillermo Ramos2012-04-02 20:48:33 +0200
committerGuillermo Ramos2012-04-02 20:48:33 +0200
commit8ae4691e677414843cf3a84d4327d303fe3e2f41 (patch)
tree6007373b702ece4100819606a82ecbae76ff1dd5 /io/addmatrix.io
parentfdd1e7abacd96d9bd49c13b2ecfcfe897546acae (diff)
download7l-8ae4691e677414843cf3a84d4327d303fe3e2f41.tar.gz
[Io] Día 2
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