<HTML><FONT FACE=arial,helvetica><FONT SIZE=2 FAMILY="SANSSERIF" FACE="Arial" LANG="0">In a message dated 10/5/2002 8:41:14 PM Central Daylight Time, auerja@cs.latrobe.edu.au writes:<BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px">Included the compat.ss library, so I can use get and put prop, but I can't <BR>
get a list of properties associated with a symbol.</BLOCKQUOTE><BR>
<BR>
Perhaps the following would be useful...<BR>
<BR>
I have extracted the two property list functions from compat.ss, and have added<BR>
three functions: <BR>
(property-list sym), which returns the property list for the symbol in the form of an association list<BR>
(property-names sym), which returns a list of the names of the properties for the symbol<BR>
(remprop sym prop), which removes a property from the symbol's property list<BR>
<BR>
Jim<BR>
<BR>
----------------------------------------------------------------<BR>
<BR>
(module symprop mzscheme<BR>
<BR>
(provide getprop<BR>
putprop<BR>
remprop<BR>
property-names<BR>
property-list)<BR>
<BR>
(define table (make-hash-table))<BR>
<BR>
(define getprop<BR>
(case-lambda<BR>
[(k prop) (getprop k prop #f)]<BR>
[(k prop def)<BR>
(let ([al (hash-table-get table k (lambda () #f))])<BR>
(if al<BR>
(let ([v (assq prop al)])<BR>
(if v<BR>
(cdr v)<BR>
def))<BR>
def))]))<BR>
<BR>
(define putprop<BR>
(lambda (k prop nv)<BR>
(let ([al (hash-table-get table k (lambda () '()))])<BR>
(let ([v (assq prop al)])<BR>
(if v<BR>
(set-cdr! v nv)<BR>
(hash-table-put! table k (cons (cons prop nv) al)))))))<BR>
<BR>
(define remprop<BR>
(lambda (k prop)<BR>
(let ([al (hash-table-get table k (lambda () #f))])<BR>
(if al<BR>
(hash-table-put!<BR>
table k<BR>
(let loop ((al al))<BR>
(cond<BR>
[(null? al) '()]<BR>
[(eq? prop (caar al)) (cdr al)]<BR>
[else (cons (car al) (loop (cdr al)))])))))))<BR>
<BR>
(define (property-names k)<BR>
(let ([al (hash-table-get table k (lambda () '()))])<BR>
(map car al)))<BR>
<BR>
(define (property-list k)<BR>
(hash-table-get table k (lambda () '())))<BR>
<BR>
)<BR>
<BR>
</FONT></HTML>