Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by h1439878.stratoserver.net (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id t77GkeTQ026298 for ; Fri, 7 Aug 2015 18:46:41 +0200 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx007) with ESMTPS (Nemesis) id 0MADl3-1ZZ0Ff2IOX-00BKXe for ; Fri, 07 Aug 2015 18:46:34 +0200 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 t77GifJj029141 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 7 Aug 2015 18:44:41 +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 t77GKgO9022256; Fri, 7 Aug 2015 18:44:41 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 12538180 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 7 Aug 2015 18:44:41 +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 t77GieeO023482 for ; Fri, 7 Aug 2015 18:44:40 +0200 Received: from mail-io0-f181.google.com (mail-io0-f181.google.com [209.85.223.181]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id t77GiYPC024664 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Fri, 7 Aug 2015 18:44:38 +0200 Received: by ioeg141 with SMTP id g141so117030869ioe.3 for ; Fri, 07 Aug 2015 09:44:34 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.107.128.147 with SMTP id k19mr9846081ioi.133.1438965874252; Fri, 07 Aug 2015 09:44:34 -0700 (PDT) Received: by 10.36.81.201 with HTTP; Fri, 7 Aug 2015 09:44:34 -0700 (PDT) References: <55A8C0C2.3040908@morningstar2.co.uk> <20150717095912.GA6487@hzdr.de> <55A8E267.1030901@morningstar2.co.uk> <20150717140025.GA10619@hzdr.de> <55A90BC0.6020102@morningstar2.co.uk> Content-Type: text/plain; charset=UTF-8 Message-ID: Date: Fri, 7 Aug 2015 18:44:34 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Bruno Le Floch Subject: Re: expl3 boolean expressions: lazy evaluation To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: 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:lv6mVkZhXdk=:Omr7pOv7hNic3aZoe1reMaFELk fKqw/5Vfn+4lRvw2Tmfg79A649KesCtnBiQV01JzjJmq3ed/Pnp266+oYwePbl6BXpPvlUo84 h2HBD/JYSWTcHp/agpBEyk9qJkSbKm3ikuLUdUp+fl+B6eU4WOknWgsou2O51h8GIpl87ek4k L/FZCTFa0TtP+nG6nJ3GRK12wc/l65xQtoHzLHuI/d1cFVXJPUZ7TRf8d+ZfWCSUPoyaEsvO6 OaRi7X42MwNKpne1t5RrYpn/QQBLXs3icRRF0Vvr4eCzgRHVC+imEG+KwefoHyhn4cXfxcdCi RCTRlcTEpLa2erUew8T1oTeGBIY9KzQyR3aZl9JosimCbJl0ipbp0VhJJE6SgPKoCUOtIkDnj AGelPdROkWq1BwaDJtFMec9TUPrdzn7EMZfk5SgcLE7TdZM89sfas6DlgoWkoTzlMWr0IJnar wChn+/WD7I47euc3BVVX8mAWd2/XjaTzoC1gJH1VINkAo7pi6HP23Zl55D4IBbqghhFjvPep3 kvGuVJmc5Iz3AHKtNuPYcCnOtADIH9UVwj+c6adDDvW2FEkpEKCPACbaqtKWQJrvH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cypR8GxZpnW3P GZEFjFeUn47FA4Z1AIULsM8gaVKNFnZLZZgV8r7UTnFZYC+LSg1Js2tfiNe+o8V9mv6TsKWtu MgpH92Sc5W18Y89xhoad/ry1PMySE2kGBnSXh6LXrYNmkpJs50zxwocIaIhlCOoUDGJoUCesS bcCONabF//XP505uDp4tjCjWMFGa7mToiWX+sbPR+UwPlXMnyJ/kKissUFERn7nHfpLpkv5hI nFu20UShnd9d4Tnb4+Zk+5RUw1/u/0jQvGOvkhC8Z3INWGulPjNbBbRkHp6t15DkTvJkptpJ4 9lXk/xiU2R1KE/yloTuKoZTtjjZcrJaNJxAcOPyoLG/8GvMz4fuHX6jPxD3RFUCv/DUsMz3wg XdoA58Vgp/2GSWYnxfUYwR/CozqHb6CiNb43qViOIERJLIcALCNcqH3oQX9+D1hC2N2rt7ne5 laKtfIe9z0qvjvuBlaMVSOy4hLEVuzWfJp/ZLb9WvoeGlT3plwCM X-Scanned-By: MIMEDefang 2.71 on 85.214.41.38 Status: R X-Status: X-Keywords: X-UID: 7817 Hi Sean, hi all, Thank you for your thoughts. I arrive at the following proposal: no lazy evaluation by default, and provide \bool_or_p:nn and \bool_and_p:nn for lazy evaluation (perhaps even called \bool_lazy_or_p:nn and \bool_lazy_and_p:nn). The example you gave would become > A and B will short-circuit as they do today. If A is false, B through > E will not be evaluated. If A is true and B is false, ... etc. > > If ( A && B && !C), we'll get to [...] *without* short-circuiting. \bool_if:nF { \bool_and_p:nn { \pbj_is_peanut_butter_jelly_time_p: } % (A) { \bool_and_p:nn { \pbj_can_dance_p: } % (B) { ! \bool_or_p:nn { \pbj_has_suit_p:N \g_tmp_person } % (C) { \token_if_eq_meaning_p:NN #1 ? || % (D) \token_if_eq_meaning_p:NN #1 ! % (E) } } } } { dance ~ like ~ there's ~ no ~ tomorrow } Alternatively to get less nesting in long lists of A && B && C && D && E && F, we could provide \bool_and_p:n and \bool_or_p:n in which tests are wrapped in brace groups, \bool_and_p:n { { \test_one_p: } { \test_two_p: } { \test_three_p: } { \test_four_p: } } We could even provide both \bool_and_p:nn for binary && and \bool_and_p:n for lists, but perhaps it gets confusing that the two are only distinguished by their signature :nn or :n. I'd rather not provide myself a parser for lazy evaluation of boolean expressions (e.g., an implementation of the shunting yard algorithm as you mention). Does that seem like a good plan? Regards, Bruno