From 8ae4691e677414843cf3a84d4327d303fe3e2f41 Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Mon, 2 Apr 2012 20:48:33 +0200 Subject: [Io] Día 2 --- io/addmatrix.io | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 io/addmatrix.io (limited to 'io/addmatrix.io') 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 -- cgit v1.2.3