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


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

Re: Please Help Eliminate My Ignorance

From Tomas Garza <tgarza10@msn.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Please Help Eliminate My Ignorance
Date 2011-05-03 09:45 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ipoish$g52$1@smc.vnet.net> (permalink)

Show all headers | View raw


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 comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web