emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/subr.el


From: Kenichi Handa
Subject: [Emacs-diffs] Changes to emacs/lisp/subr.el
Date: Wed, 02 Apr 2003 21:43:11 -0500

Index: emacs/lisp/subr.el
diff -c emacs/lisp/subr.el:1.344 emacs/lisp/subr.el:1.345
*** emacs/lisp/subr.el:1.344    Fri Mar 14 17:36:57 2003
--- emacs/lisp/subr.el  Wed Apr  2 21:43:11 2003
***************
*** 176,181 ****
--- 176,197 ----
           (if (> n 0) (setcdr (nthcdr (- (1- m) n) x) nil))
           x))))
  
+ (defun number-sequence (from &optional to)
+   "Return a sequence of numbers from FROM to TO (both inclusive) as a list.
+ The Nth element of the list is (+ FROM N) where N counts from zero.
+ If TO is nil, it defaults to FROM.
+ If TO is less than FROM, the value is nil."
+   (if to
+       (if (< to from)
+         (setq to (1- from)))
+     (setq to from))
+   (let* ((list (make-list (- (1+ to) from) from))
+        (tail (cdr list)))
+     (while tail
+       (setcar tail (setq from (1+ from)))
+       (setq tail (cdr tail)))
+     list))
+ 
  (defun remove (elt seq)
    "Return a copy of SEQ with all occurrences of ELT removed.
  SEQ must be a list, vector, or string.  The comparison is done with `equal'."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]