<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style>
<!--
@font-face
{font-family:Wingdings}
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif"}
span.EmailStyle17
{font-family:"Calibri","sans-serif";
color:windowtext}
.MsoChpDefault
{font-family:"Calibri","sans-serif"}
@page WordSection1
{margin:1.0in 1.0in 1.0in 1.0in}
ol
{margin-bottom:0in}
ul
{margin-bottom:0in}
-->
</style><style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1" lang="EN-US" link="blue" vlink="purple">
<div style="direction: ltr;font-family: Courier New;color: #000000;font-size: 12pt;">
<span style=""><span id="spnFrom" class="rwRRO" _e_ondblclick="onDblClkReadRcp(event);" _e_onclick="onClkRcp(event);" _e_oncontextmenu="onRwCm(event);" _fjnk="1" _dn="Colin Fraizer" _rt="SMTP" _em="metapost@cfraizer.com" _ao="3" _siptrsp="1" _uri="metapost@cfraizer.com" title="metapost@cfraizer.com"><img title="Unknown" src=" " class="csimg csimgbg jb jbs sprites-unkwn-png" id=""sndrJb"" _e_onclick="onRwCmJb(event);" _e_ondblclick="onDblClkJb(event);">Colin
Fraizer [metapost@cfraizer.com] wrote:<br>
<br>
</span>> -<span style="font:7.0pt "Times New Roman""> </span></span>Is there a way to test if the replacement text of a macro
<br>
>is empty?
<p class="MsoNormal"> </p>
>I have a macro which expands to a color or to empty (0 tokens), <br>
>in which case I want to use “background”. <br>
<br>
I might make use of the fact that a for-loop ignores empty <br>
items in a list. For example:<br>
def getmycolor (text clr) = <br>
for c = clr,background:<br>
mycolor := c;<br>
exitif true;<br>
endfor<br>
...<br>
enddef;<br>
<br>
When the parameter clr is empty, one should get <br>
mycolor := background <br>
on the first (only) iteration of the loop, but when clr <br>
is an actual color one should get <br>
mycolor:=clr;<br>
on the first iteration, and then immediately exit the<br>
loop.<br>
<div><br>
I did not test this, but I have done similar things before.<br>
<br>
Dan<br>
-- <br>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px"><font face="Courier New" size="3">Daniel H. Luecking<br>
Department of Mathematical Sciences<br>
University of Arkansas<br>
Fayetteville, Arkansas</font><br>
</div>
</div>
</div>
</div>
</body>
</html>