|
Subject: (match-element?) From: Chris Maden <crism@xxxxxxx> Date: Thu, 6 Nov 1997 12:47:23 -0500 |
I needed this procedure, and couldn't find an implementation. This is
public, but if anyone has a better way to do it, please share! (It
relies on (cadr), implementation of which is left as an exercise for
the reader...)
Thanks,
Chris
;; (match-element?) is defined in ISO/IEC 10179, but no implementation
;; is given.
(define (match-element? pattern
snl)
(if (list? pattern)
(let pattern-loop
((gi-list (reverse pattern))
(att-list '())
(this-node snl)
(matches #t))
(if matches
(if (or (= (length gi-list)
0)
(node-list-empty? this-node))
matches
(pattern-loop (list-tail gi-list
1)
(if (list? (car gi-list))
(car gi-list)
'())
(if (list? (car gi-list))
this-node
(origin this-node))
(and matches
(if (list? (car gi-list))
#t
(equal? (car gi-list)
(gi this-node)))
(if (= (length att-list)
0)
#t
(equal? (cadr att-list)
(attribute-string (car att-list)
this-node))))))
#f))
(equal? pattern
(gi snl))))
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Numbering sections - erratum, Daniel Speck | Thread | Re: (match-element?), James Clark |
| Re: Scaling inline images, Sebastian Rahtz | Date | Re: Scaling inline images, Richard Light |
| Month |