The macro IFEMPTY expects three arguments: a symbol, a true-list and a false-list. The macro evaluates to the true-list if the symbol is an empty string; otherwise, it evaluates to the false-list. A trivial example is the following:
IFEMPTY(something) \ 
    ("something" is supposedly nothing ?!?")
    ("something" is not an empty string)

In the same way, IFEMPTY can be used to test whether a macro expands to a non-empty string. A more elaborate example follows below. Say you want to define a bookref macro to typeset information about an author, a book title and about the publisher. The publisher information may be absent, the macro then typesets unknown:

DEFINEMACRO(bookref)(3)(\ 
Author(s):      ARG1
Title:          ARG2
Published by:   IFEMPTY(ARG3)(Unknown)(ARG3))

Using the macro, as in:

bookref(Helmut Leonhardt)
       (Histologie, Zytologie und Microanatomie des Menschen)
       ()

would of course supply Unknown in the Published by: line.


Return to Yodl's home page.

Please send Yodl questions and comments to yodl@icce.rug.nl.

Please send comments on these web pages to (address unknown), send other FSF & GNU inquiries and questions to gnu@gnu.org.

Copyright (c) 1998 Karel Kubat and Jan Nieuwenhuizen

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.


This page was built from Yodl-1.31.17 by

<(address unknown)>, at Thu May 4 11:39:13 2000 CEST.