Actually numbers are allowed, but not all numbers. If you look at<br><br><a href="http://docs.racket-lang.org/xml/index.html?q=xexpression#(def._((lib._xml/main..rkt)._valid-char~3f))">http://docs.racket-lang.org/xml/index.html?q=xexpression#(def._((lib._xml/main..rkt)._valid-char~3f))</a><br>
<br>It tells you which numbers are allowed, and 2 is not.<br><br>I'll change the error message to say "valid numeric entity" rather than "number".<br><br>Jay<br><br><div class="gmail_quote">On Tue, Feb 28, 2012 at 2:13 AM, Jens Axel Søgaard <span dir="ltr"><<a href="mailto:jensaxel@soegaard.net">jensaxel@soegaard.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2012/2/28 Johannes Brauer <span dir="ltr"><<a style href="mailto:brauer@nordakademie.de" target="_blank">brauer@nordakademie.de</a>></span><br>
<div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi!<br>
<br>
In DrRacket version 5.02 this x-expression<br>
<br>
(validate-xexpr '(add x 2))<br>
<br>
is legal. In version 5.2 I get the error message<br>
<br>
Expected a string, symbol, number, comment, processing instruction, or list, given 2<br>
<br>
Can anyone explain this to me?<br></blockquote><div><br></div></div><div>According to the grammar in the documentation a lone number is not an x-expression. Use '(add x "2") instead.</div><p style="margin-top:1em;margin-right:0px;margin-bottom:1em;margin-left:0px;font-family:serif;text-align:left;background-color:rgb(255,255,255);font-size:medium">
</p><table cellspacing="0"><tbody><tr><td style="padding-left:0px;padding-right:0px" valign="baseline" align="right"><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128);font-style:italic">xexpr</span></td>
<td style="padding-left:0px;padding-right:0px" valign="baseline" align="left"><span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="center">=</td>
<td style="padding-left:0px;padding-right:0px" valign="baseline" align="left"><span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left"><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128);font-style:italic">string</span></td>
</tr><tr><td style="padding-left:0px;padding-right:0px" valign="baseline" align="right"><span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left">
<span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="center">|</td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left">
<span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left"><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/pairs.html?q=xexpression#%28def._%28%28quote._%7E23%7E25kernel%29._list%29%29" style="text-decoration:none;color:blue" target="_blank">list</a></span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128);font-style:italic">symbol</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/pairs.html?q=xexpression#%28def._%28%28quote._%7E23%7E25kernel%29._list%29%29" style="text-decoration:none;color:blue" target="_blank">list</a></span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/pairs.html?q=xexpression#%28def._%28%28quote._%7E23%7E25kernel%29._list%29%29" style="text-decoration:none;color:blue" target="_blank">list</a></span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128);font-style:italic">symbol</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128);font-style:italic">string</span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)">...</span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128);font-style:italic">xexpr</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)">...</span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span></td>
</tr><tr><td style="padding-left:0px;padding-right:0px" valign="baseline" align="right"><span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left">
<span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="center">|</td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left">
<span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left"><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/pairs.html?q=xexpression#%28def._%28%28quote._%7E23%7E25kernel%29._cons%29%29" style="text-decoration:none;color:blue" target="_blank">cons</a></span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128);font-style:italic">symbol</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">(</span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/reference/pairs.html?q=xexpression#%28def._%28%28quote._%7E23%7E25kernel%29._list%29%29" style="text-decoration:none;color:blue" target="_blank">list</a></span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128);font-style:italic">xexpr</span><span style="font-family:monospace"> </span><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)">...</span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span><span style="font-family:monospace;white-space:inherit;color:rgb(132,60,36)">)</span></td>
</tr><tr><td style="padding-left:0px;padding-right:0px" valign="baseline" align="right"><span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left">
<span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="center">|</td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left">
<span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left"><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128);font-style:italic">symbol</span></td>
</tr><tr><td style="padding-left:0px;padding-right:0px" valign="baseline" align="right"><span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left">
<span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="center">|</td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left">
<span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left"><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128)"><a href="http://docs.racket-lang.org/xml/index.html?q=xexpression#%28def._%28%28lib._xml/main..rkt%29._valid-char%7E3f%29%29" style="text-decoration:none;color:blue" target="_blank">valid-char?</a></span></td>
</tr><tr><td style="padding-left:0px;padding-right:0px" valign="baseline" align="right"><span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left">
<span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="center">|</td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left">
<span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left"><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128);font-style:italic">cdata</span></td>
</tr><tr><td style="padding-left:0px;padding-right:0px" valign="baseline" align="right"><span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left">
<span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="center">|</td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left">
<span style="font-family:monospace"> </span></td><td style="padding-left:0px;padding-right:0px" valign="baseline" align="left"><span style="font-family:monospace;white-space:inherit;color:rgb(38,38,128);font-style:italic">misc</span></td>
</tr></tbody></table><p></p><div>-- </div><font color="#888888"><div>Jens Axel Søgaard</div><div><br></div></font></div>
<br>____________________<br>
Racket Users list:<br>
<a style href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Jay McCarthy <<a style href="mailto:jay@cs.byu.edu" target="_blank">jay@cs.byu.edu</a>><br>Assistant Professor / Brigham Young University<br><a style href="http://faculty.cs.byu.edu/%7Ejay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br>
<br>"The glory of God is Intelligence" - D&C 93<br>