[Top][All Lists]

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

[elpa] externals/slime-volleyball 0d31ee9 3/7: slime-volleyball.el: Chan

From: Thomas Fitzsimmons
Subject: [elpa] externals/slime-volleyball 0d31ee9 3/7: slime-volleyball.el: Change strategy-name handling
Date: Tue, 24 Nov 2020 17:23:00 -0500 (EST)

branch: externals/slime-volleyball
commit 0d31ee944abe91e1ad1bd12305907e77d83ef40d
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>

    slime-volleyball.el: Change strategy-name handling
    * slime-volleyball.el (slime-volleyball-save-strategy-helper): Add
    strategy-name argument.
    (slime-volleyball-save-strategy): Pass strategy-name argument to
    helper function.
 slime-volleyball.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/slime-volleyball.el b/slime-volleyball.el
index 9122b81..61e3314 100644
--- a/slime-volleyball.el
+++ b/slime-volleyball.el
@@ -303,8 +303,8 @@
      (/ none-points (float none-decisions)))))
 ;; Dynamically-scoped slime-volleyball-save-strategy helper function.
-(defun slime-volleyball-save-strategy-helper (key values)
-  "Store KEY, VALUES in the strategy hash table."
+(defun slime-volleyball-save-strategy-helper (key values strategy-name)
+  "Store KEY, VALUES in the strategy hash table named STRATEGY-NAME."
    (format "(puthash \"%s\" '%s %s)\n"
@@ -315,12 +315,13 @@
   "Save a generated computer slime strategy in FILE-NAME with STRATEGY-NAME."
   (find-file file-name)
   (with-current-buffer (file-name-nondirectory file-name)
-    (insert
-     (format "(setq %s (make-hash-table :test 'equal))\n"
-             strategy-name))
-    (maphash 'slime-volleyball-save-strategy-helper
-             slime-volleyball-training-slime-strategy)
-    (save-buffer)))
+      (insert
+       (format "(setq %s (make-hash-table :test 'equal))\n" strategy-name))
+      (maphash (lambda (key values)
+                 (slime-volleyball-save-strategy-helper
+                  key values strategy-name))
+               slime-volleyball-training-slime-strategy)
+      (save-buffer)))
 (defun slime-volleyball-training-quantize (value digits)
   "Return VALUE converted to have DIGITS digits."

reply via email to

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