Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: MapThread over ragged arrays

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83744] Re: MapThread over ragged arrays
  • From: m.r at inbox.ru
  • Date: Thu, 29 Nov 2007 06:35:00 -0500 (EST)
  • References: <fhrrbf$583$1@smc.vnet.net> <figtua$fco$1@smc.vnet.net>

On Nov 27, 5:10 am, yat... at mac.com wrote:
> Here is one more version:
>
> Function[{x, y}, f[x, y], {Listable}][mat1, mat2]
>
> Anybody know how to extend it so that it would work for an arbitrary
> number of arguments?
>
> The following does not seem to work
>
> Function[{},f[##],{Listable}][mat1,mat2,mat3]
>
> Regards,
>
> Derek

There's the undocumented Function[, body, attr] syntax:

In[1]:= Function[, f[##], Listable][
 {{1, 2}, {2, 3, 4}, {5, 6}}, {{a, b}, {b, c, d}, {e, f}}]

Out[1]= {{f[1, a], f[2, b]}, {f[2, b], f[3, c], f[4, d]}, {f[5, e],
f[6, f]}}

Maxim Rytin
m.r at inbox.ru


  • Prev by Date: Unable to access v6 internal data sources (paclets)
  • Next by Date: Re: Convert nxn matrix to a column vector with (n^2) elements
  • Previous by thread: Re: MapThread over ragged arrays
  • Next by thread: addons in Mathematica 6???