From: Chris Hanson Date: Tue, 8 Mar 1994 20:19:32 +0000 (+0000) Subject: Add various useful definitions. X-Git-Tag: 20090517-FFI~7260 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=f871fc47011dbb45885f04b57a81a129c9170d16;p=mit-scheme.git Add various useful definitions. --- diff --git a/v7/src/edwin/utils.scm b/v7/src/edwin/utils.scm index 4a983d9a9..35c892bbc 100644 --- a/v7/src/edwin/utils.scm +++ b/v7/src/edwin/utils.scm @@ -1,8 +1,8 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: utils.scm,v 1.34 1993/09/13 18:30:49 gjr Exp $ +;;; $Id: utils.scm,v 1.35 1994/03/08 20:19:32 cph Exp $ ;;; -;;; Copyright (c) 1986, 1989-1993 Massachusetts Institute of Technology +;;; Copyright (c) 1986, 1989-94 Massachusetts Institute of Technology ;;; ;;; This material was developed by the Scheme project at the ;;; Massachusetts Institute of Technology, Department of @@ -285,15 +285,28 @@ (string? object))) (define (list-of-strings? object) - (and (list? object) - (for-all? object string?))) + (list-of-type? object string?)) -(define list-of-type? - for-all?) +(define (list-of-type? object predicate) + (and (list? object) + (for-all? object predicate))) (define (dotimes n procedure) (define (loop i) (if (< i n) (begin (procedure i) (loop (1+ i))))) - (loop 0)) \ No newline at end of file + (loop 0)) + +(define make-strong-eq-hash-table + (strong-hash-table/constructor eq-hash-mod eq? #t)) + +(define make-weak-equal-hash-table + (weak-hash-table/constructor equal-hash-mod equal? #t)) + +(define (weak-assq item alist) + (let loop ((alist alist)) + (and (not (null? alist)) + (if (eq? (weak-car (car alist)) item) + (car alist) + (loop (cdr alist)))))) \ No newline at end of file