Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: mergeSort with ReplaceRepeated

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100820] Re: mergeSort with ReplaceRepeated
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Sun, 14 Jun 2009 21:21:47 -0400 (EDT)
  • References: <h0vtii$737$1@smc.vnet.net>

Judging from your June 6 post, this is a homework assignment of yours.
I guess that given the code below you haven't learned enough of the
Mathematica language to come even close to solving it.

Since it is not the goal of this group to make your homework, I can
only advise you to learn the basics using the documentation included
with Mathematica before you endeavour in the more complicated stuff.

The code below doesn't work for one thing because it doesn't contain
an actual function definition. This is usually done using Set (=) or
SetDelayed (:=). Look them up in the documentation.

Cheers -- Sjoerd

On Jun 13, 12:04 pm, Luca Bedogni <bedogni.l... at gmail.com> wrote:
> Hi
>    I'm writing an implementation of mergesort using replacerepeated.
> This is actually the code:
> merge[{a1, arest___}, b : {b1, ___}] /; a1 >= b1 //. {merge[a1, arest, =
b1]
> :> merge[b1, a1, arest] };
> but it doesn't work, and I don't know why, because I'm really new to
> Mathematica.
>
> Any clue?
>
> Regards
> --
> Luca Bedogni



  • Prev by Date: Re: need a help
  • Next by Date: Re: Extracting contour values from ContourPlot
  • Previous by thread: mergeSort with ReplaceRepeated
  • Next by thread: Re: Re: mergeSort with ReplaceRepeated