MathGroup Archive 2006

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

Search the Archive

Re: A question about pattern-matching

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63758] Re: A question about pattern-matching
  • From: "Ray Koopman" <koopman at sfu.ca>
  • Date: Fri, 13 Jan 2006 04:48:57 -0500 (EST)
  • References: <djcgcs$6du$1@smc.vnet.net><200510230946.FAA10826@smc.vnet.net> <43C56577.2000905@mail.wsu.edu> <dq5450$ad9$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In[1]:=
t = {{-90, {{60493, 0.061}, {62493, 0.15881}, {64493.5, 0.559}}},
     {-88, {{62493, 0.151}, {64493., 0.61617}, {65993.4, 0.171},
            {68993.10, 0.06}}},
     {-86, {{62493.75, 0.14}, {64493.55, 0.61440}, {65993., 0.18},
            {67993, 0.0}, {68993.100, 0.06448}}}};

In[2]:= t /. {_, x_?AtomQ} -> x /. {_, x_List} -> x

Out[2]= {{0.061,0.15881,0.559}, {0.151,0.61617,0.171,0.06},
         {0.14,0.6144,0.18,0.,0.06448}}

gardyloo wrote:
> As a quick  postscriptum, I found a somewhat similar question in the
> Student Support forums, from '99, where a similar problem was called a
> "known issue", but I wasn't sure whether I could massage the suggested
> solution into a form suitable for my problem.
>
>    Incidentally, I can solve the problem very simply by first extracting
> the second column of testList, and then using a pattern replacement on
> that, but that's not the spirit of my original question.
> 
>                   Thanks,
>                         C.O.


  • Prev by Date: Re: Confusing behaviour with caching of evaluated expressions ?
  • Next by Date: Re: Confusing behaviour with caching of evaluated expressions ?
  • Previous by thread: Re: A question about pattern-matching
  • Next by thread: Re: A question about pattern-matching