[racket] Test to disambiguate x-expression attributes vs. content?

From: Matthew Butterick (mb.list.acct at gmail.com)
Date: Mon Jun 10 14:40:15 EDT 2013

Consider an x-expression that represents an XML tag, so it has the general

'(tag ((attr-name "attr-value") ... ) content ...)

The attributes or content might be omitted, of course.

When I recursively process these expressions, I start by decomposing the
x-expression into components:

((attr-name "attr-value") ... )
(content ...)

The problem that surfaces in a recursive-processing context is that the
list of content might have the same form as an attribute expression, e.g.,

((field-1 "value-1") (field-2 "value-2"))
((p "some text") (p "some more text"))

*Is there a test I could use to reliably disambiguate between these two
cases*, short of creating a new struct for x-expressions? Seems like I'm
overlooking some middle ground.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130610/a901554e/attachment.html>

Posted on the users mailing list.