MathGroup Archive 2004

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

Search the Archive

Re: newbie myHead question


"János" <janos.lobb at yale.edu> schrieb im Newsbeitrag
news:c3h1jj$bc8$1 at smc.vnet.net...
[...]
> Transpose[myHead[{a, b}, {a, b}, {a, b}]]
>
> The FullForm of it
>
> Transpose[myHead[List[a, b], List[a, b], List[a, b]]]
>
> which is not that I need.  I need
>
> myHead[{a,a,a},{b,b,b}]
>
> or
>
> myHead[List[a, a, a], List[b, b, b]]
>
> What am I missing ?  What should I do to get myHead[{a,a,a},{b,b,b}] ?
>
> Thanks ahead,
>
> János


Hi János,
since Transpose works on lists, you have to define a new function:

In[1]:= n = myHead @@ (m = {{a, b}, {a, b}, {a, b}});

In[2]:= TransposeArgs[h_[x__]] := h @@ Transpose[{x}]

In[3]:= TransposeArgs[n]
Out[3]= myHead[{a, a, a}, {b, b, b}]

Have fun with Mathematica,
Peter
-- 
Peter Pein, Berlin
petsie at arcAND.de
replace && by || to write to me




  • Prev by Date: Re: Can I make a bulleted list in Mathematica in a method similar to LaTeX or MS Word?
  • Next by Date: Re: Left/right justifying rotated text [ corrected ]
  • Previous by thread: Re: newbie myHead question
  • Next by thread: Solution sketch sought for User Input (beginner's question)