Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with SMTP id q19EUB4t032280 for ; Thu, 9 Feb 2012 15:30:12 +0100 Received: (qmail 5918 invoked by alias); 9 Feb 2012 14:30:06 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 09 Feb 2012 14:30:01 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx064) with SMTP; 09 Feb 2012 15:30:01 +0100 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id q19ERiqh004698 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Feb 2012 15:27:44 +0100 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id q19EGkkN007032; Thu, 9 Feb 2012 15:27:43 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1977623 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Thu, 9 Feb 2012 15:27:43 +0100 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id q19ERhRf025451 for ; Thu, 9 Feb 2012 15:27:43 +0100 Received: from neptune.ucc.ie (neptune.ucc.ie [143.239.153.183]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id q19ERM8R004557 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 9 Feb 2012 15:27:27 +0100 Received: from csmvddesktop (csmvddesktop.ucc.ie [143.239.74.97]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: dongen) by neptune.ucc.ie (Postfix) with ESMTPSA id 42F7E2029F for ; Thu, 9 Feb 2012 14:27:48 +0000 (GMT) References: <4F32E78F.6070903@morningstar2.co.uk> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="huq684BweRXVnRxX" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Message-ID: <20120209143214.GA13913@csmvddesktop> Date: Thu, 9 Feb 2012 14:32:14 +0000 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: dongen Subject: Re: Deprecated functions: \prg_quicksort: family To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <4F32E78F.6070903@morningstar2.co.uk> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (eXpurgate); Detail=5D7Q89H36p6doFuHYHiTvbQILj5cfPnFtH4TJV70eg9fnDvXZywUQC5zzHwyVtluydfBf iuzOxSrjzkCW5T0I7rXD6ylsIe30JFJ4xouJVedsDXgT+unuaDi7Fb1v/p+wMiOeAEHOEGcNana7 W/DaZGoY83qix9GwPCc/W3bMc1w6Rw+zgwprYcvMUY/ixMXQQq6Sfnlg3g=V1; X-Resent-By: Forwarder X-Resent-For: rainer.schoepf@gmx.net X-Resent-To: rainer@rainer-schoepf.de Status: R X-Status: X-Keywords: X-UID: 7036 --huq684BweRXVnRxX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * Joseph Wright [2012-02-08 21:22:23 +0000]: Hi Joseph, : The \prg_quicksort: family of functions have been deprecated, and will : be removed from l3kernel on or before 2012-05-31. : : Non-expandable but clearer functions are available in the experimental : l3sorrt, recently added to the LaTeX3 CTAN bundle. I'm attaching a clear and (unless I'm missing something) an expandable version of quicksort. I started implementing it when I saw your email. It was good fun. The actual definition takes 24 lines. The implementation is not stable. Please feel free to use/adapt/bin/etc. Regards, Marc van Dongen --huq684BweRXVnRxX Content-Type: text/x-tex; charset=us-ascii Content-Disposition: attachment; filename="qsort.tex" \documentclass{article} \usepackage{xparse} \usepackage{l3int} \usepackage{l3tl} \ExplSyntaxOn \DeclareDocumentCommand\qsort{ m }{ \qs_try:o [#1,] } \cs_new_nopar:Npn \qs_try:o[#1,#2]{% \tl_if_empty:nTF{#1} {} {\qs_try_partition:onoo [#2] {#1} [,] [,]} } % [#1] is the remainder of the list % #2 is the partition criterion % [#3] are the members less that the partition criterion % [#4] are the members greater than or equal to the partition criterion \cs_new_nopar:Npn \qs_try_partition:onoo [#1]#2[#3][#4]{ \tl_if_empty:nTF {#1} {\qs_recursive_sort:noo {#2} [#3] [#4]} {\qs_partition:onoo [#1]#2[#3][#4]} } % [#1,#2] is the remainder of the list % #3 is the partition criterion % [#4] are the members less that the partition criterion % [#5] are the members greater than or equal to the partition criterion \cs_new_nopar:Npn \qs_partition:onoo [#1,#2]#3[#4][#5]{ \int_compare:nNnTF {#3} > {#1} {\qs_try_partition:onoo [#2]#3[,#1#4][#5]} {\qs_try_partition:onoo [#2]#3[#4][,#1#5]} } % #1 is the partition criterion % #2 are the members less that the partition criterion % #3 are the members greater than or equal to the partition criterion \cs_new_nopar:Npn \qs_recursive_sort:noo #1[#2,#3][#4,#5]{ \tl_if_empty:nTF{#3}{}{\qs_try:o [#3],} #1 \tl_if_empty:nTF{#5}{}{,\qs_try:o [#5]} } \ExplSyntaxOff \begin{document} \qsort{1,9,2,3,8,8,6,8,9,0,5,9,4,7,1,2,7,8,9,8,9,1,2,8,1,1,8,5,3,4,8,9,2,5,1,8,9,2,5,1,% 1,9,2,3,8,8,6,8,9,0,5,9,4,7,1,2,7,8,9,8,9,1,2,8,1,1,8,5,3,4,8,9,2,5,1,8,9,2,5,1,% 1,9,2,3,8,8,6,8,9,0,5,9,4,7,1,2,7,8,9,8,9,1,2,8,1,1,8,5,3,4,8,9,2,5,1,8,9,2,5,1,% 1,9,2,3,8,8,6,8,9,0,5,9,4,7,1,2,7,8,9,8,9,1,2,8,1,1,8,5,3,4,8,9,2,5,1,8,9,2,5,1,% 1,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