<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
p.msochpdefault, li.msochpdefault, div.msochpdefault
{mso-style-name:msochpdefault;
margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Calibri","sans-serif";}
span.emailstyle17
{mso-style-name:emailstyle17;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.rwrro
{mso-style-name:rwrro;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>A great tip. Thanks, Daniel!<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>I had found a workaround for my immediate need using a mixture of delimited and undelimited text params and some special delimiters, but this is a better general solution.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Daniel H. Luecking [mailto:luecking@uark.edu] <br><b>Sent:</b> Tuesday, May 28, 2013 9:55 AM<br><b>To:</b> Colin Fraizer; metapost@tug.org<br><b>Subject:</b> RE: [metapost] test for empty text?<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New";color:black'><span class=rwrro>Colin Fraizer [metapost@cfraizer.com] wrote:</span><br><br>> -</span><span style='font-size:7.0pt;font-family:"Times New Roman","serif";color:black'> </span><span style='font-size:12.0pt;font-family:"Courier New";color:black'>Is there a way to test if the replacement text of a macro <br>>is empty? <o:p></o:p></span></p><p class=MsoNormal><span style='color:black'> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New";color:black'>>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.<o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New";color:black'><br>I did not test this, but I have done similar things before.<br><br>Dan<br>-- <o:p></o:p></span></p><div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New";color:black'>Daniel H. Luecking<br>Department of Mathematical Sciences<br>University of Arkansas<br>Fayetteville, Arkansas</span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black'><o:p></o:p></span></p></div></div></div></div></div></body></html>