MathGroup Archive 1996

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

Search the Archive

Re: Position[] pattern matching

  • To: mathgroup at
  • Subject: [mg4287] Re: Position[] pattern matching
  • From: Harald Berndt <haraldb at>
  • Date: Sat, 29 Jun 1996 03:54:50 -0400
  • Organization: University of California Forest Products Lab
  • Sender: owner-wri-mathgroup at

> The problem is that Mathematica is trying to evaluate x[[4]], where
> x either has no value or is an expression that doesn't have at
> least four parts.  You can avoid this problem using:
>     Position[
>         finfo,
>         Unevaluated[x /; (StringTake[ x[[4]], 1] == "L")]
>     ]
> The computation eventually works because x[[4]] evaluates to x[[4]],
> even though it generates an error message.


After reading many very helpful replies to this question (thank you 
all), I believe your answer is a bit off the mark since

      x_ /; StringTake[x[[4]],1] == "L", {1},

gets rid of all error messages. See Espen's answer in this thread.

Thanks, though, for your interest and help.

Harald Berndt                          University of California
Research Specialist                  Forest Products Laboratory
Phone: 510-215-4224                            FAX:510-215-4299


  • Prev by Date: Re: MMA graphics as *.gif files
  • Next by Date: Running Math2.2.3 on WIN 95 and WFW3.11 Clients in a Network
  • Previous by thread: Re: Position[] pattern matching
  • Next by thread: Help: Column/Row Vector