-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Perdón por contestarme a mí mismo, pero mirá a quién encontré :-( - --begin quote-- http://research.microsoft.com/fse/asml/samples/QuickSort/QuickSort.asml.cont... Copyright (C) Microsoft Corporation. All rights reserved. 1. Quicksort Here is Hoare's quicksort using sequence comprehensions: bar(xs as Seq of Integer) as Seq of Integer ~ return xs qsort(s as Seq of Integer) as Seq of Integer ~ if s = [] then ~ return [] ~ else ~ pivot = Head(s) ~ rest = Tail(s) ~ return qsort([y | y in rest where y < pivot]) + ~ [pivot] + ~ qsort([y | y in rest where y >= pivot]) A sample main program sorts the Sequence [7, 8, 2, 42] and prints the result: Main() ~ WriteLine(ToString(qsort([7, 8, 2, 42]))) The call to ToString is just to work around a current problem in the AsmL2 compiler. Gerardo Díaz wrote: | | | Ignacio Vissani wrote: | | El autor de Quicksort es C.A.R.Hoare (Wikipedia!) | | | | Ténquiu (acabo de poner el crédito correspondiente en la | rutina y un display por pantalla cuando `sorteo', quedó | re-pituco) | | - -- - -- Gerardo Díaz - ----------------- Asociáte a SOLAR! Software Libre Argentina http://www.solar.org.ar/breve.php3?id_breve=78 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.2 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQFBgPEkLHLbx9ffmf8RAmlvAJ443t8xCliMBZMCSKRL3uUCxv0QbACglgeF 7v0hW9UxM0Bf3dDNZjR8z6E= =CMo5 -----END PGP SIGNATURE-----