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
Mime-Version:
1.0 (Apple Message framework v1081)
Content-Type:
text/plain; charset=iso-8859-1
Date:
Mon, 20 Sep 2010 19:58:35 +0930
Reply-To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Subject:
From:
Will Robertson <[log in to unmask]>
Message-ID:
In-Reply-To:
Content-Transfer-Encoding:
8bit
Sender:
Mailing list for the LaTeX3 project <[log in to unmask]>
Parts/Attachments:
text/plain (50 lines)
On 20/09/2010, at 6:39 PM, Lars Hellström wrote:

> 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;

Sorry for the bug. I don't anticipate further problems of this sort, since \ExplSyntax(On/Off) guards against it.

> another is that it suggests || and && may sensibly be mixed within the condition, which isn't the case either.

How do you mean they can't be mixed? The documentation gives the example

\intexpr_compare_p:n {1=1} && (
  \intexpr_compare_p:n {2=3} ||
  \intexpr_compare_p:n {4=4} ||
  \intexpr_compare_p:n {1=\error} % is skipped
) && !(\intexpr_compare_p:n {2=4})

> 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.

It would be straightforward to add these to the syntax; there's already \bool_not_p:n and \bool_xor_p:nn. No reason not to have both; I just prefer infix notation to

\bool_and_p:nnn
{ \intexpr_compare_p:n {1=1} }
{
  \bool_or_p:nnn
  { \intexpr_compare_p:n {2=3} }
  { \intexpr_compare_p:n {4=4} }
  { \intexpr_compare_p:n {1=\error} }
}
{ \bool_not_p:n { \intexpr_compare_p:n {2=4} } }



On 20/09/2010, at 7:40 PM, Chris Rowley wrote:

> My intuition is to agree with Lars, for the designs reasons he gives and because one mission of this language is that it is reasonably human understandable and consistent.
> 
> My prejudice is not to use things like ¦ &  because _I_ have never used them elsewhere

They're natural to me, but our mileages no doubt vary, as they say.

-- Will

ATOM RSS1 RSS2