Re: Re: Debracketing array symbols
- To: mathgroup at smc.vnet.net
- Subject: [mg92197] Re: [mg92159] Re: Debracketing array symbols
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 23 Sep 2008 07:29:08 -0400 (EDT)
- Reply-to: hanlonr at cox.net
Clear[A]
Head[A[1]]
A
A = Array[a, {4}]
{a(1),a(2),a(3),a(4)}
Head[A[1]]
{a(1),a(2),a(3),a(4)}
Consequently, if A were defined using A vice a on the RHS there would be an infinite recursion
Bob Hanlon
---- carlos at Colorado.EDU wrote:
=============
> deBracket[x_] :=
> x /. A_Symbol[n__Integer] :>
> ToExpression[
> StringJoin[Prepend[ToString /@ {n}, ToString[A]]]]
>
> X[1] // deBracket
>
> X1
>
> {A[1], A[2], A[3], A[4]} // deBracket
Elegant.
A related question A={A[1], A[2], A[3], A[4]} produces infinite
recursion in 4.2 and 5.2 (NB - I prepare all coursework with
4.2 for compatibility with some remote students in industry)
Is the symbol A used on the RHS?
{A[1], A[2], A[3], A[4]} //FullForm just shows
List[A[1],A[2],A[3],A[4]] which does not tell me much.
Where is the role of A in the RHS explained in the documentation?.
--
Bob Hanlon