MathGroup Archive 2008

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

Search the Archive

Re: Debracketing array symbols


> 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?.






  • Prev by Date: How to consider two fitting methods when using Findfit in Mathematica
  • Next by Date: Using FindRoot or interpolation function with symbolic argument
  • Previous by thread: Re: Debracketing array symbols
  • Next by thread: Re: Debracketing array symbols