Re: Position[] pattern matching
- To: mathgroup at smc.vnet.net
- Subject: [mg4287] Re: Position[] pattern matching
- From: Harald Berndt <haraldb at nature.berkeley.edu>
- Date: Sat, 29 Jun 1996 03:54:50 -0400
- Organization: University of California Forest Products Lab
- Sender: owner-wri-mathgroup at wolfram.com
>
> 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.
Dave:
After reading many very helpful replies to this question (thank you
all), I believe your answer is a bit off the mark since
Position[fInfo,
x_ /; StringTake[x[[4]],1] == "L", {1},
Heads->False]
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
_______________________________________________________________
==== [MESSAGE SEPARATOR] ====