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 q12DH7JF020031 for ; Thu, 2 Feb 2012 14:17:08 +0100 Received: (qmail 11613 invoked by alias); 2 Feb 2012 13:17:02 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 02 Feb 2012 13:17:02 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx013) with SMTP; 02 Feb 2012 14:17:02 +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 q12DF3Li023719 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Feb 2012 14:15:03 +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 q12DBtkb005897; Thu, 2 Feb 2012 14:15:02 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 2038912 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Thu, 2 Feb 2012 14:15:02 +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 q12DF2pe007450 for ; Thu, 2 Feb 2012 14:15:02 +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 q12DE0IK023071 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 2 Feb 2012 14:14:04 +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 24E32201A9 for ; Thu, 2 Feb 2012 13:14:16 +0000 (GMT) References: <20120202102957.GB14566@csmvddesktop> <4F2A68F9.1010508@morningstar2.co.uk> <20120202111808.GA15304@csmvddesktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Message-ID: <20120202131844.GA16372@csmvddesktop> Date: Thu, 2 Feb 2012 13:18:44 +0000 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: dongen Subject: Re: Mapping Functions Versions for All and Some To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (eXpurgate); Detail=5D7Q89H36p6sJLDpZh614Kjz2nt6F3tHeZLX5vbFnxgbJQZGZmsYpLaVU8FvDfB4tTJNA KGGdeG2Sn6nY81so49+Po4rqVGapiWs20kGCkKimTIEGWUpD+8azMH7RwExb8bzGbjLYxhXoXtZs UmDPMmX9oCdeTylnFJ9M7PxGZU4H6Nx3FkNrDwEtYczSDpdRTxm533ZQJw=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: 7005 * Bruno Le Floch [2012-02-02 07:32:27 -0500]: : Like Joseph, I don't see how useful the functions you propose are. Do : you have a precise use case? I think that what you propose can be done : (in the non-expandable case) as (say for the "some" version): : : \bool_set_false:N \l_my_bool : \tl_map_inline:Nn \l_my_tl : { : \my_conditional:nT {#1} : { : \bool_set_true:N \l_my_bool : \prg_map_break: : } : } : \bool_if:NTF \l_my_bool : { } : { } Thanks Bruno. I have a question if you don't mind. On stack exchange there's a question that asks how to compute some values that satisfy a recurrence equation. I'm currently implementing a macro that lets a user define these recurrence equations and then generates a macro that solves the recurrence. I'm trying to do this with expl3. Your regex module has turned very useful. (This exercise is related to the pattern matching programming I was referring to earlier.) For example, at the moment, I can parse the following: \NewRecDef{myA}{a[0]=1, a[1]=1, a[i]=a[i-1]+a[i-2]} The purpose of this macro call is to define a macro called \myA that solves the recurrence. I've only just started and it works for the base cases: \myA{0} -> 1 and \myA{1} -> 1. It's not much, but it's a start:-) I also want to be able to write: \NewRecDef{myA}{a[i]=1 | 0 <= i && i <= 1, a[i]=[i-1]+a[i-2]} which is equivalen to \NewRecDef{myA}{a[i]=1 | 0 <= i && i <= 1 a[i]=[i-1]+a[i-2] | true} The parts after the | symbols are guards, which are conditions that need to be satisfied before the computation rule can be applied. Now here is the question. What I'd like to know if there's an easy way for a substitution of the form a[expression] -> \csname myA[expression]\endcsname If there is an easy way to do this than this simply lets me apply the substitution to the guard expressions and they then give me the conditions that need to be satisfied before I can return the ``result'' (the text between the = and the |). Of course, I also have to make the substitution in the result. Any help would be much appreciated. NOTES: o For the moment, I want to implement this for recurrence equations in one argument but implementing it for more arguments is techically equivalent. o Using an external program to generate the LaTeX is trivial. I've done similar things several times. the challenge is doing it from within LaTeX with expl3, l3regex, and l3int. o If this approach works, I think it may be a nice possible alternative for defining macros that depend on tokens and return tokens. Regards, Marc