Re: [racket-users] Why does 1 count as numeric in xexpr, but 0 does not?

2017-03-14 Thread Marc Kaufmann
Fair enough if that's the specification, even if it is unexpected (to me at least). Thanks, Marc On Tuesday, March 14, 2017 at 10:41:02 AM UTC-4, Jay McCarthy wrote: > Hi Marc, > > libxml2 only allows numeric entity references in this range: > > * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF]

Re: [racket-users] Why does 1 count as numeric in xexpr, but 0 does not?

2017-03-14 Thread Jay McCarthy
Hi Marc, libxml2 only allows numeric entity references in this range: * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] * | [#x1-#x10] Racket doesn't fully respect that, but both disallow 0. I think we should match libxml2 and tighten the contract. Jay -- -=[ Jay

Re: [racket-users] Why does 1 count as numeric in xexpr, but 0 does not?

2017-03-14 Thread Marc Kaufmann
I understand that the number 1 is different from the string (although I would probably have expected it to be turned into a string before being passed to the browser or something, but it doesn't matter for my purposes). What does surprise me is that (xexpr->string 1) gives , yet (xexpr->string

Re: [racket-users] Why does 1 count as numeric in xexpr, but 0 does not?

2017-03-13 Thread Philip McGrath
Numbers in x-expressions are interpreted as XML entities, not as the string representation of the number. The value of (xexpr->string '(html 1)), to use your example, is "". The 1 represents the character that Racket would represent as #\u0001, i.e. the value of (integer->char 1). In contrast,

[racket-users] Why does 1 count as numeric in xexpr, but 0 does not?

2017-03-13 Thread Marc Kaufmann
Hi, 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 are: (require web-server/http) (response/xexpr '(html 1)) ; Fine, no trouble. (response/xexpr '(html 0)) ; Blow-up. The specific