I am creating matrices of 0s and 1s that I display in HTML-tables and somewhat 
surprisingly I found out that 0s are not permissible in X-expressions, while 1s 

(require web-server/http)

(response/xexpr '(html 1)) ; Fine, no trouble.
(response/xexpr '(html 0)) ; Blow-up.

The specific violation is the following:

"response/xexpr: contract violation;
 Not an Xexpr. Expected a string, symbol, valid numeric entity, comment, 
processing instruction, or list, given 0"

After some digging around, it turns out that only numbers that satisfy 
valid-char? are acceptable, which means "exact-nonnegative-integer whose 
character interpretation under UTF-8 is from the set ([#x1-#xD7FF] | 
[#xE000-#xFFFD] | [#x10000-#x10FFFF]), in accordance with section 2.2 of the 
XML 1.1 spec." 

First, should 0 really not be accepted? (I am not going to try and figure out 
the UTF-8 interpretation...) And second, is the reason that negative numbers 
are not acceptable that they are not under the XML spec above? This took me by 
surprise and means I have to put number->string in a bunch of places.


You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to