summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-extra.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/cl-extra.el')
-rw-r--r--lisp/emacs-lisp/cl-extra.el16
1 files changed, 7 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 13988db9a86..a2400a0ba37 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -1,6 +1,6 @@
;;; cl-extra.el --- Common Lisp features, part 2 -*- lexical-binding: t -*-
-;; Copyright (C) 1993, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2000-2019 Free Software Foundation, Inc.
;; Author: Dave Gillespie <daveg@synaptics.com>
;; Keywords: extensions
@@ -438,9 +438,7 @@ as an integer unless JUNK-ALLOWED is non-nil."
;; Random numbers.
(defun cl--random-time ()
- (let* ((time (copy-sequence (current-time-string))) (i (length time)) (v 0))
- (while (>= (cl-decf i) 0) (setq v (+ (* v 3) (aref time i))))
- v))
+ (car (encode-time nil t)))
;;;###autoload (autoload 'cl-random-state-p "cl-extra")
(cl-defstruct (cl--random-state
@@ -484,7 +482,7 @@ Optional second arg STATE is a random-state object."
If STATE is t, return a new state object seeded from the time of day."
(unless state (setq state cl--random-state))
(if (cl-random-state-p state)
- (copy-tree state t)
+ (copy-sequence state)
(cl--make-random-state (if (integerp state) state (cl--random-time)))))
;; Implementation limits.
@@ -596,10 +594,10 @@ too large if positive or too small if negative)."
;;;###autoload
(defun cl-list-length (x)
"Return the length of list X. Return nil if list is circular."
- (let ((n 0) (fast x) (slow x))
- (while (and (cdr fast) (not (and (eq fast slow) (> n 0))))
- (setq n (+ n 2) fast (cdr (cdr fast)) slow (cdr slow)))
- (if fast (if (cdr fast) nil (1+ n)) n)))
+ (cl-check-type x list)
+ (condition-case nil
+ (length x)
+ (circular-list)))
;;;###autoload
(defun cl-tailp (sublist list)