Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by h2774747.stratoserver.net (8.15.2/8.15.2/Debian-3) with ESMTP id x0S5hX7m008034 for ; Mon, 28 Jan 2019 06:43:34 +0100 Received: from relay.uni-heidelberg.de ([129.206.100.212]) by mx-ha.gmx.net (mxgmx114 [212.227.17.5]) with ESMTP (Nemesis) id 1MzRXs-1h9uHA1v3w-00vM4w for ; Mon, 28 Jan 2019 06:43:28 +0100 Received: from listserv.uni-heidelberg.de ([129.206.100.94]) by relay.uni-heidelberg.de with ESMTP; 28 Jan 2019 06:43:28 +0100 Received: from listserv (localhost [127.0.0.1]) by listserv.uni-heidelberg.de (Postfix) with ESMTP id 18AC0126550; Mon, 28 Jan 2019 06:43:26 +0100 (CET) Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 32889007 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 28 Jan 2019 06:43:25 +0100 Delivered-To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE Received: from listserv (localhost [127.0.0.1]) by listserv.uni-heidelberg.de (Postfix) with ESMTP id AF9CC126847 for ; Mon, 28 Jan 2019 06:43:25 +0100 (CET) Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Message-ID: <2480487960532772.WA.kellysmith12.21gmail.com@listserv.uni-heidelberg.de> Date: Mon, 28 Jan 2019 06:43:25 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Kelly Smith Subject: Manipulating (Simple) Datatypes in expl3 To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-Spam-Flag: NO X-UI-Filterresults: notjunk:1;V03:K0:UEL3vffer0w=:FEDiaD4pGSt3Toj4gyKYojssgK bqHjlwusWKIfkh/rah4d4FhzZdCfMO/debhh6MQ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/xI=:0GUyZVtgquUsTOpS0LAaSP H7coG0MUHYla0e0nD3OUiaV9fm9dXWzKc5tvqNmq3TCR7QKQGiHBWkeuhi5c99r15A88S0gk/ YuAlg4Au/xUUomf30Lu/gHXu7DyVczMJlwltAJIinrPhOH1q4ZT7MXUURVBL5jxJ2OyMK7wvN 8vTYeYXNlj0sZOcViU90YXMOAnQ5xZFTzH7KN1sAzXkneBAPiELRqNgTgmDBaWD6FBNEqhNWI e7ghBdFx1nChlfx4VTfE1dNUk3yVM5XfD084CJqin1I7orra3vfKJg/P0fkQvkL9TiWM0CCH8 7G8UAciX3xfh0EbP/qYD6hcO3Q378QIitImMwnpsEzJocdjJKtOUctS9K5XoIXzcQvmETHWoh q6nV0sEeo9T//OqYuynTqj6+IT9VuO00iWs6nxVN8/TBtglFYUUMx08RTFTYbKRKCw+bxw13z AcezYy2YGw== X-Scanned-By: MIMEDefang 2.78 on 81.169.212.23 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by h2774747.stratoserver.net id x0S5hX7m008034 Status: R X-Status: X-Keywords: X-UID: 8162 Hello, While trying to think through some questions about how to best implement my class, I decided to do some practice with expl3 and write a little datetime package. (For some reason, regularly switching between a few projects works better than focusing on just one.) I should note that I’ve changed my mind about several comments regarding dates and times that I made several months ago. I mention this because it pertains to the implementation and my question… I represent a date with a token list containing a triple: {}{}{} where each field is an integer expression. I know that a scan mark “header” is used in the implementation of several expl3 datatypes but I think that is unnecessary for this because the data has a single, finite structure and does not require Of course, functions that operate on dates need the separate fields: some sort of extraction function is necessary. For functions that apply to one date, I use: \__date_extract:NN where #1 is a function expecting the three integer fields and #2 is the date variable. For functions involving two dates, I have: \__date_extract:NNN where #1 is a function expecting the six integer fields and #2 and #3 are the date variables. I have discovered that there are several ways to implement the extraction functions but I am unsure of which is considered best practice. Here I’m listing three different approaches that I found that work expandably and don’t use low-level fucntions. Since the one and two date cases are similar, I’m excluding the one date implementations for brevity. 1. This approach trivial in the one date case but is not much more involved in the two date case: \cs_new:Nn \__date_extract:NNN { \exp_last_unbraced:NNNV \exp_last_unbraced:NV #1 #2 #3 } 2. This approach is extremely general: \cs_new:Nn \__date_extract:NNN { \exp_last_unbraced:Ne #1 { \exp_not:V #2 \exp_not:V #3 } } 3. This approach, I think, is not quite as clear in its intent: \cs_new:Nn \__date_extract:NNN { \__date_extract_aux:NVV #1 #2 #3 } \cs_new:Nn \__date_extract_aux:Nnn { #1 #2 #3 } \cs_generate_variant:Nn \__date_extract_aux:Nnn { NVV } of course, \exp_args:NNVV could be used directly instead of defining a variant here. Of these, which would be considered the best approach? Warmly, Kelly