Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #3187
| From | Arturas Acus <Arturas.Acus@tfai.vu.lt> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Transformation Rules |
| Date | 2011-06-19 23:29 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <itm0oq$14e$1@smc.vnet.net> (permalink) |
| References | <201106181013.GAA15251@smc.vnet.net> |
Dear Stefan,
something like this:
In[1]:= data = Table[RandomInteger[{1, 20}], {20}]
Out[1]= {3, 8, 20, 20, 18, 11, 15, 18, 8, 10, 12, 9, 9, 5, 14, 3, 9, \
5, 15, 3}
In[2]:= (data //. {a_, b_, c__} :> {Flatten[Append[{a}, b]], c} /;
OrderedQ[Flatten[{a, b}]]) // First // Flatten
Out[2]= {3, 8, 20, 20}
On Sat, 18 Jun 2011, Stefan Salanski wrote:
> 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?
>
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Transformation Rules Arturas Acus <Arturas.Acus@tfai.vu.lt> - 2011-06-19 23:29 +0000
csiph-web