MathGroup Archive 2004

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

Search the Archive

Re: newbie myHead question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47066] Re: newbie myHead question
  • From: "Peter Pein" <no at spam.no>
  • Date: Mon, 22 Mar 2004 22:39:35 -0500 (EST)
  • References: <c3h1jj$bc8$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"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)