[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 01/01: [gnugo int] Use ‘loop ’, functional style more.
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 01/01: [gnugo int] Use ‘loop ’, functional style more. |
Date: |
Mon, 10 Mar 2014 09:58:35 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit 04cc1c9ced9c95b2494b536b90c2eb5e83bf1171
Author: Thien-Thi Nguyen <address@hidden>
Date: Mon Mar 10 11:02:17 2014 +0100
[gnugo int] Use ‘loop’, functional style more.
* packages/gnugo/gnugo.el (gnugo-describe-internal-properties):
...here, for collecting/massaging ‘gnugo-state’,
instead of ‘maphash’, "manual" destructuring, mutation.
---
packages/gnugo/gnugo.el | 34 ++++++++++++++++------------------
1 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 0a4b345..917579c 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -247,24 +247,22 @@ Handle the big, slow-to-render, and/or uninteresting ones
specially."
(interactive)
(let ((buf (current-buffer))
(d (gnugo-get :diamond))
- acc)
- (maphash (lambda (&rest args)
- (case (car args)
- ((:xpms :local-xpms)
- (setcdr args (format "hash: %X (%d images)"
- (sxhash (cadr args))
- (length (cadr args)))))
- (:sgf-collection
- (setcdr args (length (cadr args))))
- (:monkey
- (let* ((value (cadr args))
- (loc (aref value 0)))
- (setcdr args (list
- (length (aref value 1))
- (length (cdr loc))
- (car loc))))))
- (setq acc (cons args acc)))
- gnugo-state)
+ (acc (loop for key being the hash-keys of gnugo-state
+ using (hash-values val)
+ collect (cons key
+ (case key
+ ((:xpms :local-xpms)
+ (format "hash: %X (%d images)"
+ (sxhash val)
+ (length val)))
+ (:sgf-collection
+ (length val))
+ (:monkey
+ (let ((loc (aref val 0)))
+ (list (length (aref val 1))
+ (length (cdr loc))
+ (car loc))))
+ (t val))))))
(switch-to-buffer (get-buffer-create
(format "%s*GNUGO Board Properties*"
(gnugo-get :diamond))))