(let ((homes (cdr conflicting-alias)))
(let ((maximum (apply max (map cdr homes))))
(let ((winner
- (list-search-positive homes
- (lambda (home)
- (= (cdr home) maximum)))))
+ (find (lambda (home)
+ (= (cdr home) maximum))
+ homes)))
(for-each
(lambda (home)
(if (not (eq? home winner))
(define (add-weighted-entries x-entries y-entries)
(merge-entries x-entries y-entries
(lambda (entry entries)
- (list-search-positive entries
- (let ((home (vector-ref entry 0)))
- (lambda (entry)
- (eqv? home (vector-ref entry 0))))))
+ (find (let ((home (vector-ref entry 0)))
+ (lambda (entry)
+ (eqv? home (vector-ref entry 0))))
+ entries))
(lambda (x-entry y-entry)
(vector (vector-ref x-entry 0)
(min (vector-ref x-entry 1) (vector-ref y-entry 1))
(car (map-entry-aliases entry)))
(define (map-entry:find-alias entry type needed-registers)
- (list-search-positive (map-entry-aliases entry)
- (lambda (alias)
- (and (register-type? alias type)
- (not (memv alias needed-registers))))))
+ (find (lambda (alias)
+ (and (register-type? alias type)
+ (not (memv alias needed-registers))))
+ (map-entry-aliases entry)))
(define (map-entry:aliases entry type needed-registers)
(filter (lambda (alias)
(else
(and (not (null? y-entries))
(let ((y-entry
- (list-search-positive y-entries
- (let ((home (map-entry-home (car x-entries))))
- (lambda (entry)
- (eqv? (map-entry-home entry) home))))))
+ (find (let ((home (map-entry-home (car x-entries))))
+ (lambda (entry)
+ (eqv? (map-entry-home entry) home)))
+ y-entries)))
(and y-entry
(boolean=? (map-entry-saved-into-home? (car x-entries))
(map-entry-saved-into-home? y-entry))
(LAP)))))
;; First see if there is an unused register of the given type.
(or (let ((register
- (list-search-positive (map-registers map)
- (lambda (alias)
- (and (register-type? alias type)
- (not (memv alias needed-registers)))))))
+ (find (lambda (alias)
+ (and (register-type? alias type)
+ (not (memv alias needed-registers))))
+ (map-registers map))))
(and register (allocator-values register map (LAP))))
;; There are no free registers available, so must reallocate
;; one. First look for a temporary register that is no longer
(define (allocate-register-without-unload? map type needed-registers)
;; True iff a register of `type' can be allocated without displacing
;; any pseudo-registers from the register map.
- (or (list-search-positive (map-registers map)
- (lambda (alias)
- (and (register-type? alias type)
- (not (memv alias needed-registers)))))
+ (or (find (lambda (alias)
+ (and (register-type? alias type)
+ (not (memv alias needed-registers))))
+ (map-registers map))
(map-entries:search map
(lambda (entry)
(and (map-entry:find-alias entry type needed-registers)
;; contents into that register.
(or (let ((entry (map-entries:find-home map home)))
(and entry
- (let ((alias (list-search-positive (map-entry-aliases entry)
- (register-type-predicate type))))
+ (let ((alias (find (register-type-predicate type)
+ (map-entry-aliases entry))))
(and alias
(allocator-values alias map (LAP))))))
(bind-allocator-values (make-free-register map type needed-registers)
the same value as REGISTER. If no such register exists, returns #F."
(let ((entry (map-entries:find-alias map register)))
(and entry
- (list-search-positive (map-entry-aliases entry)
- (lambda (register*)
- (and (not (eq? register register*))
- (register-type? type register*)))))))
+ (find (lambda (register*)
+ (and (not (eq? register register*))
+ (register-type? type register*)))
+ (map-entry-aliases entry)))))
(define (pseudo-register-alias map type register)
"Returns a machine register, of the given TYPE, which is an alias
for REGISTER. If no such register exists, returns #F."
(let ((entry (map-entries:find-home map register)))
(and entry
- (list-search-positive (map-entry-aliases entry)
- (register-type-predicate type)))))
+ (find (register-type-predicate type)
+ (map-entry-aliases entry)))))
(define (machine-register-is-unique? map register)
"True if REGISTER has no other aliases."
(define (is-pseudo-register-alias? map maybe-alias register)
(let ((entry (map-entries:find-home map register)))
(and entry
- (list-search-positive (map-entry-aliases entry)
- (lambda (alias)
- (eqv? maybe-alias alias))))))
+ (find (lambda (alias)
+ (eqv? maybe-alias alias))
+ (map-entry-aliases entry)))))
(define (save-machine-register map register receiver)
(let ((entry (map-entries:find-alias map register)))
(if (eqv? element (constraint/element constraint))
constraint
(loop (constraint/afters constraint))))
-
+
(loop (constraint-graph/entry-nodes graph-head)))
(define (find-or-make-constraint element graph-head
(if (default-object? afters)
(make-constraint element graph-head)
(make-constraint element graph-head afters))))
-
+
\f
(define (constraint-add! before after)
(if (eq? (constraint/element before) (constraint/element after))
(set-constraint/afters! before (cons after (constraint/afters before)))
(let ((c-graph (constraint/graph-head after)))
(if c-graph
- (set-constraint-graph/entry-nodes!
+ (set-constraint-graph/entry-nodes!
c-graph
(delq! after (constraint-graph/entry-nodes c-graph)))))
(set-constraint/closed?! before false)
(result '()))
(if (and (pair? linearized-constraints)
(pair? things))
- (let ((match (list-search-positive
- things
- (lambda (thing)
- (eqv?
- (constraint/element
- (car linearized-constraints))
- (element-extractor thing))))))
+ (let ((match
+ (find (lambda (thing)
+ (eqv? (constraint/element (car linearized-constraints))
+ (element-extractor thing)))
+ things)))
(loop (cdr linearized-constraints)
(delv match things)
(if (and match
node-marked?)
(define result)
-
+
(define (loop node)
(node-mark! node)
(for-each next (get-children node))
(and node
(not (node-marked? node))
(loop node)))
-
+
(define (doit node)
(set! result '())
(loop node)
(define (constraint-mark! constraint)
(set-constraint/generation! constraint *constraint-generation*))
-
(define (merge-children! block procedure unconditional conditional update?)
(let ((ic-parent
(let ((block
- (list-search-positive unconditional
- (lambda (block*)
- (block-parent (block-parent block*))))))
+ (find (lambda (block*)
+ (block-parent (block-parent block*)))
+ unconditional)))
(and block
(block-parent (block-parent block)))))
(closed-over-variables
(begin
(node-mark! node)
(let ((class
- (list-search-positive classes
- (lambda (class)
- (node=? node (car class))))))
+ (find (lambda (class)
+ (node=? node (car class)))
+ classes)))
(if class
(set-cdr! class (cons node (cdr class)))
(begin
(define (object-label-value label)
(let ((entry
- (list-search-positive (table->list-of-entries objects)
- (lambda (entry)
- (string=? label (entry-label entry))))))
+ (find (lambda (entry)
+ (string=? label (entry-label entry)))
+ (table->list-of-entries objects))))
(if (not entry)
(error "object-label-value: Unknown" label)
(entry-value entry))))
(let ((classes '())
(class-member?
(lambda (class suffix)
- (list-search-positive class
- (lambda (suffix*)
- (and (eq? (car suffix) (car suffix*))
- (eq? (cdr suffix) (cdr suffix*))))))))
+ (find (lambda (suffix*)
+ (and (eq? (car suffix) (car suffix*))
+ (eq? (cdr suffix) (cdr suffix*))))
+ class))))
(for-each (lambda (entry)
(let ((class
- (list-search-positive classes
- (lambda (class)
- (class-member? class (car entry))))))
+ (find (lambda (class)
+ (class-member? class (car entry)))
+ classes)))
(if class
(if (not (class-member? class (cdr entry)))
(set-cdr! class (cons (cdr entry) (cdr class))))
(let ((class
- (list-search-positive classes
- (lambda (class)
- (class-member? class (cdr entry))))))
+ (find (lambda (class)
+ (class-member? class (cdr entry)))
+ classes)))
(if class
(set-cdr! class (cons (car entry) (cdr class)))
(set! classes
(package-loop (package/parent package))))))
(define (name->package packages name)
- (list-search-positive packages
- (lambda (package)
- (symbol-list=? name (package/name package)))))
+ (find (lambda (package)
+ (symbol-list=? name (package/name package)))
+ packages))
(define (process-package-description package description get-package)
(let ((file-cases (package-description/file-cases description)))
(define (continuation-browser-abort restarts)
(let ((restart
- (list-search-positive restarts
- (lambda (restart)
- (eq? (restart/name restart) 'abort)))))
+ (find (lambda (restart)
+ (eq? (restart/name restart) 'abort))
+ restarts)))
(if (not restart)
(editor-error "Can't find an abort restart")
(fluid-let ((hook/invoke-restart
(+ code (if (<= #x01 code #x1A) #x60 #x40)))
(fix:or (char-bits key) char-bit:control)))
(let ((entry
- (list-search-positive alias-keys
- (lambda (entry)
- (eqv? (cdr entry) key)))))
+ (find (lambda (entry)
+ (eqv? (cdr entry) key))
+ alias-keys)))
(if entry
(unmap-alias-key (car entry))
key))))
(let ((environment (bline/evaluation-environment bline)))
(bline/attached-buffer bline 'ENVIRONMENT-BROWSER
(lambda ()
- (or (list-search-positive (buffer-list)
- (lambda (buffer)
- (let ((browser (buffer-get buffer 'BROWSER)))
- (and browser (eq? environment (browser/object browser))))))
+ (or (find (lambda (buffer)
+ (let ((browser (buffer-get buffer 'BROWSER)))
+ (and browser (eq? environment (browser/object browser)))))
+ (buffer-list))
(environment-browser-buffer environment))))))
(define (bline/attached-buffer bline type make-buffer)
buffer)))))
(define (find-dired-buffer directory-spec)
- (list-search-positive (buffer-list)
- (lambda (buffer)
- (equal? directory-spec (buffer-get buffer 'DIRED-DIRECTORY-SPEC)))))
+ (find (lambda (buffer)
+ (equal? directory-spec (buffer-get buffer 'DIRED-DIRECTORY-SPEC)))
+ (buffer-list)))
(define (dired-buffer-directory-spec buffer)
(or (buffer-get buffer 'DIRED-DIRECTORY-SPEC)
(define (name->display-type name)
(let ((display-type
- (list-search-positive display-types
- (lambda (display-type)
- (eq? name (display-type/name display-type))))))
+ (find (lambda (display-type)
+ (eq? name (display-type/name display-type)))
+ display-types)))
display-type))
\ No newline at end of file
(define (pathname->buffer pathname)
(let ((pathname (->pathname pathname)))
- (list-search-positive (buffer-list)
- (lambda (buffer)
- (equal? pathname (buffer-pathname buffer))))))
+ (find (lambda (buffer)
+ (equal? pathname (buffer-pathname buffer)))
+ (buffer-list))))
\f
(define-command set-visited-file-name
"Change name of file visited in current buffer.
(let ((current-item (current-menu-item (current-point))))
(and current-item
(let ((current-index (mark-index current-item)))
- (list-search-positive item-alist
- (lambda (entry)
- (= current-index (cdr entry)))))))))
+ (find (lambda (entry)
+ (= current-index (cdr entry)))
+ item-alist))))))
(if current-entry
(prompt-for-alist-value "Menu item"
item-alist
(for-each
(lambda (submenu)
(let ((nodename (car submenu)))
- (if (not (or (list-search-positive menu-items
- (lambda (item)
- (string-ci=? item nodename)))
+ (if (not (or (find (lambda (item)
+ (string-ci=? item nodename))
+ menu-items)
(re-search-forward (string-append "^\\* "
(re-quote-string
nodename)
(let ((make-entry
(lambda (prefix element)
(let ((entry
- (list-search-positive prefix-alist
- (lambda (entry)
- (string=? (car entry) prefix)))))
+ (find (lambda (entry)
+ (string=? (car entry) prefix))
+ prefix-alist)))
(if entry
(set-cdr! entry (cons element (cdr entry)))
(set! prefix-alist
;;;; News-Server Buffer
(define (find-news-server-buffer server)
- (list-search-positive (buffer-list)
- (lambda (buffer)
- (and (news-server-buffer? buffer)
- (string-ci=? (news-server-buffer:server buffer) server)))))
+ (find (lambda (buffer)
+ (and (news-server-buffer? buffer)
+ (string-ci=? (news-server-buffer:server buffer) server)))
+ (buffer-list)))
(define (make-news-server-buffer server)
(create-news-buffer (news-buffer-name server "subscribed-groups")
set-file-modes!)
(define (os/rmail-spool-directory)
- (or (list-search-positive
- '("/var/spool/mail/" "/var/mail/" "/usr/spool/mail/" "/usr/mail/")
- file-directory?)
+ (or (find file-directory?
+ '("/var/spool/mail/" "/var/mail/" "/usr/spool/mail/" "/usr/mail/"))
"/usr/spool/mail/"))
(define (os/rmail-primary-inbox-list system-mailboxes)
buffer))
(define (get-vc-dired-buffer directory)
- (or (list-search-positive (buffer-list)
- (lambda (buffer)
- (let ((spec (buffer-get buffer 'VC-DIRECTORY-SPEC #f)))
- (and spec
- (pathname=? (car spec) directory)))))
+ (or (find (lambda (buffer)
+ (let ((spec (buffer-get buffer 'VC-DIRECTORY-SPEC #f)))
+ (and spec
+ (pathname=? (car spec) directory))))
+ (buffer-list))
(new-buffer (pathname->buffer-name directory))))
(define (fill-vc-dired-buffer! buffer directory all-files?)
(error "Screen has unexpectedly vanished" screen)))
(define (handle->win32-screen handle)
- (list-search-positive win32-screens
- (lambda (screen) (eqv? handle (state/handle (screen-state screen))))))
+ (find (lambda (screen) (eqv? handle (state/handle (screen-state screen))))
+ win32-screens))
\f
(define-integrable (screen-name screen)
(state/name (screen-state screen)))
(select-buffer (get-imail-browser-buffer url)))
(define (get-imail-browser-buffer url)
- (or (list-search-positive (buffer-list)
- (lambda (buffer)
- (eq? (selected-container-url #f buffer) url)))
+ (or (find (lambda (buffer)
+ (eq? (selected-container-url #f buffer) url))
+ (buffer-list))
(let ((container (open-resource url))
(buffer
(new-buffer
(define (imail-flag->imap-flag flag)
(let ((entry
- (list-search-positive standard-imap-flags
- (lambda (entry)
- (string-ci=? flag (cdr entry))))))
+ (find (lambda (entry)
+ (string-ci=? flag (cdr entry)))
+ standard-imap-flags)))
(if entry
(car entry)
(intern flag))))
(and error? (error:bad-range-argument folder 'IMAIL-FOLDER->BUFFER))))
(define (imail-message->buffer message error?)
- (or (list-search-positive (buffer-list)
- (lambda (buffer)
- (eq? (buffer-get buffer 'IMAIL-MESSAGE #f) message)))
+ (or (find (lambda (buffer)
+ (eq? (buffer-get buffer 'IMAIL-MESSAGE #f) message))
+ (buffer-list))
(and error? (error:bad-range-argument message 'IMAIL-MESSAGE->BUFFER))))
(define (associate-buffer-with-imail-buffer folder-buffer buffer)
(define (imap:response:fetch-body-part response section offset)
(let ((entry
- (list-search-positive (cddr response)
- (lambda (entry)
- (and (eq? (car entry) 'BODY)
- (equal? (cadr entry) section)
- (pair? (cddr entry))
- (eqv? offset (caddr entry))
- (pair? (cdddr entry))
- (or (not (cadddr entry))
- (string? (cadddr entry)))
- (null? (cddddr entry)))))))
+ (find (lambda (entry)
+ (and (eq? (car entry) 'BODY)
+ (equal? (cadr entry) section)
+ (pair? (cddr entry))
+ (eqv? offset (caddr entry))
+ (pair? (cdddr entry))
+ (or (not (cadddr entry))
+ (string? (cadddr entry)))
+ (null? (cddddr entry))))
+ (cddr response))))
(if (not entry)
(error "Missing FETCH body part:" section offset))
(cadddr entry)))
(class/slots (guarantee-class class 'CLASS-SLOTS)))
(define (class-slot class name error?)
- (or (list-search-positive (class/slots (guarantee-class class 'CLASS-SLOT))
- (lambda (slot)
- (eq? name (slot-name slot))))
+ (or (find (lambda (slot)
+ (eq? name (slot-name slot)))
+ (class/slots (guarantee-class class 'CLASS-SLOT)))
(and error?
(class-slot class (error:no-such-slot class name) error?))))
(define (method-combinator-record generic intern?)
(let ((combinator
- (or (list-search-positive (generic-procedure-generator-list generic)
- method-combinator?)
+ (or (find method-combinator?
+ (generic-procedure-generator-list generic))
(and intern?
(let ((combinator (make-method-combinator)))
(add-generic-procedure-generator generic combinator)
(for-each
(lambda (x)
(let ((names
- (or (list-search-positive interacting-options
- (lambda (names)
- (memq (car x) names)))
+ (or (find (lambda (names)
+ (memq (car x) names))
+ interacting-options)
(list (car x)))))
(let ((entry
(let loop ((names names))