Re: Transformation Rules

*To*: mathgroup at smc.vnet.net*Subject*: [mg119731] Re: Transformation Rules*From*: Adriano Pascoletti <adriano.pascoletti at uniud.it>*Date*: Sun, 19 Jun 2011 07:25:20 -0400 (EDT)*References*: <201106181021.GAA15377@smc.vnet.net>

In[19]:= L = {22, 28, 21, 22, 18, 29, 15, 7, 29, 34, 38, 43, 21, 18, 32, 44, 35, 45, 0, 4}; m = -Infinity; L /. {x_Integer :> If[x > m, m = x, Sequence @@ {}]} Out[20]= {22, 28, 29, 34, 38, 43, 44, 45} Adriano Pascoletti 2011/6/18 Stefan Salanski <wutchamacallit27 at gmail.com> > Hey everyone, I found a sort of intro/tutorial notebook on my hard > drive that I must have downloaded a while ago. > "ProgrammingFundamentals.nb". I am not sure of the source, though the > author appears to be a Mr. Richard Gaylord. > > "These notes form the basis of a series of lectures given by the > author, in which the fundamental principles underlying Mathematica's > programming language are discussed and illustrated with carefully > chosen examples. This is not a transcription of those lectures, but > the note set was used to create a set of transparencies which > Professor Gaylord showed and spoke about during his lectures. These > notes formed the basis for both a single 6 hour one-day lecture and a > series of four 90 minute lectures, delivered to professionals and to > students." > > I sent it to a friend and recommended that he look through and try out > some of the exercises to become more familiar with Mathematica. It was > written in a previous version of Mathematica (dunno which, just not > 8), but still has a lot of great exercises to try out. (the only real > difference being the new implementation of RandomInteger and > RandomReal instead of Random[Integer] and Random[Real]) > > Anyway, I have gotten stumped on one of the Transformation Rule > exercises which I have restated below: > > Use a transformation rule to take a list of elements and return a > list of those elements that are greater than all of the preceding > elements in the list. > > How can this be done with transformation rules? > >

**References**:**Transformation Rules***From:*Stefan Salanski <wutchamacallit27@gmail.com>