(queue->list defns))))
(define (find-coding-type name coding-types #!optional error?)
- (or (find-matching-item coding-types
- (lambda (type)
- (eq? (coding-type-name type) name)))
+ (or (find (lambda (type)
+ (eq? (coding-type-name type) name))
+ coding-types)
(and (if (default-object? error?) #t error?)
(error "Unknown coding-type name:" name))))
\f
;; Compute initial references.
(let ((find-node
(lambda (coding-type)
- (find-matching-item nodes
- (lambda (node)
- (eq? (vector-ref node 0) coding-type))))))
+ (find (lambda (node)
+ (eq? (vector-ref node 0) coding-type))
+ nodes))))
(for-each (lambda (coding-type from)
(for-each (lambda (to)
(enqueue! queue (cons from (find-node to))))
(let ((outputs
(append-map (lambda (input)
(let ((abbrev
- (find-matching-item abbrevs
- (lambda (abbrev)
- (syntax-match? (car abbrev) input)))))
+ (find (lambda (abbrev)
+ (syntax-match? (car abbrev) input))
+ abbrevs)))
(if abbrev
(begin
(set! any-expansions? #t)
has-code?
(map (lambda (item)
(guarantee symbol? item #f)
- (or (find-matching-item pvars
- (lambda (pv)
- (eq? (pvar-name pv) item)))
+ (or (find (lambda (pv)
+ (eq? (pvar-name pv) item))
+ pvars)
(error "Missing name reference:" item)))
coding)))))
\f
to-expand
(append-map! (lambda (defn)
(let ((pv
- (find-matching-item (defn-pvars defn)
- (lambda (pv)
- (eq? (pvar-type pv) type-name)))))
+ (find (lambda (pv)
+ (eq? (pvar-type pv) type-name))
+ (defn-pvars defn))))
(if pv
(begin
(set! any-changes? #t)
(define (map-key-abbrevs keyword key-abbrevs)
(let ((key-abbrev
- (find-matching-item key-abbrevs
- (lambda (key-abbrev)
- (eq? (key-abbrev-keyword key-abbrev) keyword)))))
+ (find (lambda (key-abbrev)
+ (eq? (key-abbrev-keyword key-abbrev) keyword))
+ key-abbrevs)))
(if key-abbrev
(key-abbrev-abbreviation key-abbrev)
keyword)))
(define rt-coding-types '())
(define (make-rt-coding-type name defns)
- (if (find-matching-item rt-coding-types
- (lambda (rt-coding-type)
- (eq? (rt-coding-type-name rt-coding-type) name)))
+ (if (find (lambda (rt-coding-type)
+ (eq? (rt-coding-type-name rt-coding-type) name))
+ rt-coding-types)
(error "Coding type already exists" name)
(set! rt-coding-types
(cons (%make-rt-coding-type name defns) rt-coding-types))))
(let ((type (rt-coding-type name))
(code (read-byte)))
(let ((defn
- (find-matching-item (rt-coding-type-defns type)
- (lambda (defn)
- (eqv? (rt-defn-code defn) code)))))
+ (find (lambda (defn)
+ (eqv? (rt-defn-code defn) code))
+ (rt-coding-type-defns type))))
(if defn
(cons (rt-defn-name defn)
((rt-defn-decoder defn) read-byte))
(coding-error code type)))))
(define (rt-coding-type name)
- (or (find-matching-item rt-coding-types
- (lambda (rt-coding-type)
- (eq? (rt-coding-type-name rt-coding-type) name)))
+ (or (find (lambda (rt-coding-type)
+ (eq? (rt-coding-type-name rt-coding-type) name))
+ rt-coding-types)
(error:bad-range-argument name 'RT-CODING-TYPE)))
(define condition-type:coding-error
(system-vector-ref block index)))
(refs (system-hunk3-cxr2 cache))
(entry
- (find-matching-item
- (case kind
- ((1) (system-hunk3-cxr0 refs))
- ((2) (system-hunk3-cxr1 refs))
- (else (error "Not a kind of variable cache:" kind)))
- (lambda (e)
- (weak-assq block (cdr e))))))
+ (find (lambda (e)
+ (weak-assq block (cdr e)))
+ (case kind
+ ((1) (system-hunk3-cxr0 refs))
+ ((2) (system-hunk3-cxr1 refs))
+ (else (error "Not a kind of variable cache:" kind))))))
(write-string "variable cache for ")
(if (pair? entry)
(write (car entry))
(value-cell (expression/value-cell expression)))
(let ((binding
(and value-cell
- (find-matching-item (value-cell/bindings value-cell)
- (lambda (binding)
- (eq? package* (binding/package binding)))))))
+ (find (lambda (binding)
+ (eq? package* (binding/package binding)))
+ (value-cell/bindings value-cell)))))
(if binding
(let ((name (binding/name binding)))
(if (and package
(null? (package/name package)))
(define-integrable (package/find-reference package name)
- (find-matching-item (package/references package)
- (lambda (ref) (eq? (reference/name ref) name))))
+ (find (lambda (ref) (eq? (reference/name ref) name))
+ (package/references package)))
(define-integrable (package/put-reference! package reference)
(set-package/references! package
(cons reference (package/references package))))
(define-integrable (package/find-binding package name)
- (find-matching-item (package/bindings package)
- (lambda (ref) (eq? (binding/name ref) name))))
+ (find (lambda (ref) (eq? (binding/name ref) name))
+ (package/bindings package)))
(define-integrable (package/put-binding! package binding)
(set-package/bindings! package
(let ((given-header?
(lambda (name null-true?)
(let ((header
- (find-matching-item headers
- (lambda (header)
- (string-ci=? (car header) name)))))
+ (find (lambda (header)
+ (string-ci=? (car header) name))
+ headers)))
(and header
(cadr header)
(if null-true?
(if prompt?
(do-mime)
(let ((entry
- (find-matching-item
- (ref-variable file-type-to-mime-type buffer)
- (lambda (entry)
- (cond ((string? type)
- (string-ci=? (car entry) type))
- ((not type)
- (not (car entry)))
- (else
- (eq? type 'WILD)))))))
+ (find (lambda (entry)
+ (cond ((string? type)
+ (string-ci=? (car entry) type))
+ ((not type)
+ (not (car entry)))
+ (else
+ (eq? type 'WILD))))
+ (ref-variable file-type-to-mime-type buffer))))
(cond (entry (make-mime-type (cadr entry) (caddr entry)))
((pathname-mime-type pathname))
(else
(define (os/newest-backup pathname)
(or (os/newest-numeric-backup pathname)
- (find-matching-item
- (os/directory-list-completions
- (directory-namestring pathname)
- (string-append (file-namestring pathname) "~"))
- os/backup-filename?)))
+ (find
+ os/backup-filename?
+ (os/directory-list-completions
+ (directory-namestring pathname)
+ (string-append (file-namestring pathname) "~")))))
\f
(define (os/buffer-backup-pathname truename buffer)
(call-with-values
(define (os/sendmail-program)
(or (os/find-program "sendmail" #f (ref-variable exec-path) #f)
- (find-matching-item
- '("/usr/sbin/sendmail" "/usr/lib/sendmail" "/usr/ucblib/sendmail")
- file-executable?)
+ (find file-executable?
+ '("/usr/sbin/sendmail" "/usr/lib/sendmail" "/usr/ucblib/sendmail"))
"fakemail"))
(define (os/newsrc-file-name server)
"))))))
(define (matching-param? string params)
- (find-matching-item params
- (lambda (param) (string=? string (symbol->string (car param))))))
+ (find (lambda (param) (string=? string (symbol->string (car param))))
+ params))
(define (new-variable root-name params)
;; Returns a name (string) for a variable that must be distinct from
(and intern? (%variable/make&bind! block name))))))
(define (%block/lookup-name block name)
- (find-matching-item (block/bound-variables block)
- (lambda (variable)
- (eq? (variable/name variable) name))))
+ (find (lambda (variable)
+ (eq? (variable/name variable) name))
+ (block/bound-variables block)))
(define (block/limited-lookup block name limit)
(guarantee symbol? name 'block/limited-lookup)
(define (define-url-bindings url . klist)
(guarantee keyword-list? klist 'define-url-bindings)
(let* ((binding
- (find-matching-item url-bindings
- (lambda (binding)
- (string=? (car binding) url)))))
+ (find (lambda (binding)
+ (string=? (car binding) url))
+ url-bindings)))
(if binding
(do ((klist klist (cddr klist)))
((not (pair? klist)))
(pp pointers)
(newline)
|#
- (cond ((or (find-matching-item pointer-optimizations
- (lambda (p)
- (syntax-match? (car p) expression)))
- (find-matching-item default-pointer-optimizations
- (lambda (p)
- (syntax-match? (car p) expression))))
+ (cond ((or (find (lambda (p)
+ (syntax-match? (car p) expression))
+ pointer-optimizations)
+ (find (lambda (p)
+ (syntax-match? (car p) expression))
+ default-pointer-optimizations))
=> (lambda (p)
(let ((expression* ((cdr p) expression pointers)))
(if (equal? expression* expression)
(define (%current-pointers pointers)
(if (car pointers)
- (find-matching-item (cdr pointers)
- (lambda (identifiers)
- (memq (car pointers) identifiers)))
+ (find (lambda (identifiers)
+ (memq (car pointers) identifiers))
+ (cdr pointers))
'()))
(define (%id-pointers identifier pointers)
- (or (find-matching-item (cdr pointers)
- (lambda (ids)
- (memq identifier ids)))
+ (or (find (lambda (ids)
+ (memq identifier ids))
+ (cdr pointers))
'()))
\f
(define-pointer-optimization
(let per-elt ((elt elt) (containers (xdoc-element-containers elt)))
(let* ((id (xdoc-db-id elt))
(suffix (string-append "-" (symbol->string id))))
- (cond ((find-matching-item bindings
- (lambda (binding)
- (string-suffix? suffix (symbol->string (car binding)))))
+ (cond ((find (lambda (binding)
+ (string-suffix? suffix (symbol->string (car binding))))
+ bindings)
=> (lambda (binding)
(values (let ((name (symbol->string (car binding))))
(substring->symbol
#f))))
(define (%find-attribute name attrs)
- (find-matching-item attrs
- (lambda (attr)
- (xml-name=? (xml-attribute-name attr) name))))
+ (find (lambda (attr)
+ (xml-name=? (xml-attribute-name attr) name))
+ attrs))
(define (symbol-attribute name elt error?)
(let ((string (find-attribute name elt error?)))
(%find-result (%find-child elt predicate) error?))
(define (%find-child elt predicate)
- (find-matching-item (xml-element-contents elt)
- (lambda (item)
- (and (xml-element? item)
- (predicate item)))))
+ (find (lambda (item)
+ (and (xml-element? item)
+ (predicate item)))
+ (xml-element-contents elt)))
(define (%find-result elt error?)
(if (and (not elt) error?)
(registry-bindings
(check-registry registry 'URI->RDF-PREFIX)))
(filter (lambda (p) (string-prefix? (cdr p) s))))
- (or (find-matching-item alist
- (lambda (p)
- (and (not (eq? (car p) ':))
- (filter p))))
- (find-matching-item alist filter)))))
+ (or (find (lambda (p)
+ (and (not (eq? (car p) ':))
+ (filter p)))
+ alist)
+ (find filter alist)))))
(if p
(values (car p) (cdr p))
(begin
(define (process-attr-decls name attrs p)
(let ((decl
(and (or *standalone?* *internal-dtd?*)
- (find-matching-item *att-decls*
- (lambda (decl)
- (xml-name=? (xml-!attlist-name decl) name))))))
+ (find (lambda (decl)
+ (xml-name=? (xml-!attlist-name decl) name))
+ *att-decls*))))
(if decl
(do ((defns (xml-!attlist-definitions decl) (cdr defns))
(attrs attrs (process-attr-defn (car defns) attrs p)))
(type (cadr defn))
(default (caddr defn)))
(let ((attr
- (find-matching-item attrs
- (lambda (attr)
- (xml-name=? (car (xml-attribute-name attr)) name)))))
+ (find (lambda (attr)
+ (xml-name=? (car (xml-attribute-name attr)) name))
+ attrs)))
(if attr
(let ((av (xml-attribute-value attr)))
(if (and (pair? default)
(make-xml-parameter-entity-ref name)))))
(define (find-parameter-entity name)
- (find-matching-item *parameter-entities*
- (lambda (entity)
- (eq? name (xml-parameter-!entity-name entity)))))
+ (find (lambda (entity)
+ (eq? name (xml-parameter-!entity-name entity)))
+ *parameter-entities*))
(define *parameter-entities*)
\f
child))
(define (%named-child name elt)
- (find-matching-item (xml-element-contents elt)
- (lambda (item)
- (and (xml-element? item)
- (xml-name=? (xml-element-name item) name)))))
+ (find (lambda (item)
+ (and (xml-element? item)
+ (xml-name=? (xml-element-name item) name)))
+ (xml-element-contents elt)))
(define (single-child elt)
(let ((children (all-children elt)))