Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2049 > unrolled thread
| Started by | Tomas Garza <tgarza10@msn.com> |
|---|---|
| First post | 2011-05-03 09:45 +0000 |
| Last post | 2011-05-03 09:45 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: Please Help Eliminate My Ignorance Tomas Garza <tgarza10@msn.com> - 2011-05-03 09:45 +0000
| From | Tomas Garza <tgarza10@msn.com> |
|---|---|
| Date | 2011-05-03 09:45 +0000 |
| Subject | Re: 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]]]. >> >
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web