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

Re: XML as a transition to s-expr



At 10:26 PM 12/17/01, Tony Kimball wrote:
>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.

Common Lisp already has a syntax for named parameters.  Lisp hacks
like this for generating HTML are common.

(table (:cellpadding "0" :cellspacing "0")
   (tr ()
     (td (:width "50%")
       "Cell one")
     (td (:width "50%")
       "Cell two")))