ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: \doifanydefinedelse, \doifallundefinedelse
Date: Fri, 19 Nov 2021 23:56:10 +0100	[thread overview]
Message-ID: <1bc3f9ba-8a24-92ff-1a54-4bfd05874336@xs4all.nl> (raw)
In-Reply-To: <CAGxRUG_d3Tf6jVFnY=056_ifh2ph0m5pJmtS9HBgESs7z==B7A@mail.gmail.com>

On 11/19/2021 4:26 PM, Joey McCollum via ntg-context wrote:
> I was checking the "Branches and Decisions" wiki entry at 
> https://wiki.contextgarden.net/System_Macros/Branches_and_Decisions 
> <https://wiki.contextgarden.net/System_Macros/Branches_and_Decisions>, 
> and I saw that ConTeXt has a useful \doifalldefinedelse macro that 
> checks a comma-separated list of macro names and proceeds according to 
> whether or not all of the macros with those names are defined. I was 
> curious as to whether or not there is also a \doifanydefinedelse (or, 
> equivalently, a \doifallundefinedelse) macro that would check if /any 
> /of the macros with names in the comma-separated list is defined (or, 
> equivalently, if all of them are undefined). I don't see any mention of 
> such a macro on the wiki page, so I wanted to ask: has something like 
> this already been implemented, and if not, is there a simple way to do a 
> check like this? This functionality would be useful for performing some 
> checks on a key-value assignment, and passing a comma-separated list to 
> a macro would be much cleaner than doing a bunch of nested if-else blocks.
i'll add \doifelseallundefined

btw, you don't need to nest if's in lmtx:

\ifdefined\foo
\orelse\ifdefined\ofo
\orelse\ifdefined\oof
\else
\fi

sort of stays on the same level ... makes tex bit more like other 
programming languages (but of course also makes macros less impressive)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2021-11-19 22:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 15:26 Joey McCollum via ntg-context
2021-11-19 22:56 ` Hans Hagen via ntg-context [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1bc3f9ba-8a24-92ff-1a54-4bfd05874336@xs4all.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).