Received: from mail.proteosys.com ([213.139.130.197]) by nummer-3.proteosys with Microsoft SMTPSVC(6.0.3790.3959); Thu, 12 Feb 2009 08:13:11 +0100 Received: by mail.proteosys.com (8.14.3/8.14.3) with ESMTP id n1C7EkKb018048 for ; Thu, 12 Feb 2009 08:14:46 +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 n1C78SgS003187 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 12 Feb 2009 08:08:29 +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 n1BN28kV011009; Thu, 12 Feb 2009 08:08:28 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 15.5) with spool id 168174 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Thu, 12 Feb 2009 08:08:28 +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 n1C78SnT022495 for ; Thu, 12 Feb 2009 08:08:28 +0100 Received: from rv-out-0708.google.com (rv-out-0708.google.com [209.85.198.244]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id n1C78NN0017106 for ; Thu, 12 Feb 2009 08:08:27 +0100 Received: by rv-out-0708.google.com with SMTP id k29so190216rvb.10 for ; Wed, 11 Feb 2009 23:08:23 -0800 (PST) Received: by 10.140.174.11 with SMTP id w11mr374184rve.83.1234422503299; Wed, 11 Feb 2009 23:08:23 -0800 (PST) Received: from ?129.127.15.244? ([129.127.15.244]) by mx.google.com with ESMTPS id k37sm22220924rvb.0.2009.02.11.23.08.20 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 11 Feb 2009 23:08:22 -0800 (PST) Content-Type: multipart/signed; boundary=Apple-Mail-2-564743778; micalg=sha1; protocol="application/pkcs7-signature" Mime-Version: 1.0 (Apple Message framework v930.3) References: <956A99D8-D534-4E72-B784-47F867038030@gmail.com> X-Mailer: Apple Mail (2.930.3) X-Spam-Whitelist: Message-ID: <6B8546AF-AA17-414A-93BF-35B38A59EEE2@gmail.com> Date: Thu, 12 Feb 2009 17:38:17 +1030 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Will Robertson Subject: Re: token_if_expandable To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <956A99D8-D534-4E72-B784-47F867038030@gmail.com> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-ProteoSys-SPAM-Score: -4 () RCVD_IN_DNSWL_MED X-Scanned-By: MIMEDefang 2.65 on 213.139.130.197 Return-Path: owner-latex-l@LISTSERV.UNI-HEIDELBERG.DE X-OriginalArrivalTime: 12 Feb 2009 07:13:11.0548 (UTC) FILETIME=[5D2C3BC0:01C98CE1] Status: R X-Status: X-Keywords: X-UID: 5654 --Apple-Mail-2-564743778 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On 12/02/2009, at 5:00 PM, Will Robertson wrote: > Having some more troubles, this time with \token_if_expandable. > Unfortunately, the only token I can find that trips this "true" is > \relax or \scan_stop:, which isn't exactly what I thought the > intended behaviour was supposed to be. After searching through c.t.t. for a while, I found an insane thread talking about this sort of thing: Dan Luecking's comment is that \expandafter\ifx\noexpand#1#1 "seems a feasible test for expandability of a token". I'm in a rush, and might be barking up the wrong tree here, but here's a re-implementation of \token_if_expandable that *seems* to behave in a more coherent manner. The big kicker is that it only returns true for tokens that will expand into something else -- regardless of whether they are able to be fully expanded or not. And really, who could expect anything more? Will \def:Npn \token_if_expandable_p:N #1{ \cs_if_exist:NTF #1 { \exp_after:NN \if_token_eq:NN \exp_not:N #1 #1 \c_false \else: \c_true \fi: } {\c_false} } \def_test_function:npn {token_if_expandable:N} #1{ \if:w\token_if_expandable_p:N#1} \token_if_expandable:NTF \FOOOO {T}{F} \token_if_expandable:NTF a {T}{F} \token_if_expandable:NTF \foo {T}{F} \token_if_expandable:NTF \the {T}{F} \par \def\foo{bar} \expandafter\ifx\noexpand\foo\relax T\else F\fi \expandafter\ifx\noexpand\the\relax T\else F\fi \expandafter\ifx\noexpand\FOOO\relax T\else F\fi \catcode`\z=13 \def z{\write18{ls}} \expandafter\ifx\noexpand z\relax T\else F\fi \par \expandafter\ifx\noexpand aa T\else F\fi \expandafter\ifx\noexpand\message\message T\else F\fi \expandafter\ifx\noexpand\write\write T\else F\fi --Apple-Mail-2-564743778 Content-Disposition: attachment; filename=smime.p7s Content-Type: application/pkcs7-signature; name=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGITCCAtow ggJDoAMCAQICECN4qE5kBXLk2f/jVDfSZPwwDQYJKoZIhvcNAQEFBQAwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA5MDEyOTA1NDkxNVoXDTEwMDEyOTA1NDkx NVowQjEfMB0GA1UEAxMWVGhhd3RlIEZyZWVtYWlsIE1lbWJlcjEfMB0GCSqGSIb3DQEJARYQd3Nw cjgxQGdtYWlsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL0BeSiAbKuqxeRN p2qn/m8ZL+xawr/WXyPgEF0FipWgRe9l3sMXcFHokcUu0xOc97R7xkUsGcQ8EyybGHuWey6x7X1Y xJZXnoAxqcaG+eREytoYGMIKs6BhEEogLVb2ERw3lQNVnOzanSFeGo8suMAN4zzCtqAjJiA1ph7h 1pksTgECYK5EiIZbFsB6zSDa8crNk404z1CfIA6YO8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