Subject: Re: "attributes" in S-expressions
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 19 Aug 2005 02:18:46 -0500
Newsgroups: comp.lang.lisp
Message-ID: <R_adnanCMJhLGpjeRVn-3w@speakeasy.net>
Stefan Ram <ram@zedat.fu-berlin.de> wrote:
+---------------
| I have seen several ways to annotate S-expressions with "attributes":
| (example (name "value") (name1 "value1"))
| (example (name -> "value") (name1 -> "value1"))
| (example ((name "value") (name1 "value1")))
| (example '((name "value")(name1 "value1")))
| (example '(name "value" name1 "value1"))
| (example name: "value" name1: "value1" )
| (example :name "value" :name1 "value1" )
| (example 'name "value" 'name1 "value1")
+---------------

Still another way, used by some of the HTML generators (HTOUT,
CL-WHO, &c.), is to say that if the S-expr has "attributes",
then the CAR of the S-expr is itself a list, with the "real"
keyword in the CAAR. Then the attributes are stored as a property
list in the CDAR (as in HTML style). That is, given:

  (example this is some text)

the to indicate that the words should have their first letters
capitalized [as with STRING-CAPITALIZE] and be painted red, one
might say:

  ((example :case :capitalize :font "red") this is some text)

This works as long as your data format expects a "keyword"
[with or without "attributes"] as the CAR of each S-expr.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607