Mercurial > emacs
changeset 27197:3e34f4e0b1c2
(cl-make-hash-table): Use make-hash-table.
(cl-lucid-hash-tag): Delete.
(cl-hash-table-p): Correct test for native table.
(cl-hash-table-count): Use hash-table-count.
author | Dave Love <fx@gnu.org> |
---|---|
date | Wed, 05 Jan 2000 16:51:08 +0000 |
parents | 64fe9058e235 |
children | 9f2eee514355 |
files | lisp/emacs-lisp/cl-extra.el |
diffstat | 1 files changed, 6 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/emacs-lisp/cl-extra.el Wed Jan 05 15:41:44 2000 +0000 +++ b/lisp/emacs-lisp/cl-extra.el Wed Jan 05 16:51:08 2000 +0000 @@ -3,7 +3,6 @@ ;; Copyright (C) 1993 Free Software Foundation, Inc. ;; Author: Dave Gillespie <daveg@synaptics.com> -;; Version: 2.02 ;; Keywords: extensions ;; This file is part of GNU Emacs. @@ -32,16 +31,11 @@ ;; This package was written by Dave Gillespie; it is a complete ;; rewrite of Cesar Quiroz's original cl.el package of December 1986. ;; -;; This package works with Emacs 18, Emacs 19, and Lucid Emacs 19. -;; ;; Bug reports, comments, and suggestions are welcome! ;; This file contains portions of the Common Lisp extensions ;; package which are autoloaded since they are relatively obscure. -;; See cl.el for Change Log. - - ;;; Code: (or (memq 'cl-19 features) @@ -55,9 +49,6 @@ (defmacro cl-pop (place) (list 'car (list 'prog1 place (list 'setq place (list 'cdr place))))) -(defvar cl-emacs-type) - - ;;; Type coercion. (defun coerce (x type) @@ -655,28 +646,16 @@ (defun cl-make-hash-table (&rest cl-keys) "Make an empty Common Lisp-style hash-table. -If :test is `eq', this can use Lucid Emacs built-in hash-tables. -In non-Lucid Emacs, or with non-`eq' test, this internally uses a-lists. Keywords supported: :test :size The Common Lisp keywords :rehash-size and :rehash-threshold are ignored." (let ((cl-test (or (car (cdr (memq ':test cl-keys))) 'eql)) (cl-size (or (car (cdr (memq ':size cl-keys))) 20))) - (if (and (eq cl-test 'eq) (fboundp 'make-hashtable)) - (funcall 'make-hashtable cl-size) - (list 'cl-hash-table-tag cl-test - (if (> cl-size 1) (make-vector cl-size 0) - (let ((sym (make-symbol "--hashsym--"))) (set sym nil) sym)) - 0)))) - -(defvar cl-lucid-hash-tag - (if (and (fboundp 'make-hashtable) (vectorp (make-hashtable 1))) - (aref (make-hashtable 1) 0) (make-symbol "--cl-hash-tag--"))) + (make-hash-table :size cl-size :test cl-size))) (defun cl-hash-table-p (x) "Return t if OBJECT is a hash table." - (or (eq (car-safe x) 'cl-hash-table-tag) - (and (vectorp x) (= (length x) 4) (eq (aref x 0) cl-lucid-hash-tag)) - (and (fboundp 'hashtablep) (funcall 'hashtablep x)))) + (or (hash-table-p x) + (eq (car-safe x) 'cl-hash-table-tag))) (defun cl-not-hash-table (x &optional y &rest z) (signal 'wrong-type-argument (list 'cl-hash-table-p (or y x)))) @@ -782,7 +761,9 @@ (defun cl-hash-table-count (table) "Return the number of entries in HASH-TABLE." (or (cl-hash-table-p table) (cl-not-hash-table table)) - (if (consp table) (nth 3 table) (funcall 'hashtable-fullness table))) + (if (consp table) + (nth 3 table) + (hash-table-count table))) ;;; Some debugging aids.