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 q17IVjAk026145 for ; Tue, 7 Feb 2012 19:31:47 +0100 Received: (qmail 23759 invoked by alias); 7 Feb 2012 18:31:40 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 07 Feb 2012 18:31:39 -0000 Received: from relay2.uni-heidelberg.de (EHLO relay2.uni-heidelberg.de) [129.206.210.211] by mx0.gmx.net (mx064) with SMTP; 07 Feb 2012 19:31:39 +0100 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id q17ITRen029894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Feb 2012 19:29:27 +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 q17Ge2WK001708; Tue, 7 Feb 2012 19:29:26 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1965034 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 7 Feb 2012 19:29:26 +0100 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id q17ITQXN026624 for ; Tue, 7 Feb 2012 19:29:26 +0100 Received: from neptune.ucc.ie (neptune.ucc.ie [143.239.153.183]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id q17ITDLu029682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 7 Feb 2012 19:29:18 +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 E2EFC20064 for ; Tue, 7 Feb 2012 18:29:36 +0000 (GMT) References: <20120202133153.GA16604@csmvddesktop> <20120203151218.GA30208@csmvddesktop> <4F2BFFA6.1020306@morningstar2.co.uk> <20120203155926.GA30436@csmvddesktop> <20120205160826.GA6939@csmvddesktop> <20120206054259.GB9462@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: <20120207183403.GA1694@csmvddesktop> Date: Tue, 7 Feb 2012 18:34:03 +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=5D7Q89H36p6sJLDpZh614LdjtwLz6vwIOlVDcITFYTle7r8uB5tvGDFRcNrJxwfsvt1tC u3gvloGgNd+2fsjiWFpuC2mRx0nD65XwmBrfe/Rd95vgnxz1s5tyR5oFdoREosGK9ZP8USTrZ0eG TOPQNypZohcAAqfgzy7QZuRAMrm8LIM/hdW1owckLG5SGpkkbxyVBaWL1M=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: 7032 * Bruno Le Floch [2012-02-06 04:26:24 -0500]: Hi Bruno, I'm starting to understand the problem with expandable caching. Still I may not understand your solution: : \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. Are you saying that you can cache _one_ result? Please explain if you have the time. I think there's a general expandable solution to this. Let's assume we want to compute f( n ). We compute is by computing f2( {}, n ). The first argument is the cache of f2. The value that's returned by f2 is a pair (c,r), where c is the last cache of f2 and r the result of f( n ). This seems very doable and I think it's possible to do it in a time complexity that is at most O( c^2 ), where c is the number of things that have to be cached. It's also possible to optimise the cache, in the sense that lookups for frequently looked up items are more efficient. I'll try and implement this for a toy example. If it proves successful, I'll incorporate it in the module I sent earlier on. BTW, there were a few minor errors in the module, which I've fixed. Please let me know if you want the module. Regards, Marc