MathGroup Archive 2006

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

Search the Archive

simple question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68643] simple question
  • From: corrallia81 at yahoo.com
  • Date: Mon, 14 Aug 2006 06:44:17 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,

I know it is simple but I can't find something.

In[1]:= lst=Range[10]
Out[1]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

In[2]:= Reverse[lst]
Out[2]={10, 9, 8, 7, 6, 5, 4, 3, 2, 1}

How we can get the same result with pattern matching?

My unsuccesful attempts include

In[9]:=Range[10]/.{x_,y___}->{y,x}

Out[9]={2, 3, 4, 5, 6, 7, 8, 9, 10, 1}

In[10]:=
Range[10]//.{x_,y___}->{y,x}

>From In[10]:=
ReplaceRepeated::"rrlim": "Exiting after \!\({1, 2, 3, 4, 5, 6, 7, 8,
9, \
10}\) scanned \!\(65536\) times."

Out[10]=
{7, 8, 9, 10, 1, 2, 3, 4, 5, 6}

Can I add something to previous rules to work?

Thanks for any help.


  • Prev by Date: workbench step return
  • Next by Date: Re: ListContourPlot3D and colors
  • Previous by thread: workbench step return
  • Next by thread: Re: simple question