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 q169SiBC007181 for ; Mon, 6 Feb 2012 10:28:45 +0100 Received: (qmail 3475 invoked by alias); 6 Feb 2012 09:28:39 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 06 Feb 2012 09:28:39 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx109) with SMTP; 06 Feb 2012 10:28:39 +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 q169QUBW032651 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 6 Feb 2012 10:26:30 +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 q168ropQ011310; Mon, 6 Feb 2012 10:26:29 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1951093 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 6 Feb 2012 10:26:29 +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 q169QTOV030142 for ; Mon, 6 Feb 2012 10:26:29 +0100 Received: from mail-lpp01m010-f49.google.com (mail-lpp01m010-f49.google.com [209.85.215.49]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id q169QPVi032613 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Mon, 6 Feb 2012 10:26:29 +0100 Received: by laam7 with SMTP id m7so4109193laa.22 for ; Mon, 06 Feb 2012 01:26:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.106.227 with SMTP id gx3mr8992852lab.45.1328520384913; Mon, 06 Feb 2012 01:26:24 -0800 (PST) Received: by 10.152.13.106 with HTTP; Mon, 6 Feb 2012 01:26:24 -0800 (PST) References: <20120202131844.GA16372@csmvddesktop> <20120202133153.GA16604@csmvddesktop> <20120203151218.GA30208@csmvddesktop> <4F2BFFA6.1020306@morningstar2.co.uk> <20120203155926.GA30436@csmvddesktop> <20120205160826.GA6939@csmvddesktop> <20120206054259.GB9462@csmvddesktop> Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Whitelist: Message-ID: Date: Mon, 6 Feb 2012 04:26:24 -0500 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Bruno Le Floch Subject: Re: Mapping Functions Versions for All and Some To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <20120206054259.GB9462@csmvddesktop> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (BackTrace mail analyze); Detail=5D7Q89H36p4L00VTXC6D4q0N+AH0PUCnGL2vqOgpaBYL16oitsMrgDt/NQNpSCZFFjDOy 97xb7Zpf+wZnd5ZXNcvLDXR3Wg3wRjdQbwEMh8=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: 7024 Hi Marc, > I've incorporated most of your changes but some don't work, most are > related to regex. BTW, some of your suggestions in relation to regex > are not documented. For example, \u. Update your l3experimental bundle. This is a very recent feature. It appears to be documented (and hopefully working) in the version on CTAN (and it got partially reimplemented since then on the svn I think). > As it stands, the output that's generated by \meaning looks OK, but it > isn't. I don't know enough of plain TeX to know why, but I suspect it > has to do with (regex) substitutions that involve \#1. The following > paragraph explains why. The output isn't correct because it produces strings of characters with category code "other", somewhat like \verb does: \verb+\def\foo#1{#1}+ will just typeset those characters. In the same way, \regex_replace_once:nnN { .* } { \\def\\foo\#1\{\#1\} } \l_tmpa_tl \tl_show:N \l_tmpa_tl % seems ok, but \tl_use:N \l_tmpa_tl \cs_show:N \foo % didn't define \foo! will simply typeset \def\foo#1{#1}. You need to use \regex_replace_once:nnN { .* } { \c{def} \c{foo} \cP\# 1 \cB\{ \cP\# 1 \cE\} } \l_tmpa_tl \tl_show:N \l_tmpa_tl % looks the same \tl_use:N \l_tmpa_tl \cs_show:N \foo % defined \foo! after updating your l3str bundle (probably by updating the whole l3experimental bundle). > : (5) Of course you know it, this code will run exponentially slowly for > : large input. That is difficult to solve (but doable; I can give > : details) if you want an expandable function which expands to the value > : of your recursion. For a non-expandable function of the form > : \recursion_get_value_f:nN { } (dunno how the > : function should be called), getting a linear-time solution should be > : easier: it involves storing the intermediate results as you get them. > > Thanks. I know the solution. As soon as everything works, I want to > provide a flag, which the user can use to tell whether or not to cache > the previously computed values. I think you are missing something here. If you want \f{4} to _expand_ to the result, then you cannot perform any assignment, since assignments cannot be made expandably. So caching is (almost) out of the question. It may be better to take an approach such as \DeclareDocumentCommand{\f}{om} { \IfValue{#1} { \tl_set:NV #1 \l_recurrence_result_int } { \int_use:N \l_recurrence_result_int } } Then, \f{4} % typesets 5 \f[\tmp]{4} % stores 5 in \tmp. > Thanks. I now understand. When I'll provide my remaining comments about > the expl3 documentation I'll once more give some comments about that > part of the documentation. I think the documentation is right but it's > not clear for somebody who is new to the matter. (Or for that sake, > somebody like me who doesn't know enough low-level TeX. It would be > nicer if the documentation could be explained without reference to TeX. > I think it should be possible.) That would be helpful. Our goal is indeed to make the documentation clear to someone who doesn't know TeX programming. > That doesn't work. If I use > > \cs_new_nopar:cpx {\recurrence_case_name:n {\l_recurrence_case_count_int > - 1}} ##1{ > > I get a run time error, even for f{0}. I haven't had the time to look into > it but > I'll do it when everything else works. (Saving the variable is my least > concern.) It works if you define \recurrence_case_name:n using \int_eval:n internally (take the definition of \recurrence_case_name:N and replace \int_use:N #1 by \int_eval:n {#1}, IIRC). > \cP\# doesn't work. I get the following error: > > Illegal parameter number in definition of \regex_replacement_tl:n. This bug was fixed a couple of weeks ago after Enrico Gregorio pointed it out to me. > l_recurrence_name_tl is indeed the one. I tried \u{l_recurrence_name_tl} > but then the substitution didn't work at all. As said above, \u is recent, update to the latest CTAN release. > I tried \c{\u{l_recurrence_name_tl}:n} as well but again, the substitution > didn't work at all. idem. Regards, Bruno