MathGroup Archive 2011

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

Search the Archive

Re: Please Help Eliminate My Ignorance

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118567] Re: Please Help Eliminate My Ignorance
  • From: Tomas Garza <tgarza10 at msn.com>
  • Date: Tue, 3 May 2011 05:45:47 -0400 (EDT)

Mathematica finds no problem with 1. You are just defining the function test (only if you try to evaluate iyou=B4ll be in trouble, since there is no p). The problem in 2. arises because you have just Clear'ed p, and so Append[p, p[[4]]] makes no sense: there is no p.
-Tomas

> Date: Mon, 2 May 2011 06:52:02 -0400
> From: mmandelberg at comcast.net
> Subject: [mg118542] Please Help Eliminate My Ignorance
> To: mathgroup at smc.vnet.net
>
> Why does Mathematica like the first, but not the second?
>
> 1.
> Clear[x, testp, p];
> test[p_] :=  Append[p, p[[4]]];
>
>
> 2.
> Clear[x, testp, p];
> test[p_] := x = 1; Append[p, p[[4]]];
>
> Part::partd: Part specification p[[4]] is longer than depth of object.
> >>
>
> Append::normal: Nonatomic expression expected at position 1 in
> Append[p,p[[4]]]. >>
>


  • Prev by Date: Re: Undo/Redo
  • Next by Date: Re: Remove MakeExpression settings
  • Previous by thread: Re: Please Help Eliminate My Ignorance
  • Next by thread: Re: Please Help Eliminate My Ignorance