Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with ESMTP id r5RGjg9S029900 for ; Thu, 27 Jun 2013 18:45:43 +0200 Received: from relay.uni-heidelberg.de ([129.206.100.212]) by mx-ha.gmx.net (mxgmx108) with ESMTP (Nemesis) id 0Lzq87-1UFWrb1lcB-0152k3 for ; Thu, 27 Jun 2013 18:45:37 +0200 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 r5RGgnD2019751 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 27 Jun 2013 18:42:50 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r5RDQ13m008895; Thu, 27 Jun 2013 18:42:48 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 10139518 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Thu, 27 Jun 2013 18:42:48 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r5RGgmA4005071 for ; Thu, 27 Jun 2013 18:42:48 +0200 Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com [74.125.82.51]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id r5RGgc2l019693 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Thu, 27 Jun 2013 18:42:41 +0200 Received: by mail-wg0-f51.google.com with SMTP id e11so754463wgh.18 for ; Thu, 27 Jun 2013 09:42:38 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.96.227 with SMTP id dv3mr6546972wib.59.1372351358587; Thu, 27 Jun 2013 09:42:38 -0700 (PDT) Received: by 10.194.6.105 with HTTP; Thu, 27 Jun 2013 09:42:38 -0700 (PDT) Content-Type: text/plain; charset=UTF-8 Message-ID: Date: Thu, 27 Jun 2013 12:42:38 -0400 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: "Joel C. Salomon" Subject: Defining \bool_case:nn 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-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:HccNaOQjZSI=:754bsox+5MHUixYIDeS/vq LqzHqwpULJwwtxHxuMybbsYoCyu5MouyOxIUboDQIFDlmagKOkuEqCkmfSISjlyS+WHZ4w3 yWoj9RiOXCKBtenpmpGIcXLhnt7yTET9hLsEIP29YbFEAl3PhCBA63hXljdQNRie4fJ/2LL mNjYt7aePjx0tLI4ToHrsylI2M9c44+EOTIBqfmrvvhoUZEWbZQBm/rHxV5PLzgiRM0nSHR 5ZpFiSN1TqgDwtN3czjnM1WdPWgG8vUtTpAYT9dOkP9RTVZpRmgMvXAJ4gu4k+gUJhtbP6/ rFWSJ0G9TEHYsfxCmWaL5PQWZKHXmGfzTXwq22/yoDOwqElWgGkDCA3MVcHRuAusoOSrciG Rwo6UVZ7pYR9fccDFm4n1+5JO3GdOhYmaRUvIoqGTf2m5rnNV+qa26t/WJ3UDDh2JoZpocF SModMs6huV672U7bvcNC+pwSXu/l4jqHX78hGe0bCpzNm6cX3JkKRi40Eip8lKQBWHVbQuA V1JuRk3mW8Qeit92jPX6BHmnkYcHKIb285FIX0KTxwnZ0AfNFXEpX4OgShzdDPAGNYZWxMM 5Mf5ylPZNR/NBnW2DES8ffTKDtYm6owLSRyNvLt0U0nkUHSMYhwlx+/4bHNDejo2w2V7zJB pfnw9JicZhxN9Fy5SIgCgOCInbIjHdCvVU/Ok1RU/O/RHQd8RLqZua44/3SW2jfvlzd4eey oGmczfIaGGZHjDiJGsgHwRBm9CK5WyI9X2uHTB83beHC6AQJ+9Q2AppheSbcdgDFKHRXgUo SQIX1SrHDtSl7ou94S2WjslYYC1k/rjWzq97mnBU31p4PONb+TdNZd80LJAaQ3uAJ65gHaB 0+YBpzl873nj9CqbvaRvvW1FPE0C4oYSffBqtHnpZJqrB/M7MjW6A0dj/4+nev0IIKHsfeR 63f216FlIzsD+y3pS6SK1iz7DWoSvM8mqCeMrCGHAKDRczPMkRONwJwiagfqDqoV7OFJSQT eYcPwJrroXNujKqb5E6MLivM41lxo80dgd2TLb/mn/8W46AGRikUF0ylSZ3LCjHXt3Gs/nY 3zsvymoaQ5AMTiWmQrzGIaz621nF0HY6+KbOGk80JeqFndLP1SaQOSWIKk981CmNPcT3Rus SQKXTpEvTRay1p4t3Zv6nPd8KPKt6HEuMhne95h6YombM8jrI1f0hgYfMLhSqPpEb9SMUHB /mnpc7JS0gDukD1AgcywxybcPqjFbEQAhq+5yuQPxSQzp5Pn15kaTUH9wY1ckdXcDOT37sZ sx4nYEhp4Ivh0t3q9YpRc+5TB3MMfYd9y5S+x2vyz00Uiym7wbR2kiueIHaWymcJBw42Anv qTTcRuArmNgtE3O8v2bCySVPdRg+lsfbK/3Wryi50KbnWN4OtC67NGtoSfhJAP9nONEEjTR a5INdS7fXMLHwa/rS23xfqwWXAngm9fMDCZa0/4ixZADFu7cAys6UfOMLKOPQbIb4Hjfeui OlhpqmD81qe51A+P6LD39hq1xE8W7SMWdTePw1S3G7VtapaUmCpePq+KwXn4nL51gFj9uDJ HMQRQYfUrRb0wqRpks7JsTHF1IPWbdo3ndoSqjJsERiQ7OapJf4EfpQlgYU= X-UI-Loop:V01:kLdoakYt5Ts=:jzVP6RIXmMxG8PDKQuQJNox8EJCMpGH1mx7kzfCN7d8= Status: R X-Status: X-Keywords: X-UID: 7209 Building on the TeX.SE posts "Is there a \bool_case:Nnn?" (http://tex.stackexchange.com/q/121074/2966) and Joseph Wright's answer to "How do the \xx_case: functions work?" (http://tex.stackexchange.com/q/121390/2966), here is \bool_case:nn, proposed for addition: \documentclass{minimal} \usepackage{expl3, xparse} \ExplSyntaxOn \cs_new:Npn \bool_case:nn #1#2 { \tex_romannumeral:D \__bool_case:w #1 \c_true_bool {#2} \q_recursion_stop } \cs_new:Npn \__bool_case:w #1#2 { \bool_if:nTF { #1 } { \__bool_case_end:nw {#2} } { \__bool_case:w } } \cs_new_eq:NN \__bool_case_end:nw \__prg_case_end:nw \NewDocumentCommand \testboolcase {} { \bool_set_false:N \l_tmpa_bool \bool_set_true:N \l_tmpb_bool \bool_case:nn { \l_tmpa_bool { false;~ can't~ happen } \l_tmpb_bool { true;~ should~ happen } } { else;~ can't~ happen } } \NewDocumentCommand \testboolcaseelse {} { \bool_set_false:N \l_tmpa_bool \bool_set_true:N \l_tmpb_bool \bool_case:nn { \l_tmpa_bool { false;~ can't~ happen } { !\l_tmpb_bool } { false;~ can't~ happen } } { else;~ should~ happen } } \ExplSyntaxOff \begin{document} \testboolcase \testboolcaseelse \end{document}