summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Lang <mlang@delysid.org>2004-01-09 10:03:28 +0000
committerMario Lang <mlang@delysid.org>2004-01-09 10:03:28 +0000
commit63197d8e564f147bd41203bceb7dfbf15befbeae (patch)
tree91883bbf44c2ec2fd51e15584e527e36542aec9b
parent3496c993573c1ab32f7c24419635b4156f8b3e22 (diff)
speed up chess-epd-read-file by using nconc
-rw-r--r--chess-epd.el19
1 files changed, 15 insertions, 4 deletions
diff --git a/chess-epd.el b/chess-epd.el
index 5c92903..f688ce8 100644
--- a/chess-epd.el
+++ b/chess-epd.el
@@ -21,7 +21,18 @@
;;; Commentary:
-;;
+
+;; EPD is "Extended Position Description". It is a standard for describing
+;; chess positions along with an extended set of structured attribute
+;; values using the ASCII character set. It is intended for data and
+;; command interchange among chessplaying programs. It is also intended
+;; for the representation of portable opening library repositories and for
+;; problem test suites.
+
+;; A single EPD record uses one text line of variable length composed of
+;; four data fields followed by zero or more operations. A text file
+;; composed exclusively of EPD data records should have a file name with
+;; the suffix ".epd".
;;; Code:
@@ -70,13 +81,13 @@ and advance point after the correctly parsed position."
(defun chess-epd-read-file (file)
"Return a list of positions contained in FILE."
- (let (positions pos)
+ (let ((positions (list t)) pos)
(with-temp-buffer
(insert-file-literally file)
(goto-char (point-min))
(while (setq pos (chess-epd-parse))
- (setq positions (cons pos positions))))
- positions))
+ (nconc positions (list pos))))
+ (cdr positions)))
(defun chess-epd-parse ()
(when (re-search-forward