Variable-length list?
- To: mathgroup at smc.vnet.net
- Subject: [mg83417] Variable-length list?
- From: "Hoa Bui" <hoabui05 at gmail.com>
- Date: Tue, 20 Nov 2007 03:45:46 -0500 (EST)
Hi all, I want to have either a module or a function that inputs a varying-length list M[[nx]], where nx is a parameter, and accesses all of its elements. For example: f[M_?(Function[v,VectorQ[v,IntegerQ]]]:=Module[{i,j,k}, ... ] If M={3,4} then f would do something like: For [i=1,i<3,i++, For [j=1,j<4,j++, Print[i*j]; ] ] If M={3,4,5} then: For [i=1,i<3,i++, For [j=1,j<4,j++, For [k=1,k<5,j++, Print[i*j*k]; ] ] ] ] I wonder if this is doable in Mathematica, and/or what would be a way to do it? Thanks a lot, Hoa