ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Joey McCollum via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Joey McCollum <jmccollum20140511@gmail.com>
Subject: \doifanydefinedelse, \doifallundefinedelse
Date: Fri, 19 Nov 2021 10:26:33 -0500	[thread overview]
Message-ID: <CAGxRUG_d3Tf6jVFnY=056_ifh2ph0m5pJmtS9HBgESs7z==B7A@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 984 bytes --]

I was checking the "Branches and Decisions" wiki entry at
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.

Joey

[-- Attachment #1.2: Type: text/html, Size: 1134 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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 15:26 UTC|newest]

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

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='CAGxRUG_d3Tf6jVFnY=056_ifh2ph0m5pJmtS9HBgESs7z==B7A@mail.gmail.com' \
    --to=ntg-context@ntg.nl \
    --cc=jmccollum20140511@gmail.com \
    /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).