[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo ed11a74 101/357: [gnugo int] Embrace (NODE[...] [
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo ed11a74 101/357: [gnugo int] Embrace (NODE[...] [SUBTREE...]) IR, for now. |
Date: |
Sun, 29 Nov 2020 14:50:58 -0500 (EST) |
branch: externals/gnugo
commit ed11a74d0d3b7be11010cc4112f3183beae229a5
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo int] Embrace (NODE[...] [SUBTREE...]) IR, for now.
It's not so bad, after all. OTOH, hanging by the leaves is better.
* packages/gnugo/gnugo.el (gnugo/sgf-read-file TREE): Use ‘nconc’.
(gnugo/sgf-write-file >>tree): Use ‘dolist’.
---
gnugo.el | 27 +++++++--------------------
1 file changed, 7 insertions(+), 20 deletions(-)
diff --git a/gnugo.el b/gnugo.el
index 5a0ef59..d434cab 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -2184,11 +2184,8 @@ starting a new one. See `gnugo-board-mode'
documentation for more info."
(setq SZ (cdr prop)))
prop))))
(TREE (lev) (prog1
- ;; hmm
- ;; ‘append’ => ([NODE...] [SUBTREE...])
- ;; ‘cons’ => (([NODE...]) . [SUBTREE...])
- ;; see consequent hair in -write-file
- (append
+ ;; produce (NODE[...] [SUBTREE...])
+ (nconc
;; nodes
(loop while (seek ?\;)
collect (NODE))
@@ -2253,21 +2250,11 @@ starting a new one. See `gnugo-board-mode'
documentation for more info."
(unless (zerop (current-column))
(newline))
(insert "(")
- ;; The IR (see "hmm" above) prioritizes space
- ;; efficiency; no cost if no subtrees (common case).
- ;; The downside, however, is that subtree access
- ;; requires this somewhat-funky border search.
- (let (x subtrees)
- (while (setq x (pop tree))
- (if (gnugo--nodep x)
- (>>node x)
- (setq
- ;; Add back the first subtree.
- subtrees (cons x tree)
- ;; Arrange to stop searching.
- tree nil)))
- (dolist (sub subtrees)
- (>>tree sub)))
+ (dolist (x tree)
+ (funcall (if (gnugo--nodep x)
+ #'>>node
+ #'>>tree)
+ x))
(insert ")")))
(with-temp-buffer
(dolist (tree collection)
- [elpa] externals/gnugo 11e545d 082/357: [gnugo int] Use ‘loop’ instead of ‘dolist’ + ‘destructuring-bind’., (continued)
- [elpa] externals/gnugo 11e545d 082/357: [gnugo int] Use ‘loop’ instead of ‘dolist’ + ‘destructuring-bind’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5eeb99b 087/357: [gnugo int] Use ‘incf’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7293802 088/357: [gnugo int] Use ‘setq’ less., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 35b1551 091/357: [gnugo int] Use ‘loop’ instead of ‘mapc’ + ‘apply’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo b5990a0 085/357: [gnugo int] Use ‘gnugo-treeroot’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo f9668f0 090/357: [gnugo int] Add abstraction: gnugo--blackp, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo c164c40 092/357: [gnugo int] Add abstraction: gnugo--passp, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo bf04735 094/357: [gnugo] Fix bug: Don't misuse SGF prop ‘:EV’ for "resign" state., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e036fed 096/357: [gnugo] Fix bug: On load, follow mainline through subtrees., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo eaaa7c8 102/357: [gnugo int] Invert gametree IR to hang by the leaves., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo ed11a74 101/357: [gnugo int] Embrace (NODE[...] [SUBTREE...]) IR, for now.,
Stefan Monnier <=
- [elpa] externals/gnugo b7843bf 103/357: [gnugo maint] Move hi-lock hint from NEWS to HACKING; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo ae888ba 105/357: [gnugo] Add command ‘gnugo-oops’ and keybinding., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 2c5e356 107/357: [gnugo maint] Add some debugging aids to HACKING; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a708759 110/357: [gnugo int] Use ‘cl-labels’ less., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a35f657 115/357: [gnugo] Support SGF[4] parsing from string data., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3d8db48 119/357: [gnugo] Declare dependency on ‘ascii-art-to-unicode’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 4b866c7 127/357: [gnugo int] Avoid lower move-num candidates in déjà-vu search., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5b51e4f 129/357: [gnugo int] Decruft: Consolidate "breathe in" loops., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo fda0ca5 130/357: [gnugo int] Move precise fanout computation to "breathe in"., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo cbf99df 131/357: [gnugo int] Insert frolic xrep starting w/ the leaves., Stefan Monnier, 2020/11/29