Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Variable-length list?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83484] Re: Variable-length list?
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Wed, 21 Nov 2007 02:58:47 -0500 (EST)
  • References: <fhu73f$71m$1@smc.vnet.net>

f[m_/;VectorQ[m, IntegerQ@# && Positive@# &], func_] :=
  Outer[func, Sequence@@(Range/@m)]

f[{3,4}, List ]

{{{1,1},{1,2},{1,3},{1,4}},
 {{2,1},{2,2},{2,3},{2,4}},
 {{3,1},{3,2},{3,3},{3,4}}}

f[{3,4}, Print@Times@##& ];

1
2
3
4
2
4
6
8
3
6
9
12


  • Prev by Date: Split window vertically or horizontally in Math6.0?
  • Next by Date: Re: ordered positions (OrderedPosition?)
  • Previous by thread: Variable-length list?
  • Next by thread: Re: Variable-length list?