LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Mon, 20 Sep 2010 11:09:08 +0200
Reply-To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Message-ID:
Subject:
MIME-Version:
1.0
Content-Transfer-Encoding:
8bit
In-Reply-To:
Content-Type:
text/plain; charset=windows-1252; format=flowed
From:
Lars Hellström <[log in to unmask]>
Parts/Attachments:
text/plain (52 lines)
Will Robertson skrev 2010-09-20 01.57:
> On 20/09/2010, at 6:41 AM, Arno Trautmann wrote:
>
>> \ExplSyntaxNamesOn
>> \bool_if_p:n{
>> \intexpr_compare_p:n {2=3} ||
>> \intexpr_compare_p:n {4=4}
>> }
>> \ExplSyntaxNamesOff
>>
>> \end{document}
>>
>> In SyntaxNames, I get the error
>>
>> ! Use of \bool_|_0:w doesn't match its definition.
>> <argument>   \intexpr_compare_p:n {2=3} ||
>>                                           \intexpr_compare_p:n {4=4}
>> l.16 }
>>
>> The use of&&  is successfull in both cases, though. I guess this is
>> because the line in ExplSyntax:
>>
>> \tex_catcode:D 124=11 \tex_relax:D % vertical bar, other
>>
>> is missing in SyntaxNames.
>> So is it intended that boolean expressions cannot be fully evaluated in
>> SyntaxNames? Or didn’t anybody have requested this yet?
>
>
> I'd like to hear the opinions of the others; I guess this is an edge case to using SyntaxNames. Ideally, perhaps, we should make \bool_if:n more robust so the catcode of | isn't as critical.

My opinion, if anyone cares, is that using && and || at all in the 
syntax of \bool_if_p:n is stupid eye-candy. The stated situation is 
just one of the ways in which it leads to problems; another is that it 
suggests || and && may sensibly be mixed within the condition, which 
isn't the case either.

The natural way to express AND or OR of a bunch of boolean conditions 
in a macro language such a LaTeX is the LISPish one: have 
macros/functions whose meaning is "AND of my arguments" and "OR of my 
arguments". IIRC, that would be

   \bool_and_p:nn{<predicate 1>}{<predicate 2>}
   \bool_or_p:nn {<predicate 1>}{<predicate 2>}
   \bool_and_p:nnn{<predicate 1>}{<predicate 2>}{<predicate 3>}
   \bool_or_p:nnn {<predicate 1>}{<predicate 2>}{<predicate 3>}
   ...

for as long as one likes to continue that list.

Lars Hellström

ATOM RSS1 RSS2