* \doifanydefinedelse, \doifallundefinedelse
@ 2021-11-19 15:26 Joey McCollum via ntg-context
2021-11-19 22:56 ` Hans Hagen via ntg-context
0 siblings, 1 reply; 2+ messages in thread
From: Joey McCollum via ntg-context @ 2021-11-19 15:26 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Joey McCollum
[-- 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: \doifanydefinedelse, \doifallundefinedelse
2021-11-19 15:26 \doifanydefinedelse, \doifallundefinedelse Joey McCollum via ntg-context
@ 2021-11-19 22:56 ` Hans Hagen via ntg-context
0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen via ntg-context @ 2021-11-19 22:56 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Hans Hagen
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-19 22:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 15:26 \doifanydefinedelse, \doifallundefinedelse Joey McCollum via ntg-context
2021-11-19 22:56 ` Hans Hagen via ntg-context
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).