[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XML as a transition to s-expr



Quoth Bruce Lewis on , 17 December:
: I don't want to make such people stop using XML or HTML.  I merely want
: to leverage their knowledge of those syntaxes as a transition into
: s-expr syntax.

First, you need to define a convenient format for attributes.  My best
pure s-expr effort was to express tags as factories for element
constructors:

((tag1 (attr1 value1)) 
 "mixed-content-a"
 ((tag2 (attr2 value2)))
 "mixed-content-b"
)

What did you come up with?

If you are willing to play syntax games,  you can be a bit more
transparent:

(tag1 :attr1=value1
  "mixed-content-a"  
  (tag2 :attr2=value2)
  "mixed-content-b"
)

or

(tag1:attr1=value1
  "mixed-content-a"  
  (tag2:attr2=value2)
  "mixed-content-b"
)

depending on whether you'd rather complicate the eval
or the read.