Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2049 > unrolled thread

Re: Please Help Eliminate My Ignorance

Started byTomas Garza <tgarza10@msn.com>
First post2011-05-03 09:45 +0000
Last post2011-05-03 09:45 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: Please Help Eliminate My Ignorance Tomas Garza <tgarza10@msn.com> - 2011-05-03 09:45 +0000

#2049 — Re: Please Help Eliminate My Ignorance

FromTomas Garza <tgarza10@msn.com>
Date2011-05-03 09:45 +0000
SubjectRe: Please Help Eliminate My Ignorance
Message-ID<ipoish$g52$1@smc.vnet.net>
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@comcast.net
> Subject:  Please Help Eliminate My Ignorance
> To: mathgroup@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]]]. >>
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web