[logaling-commit] logaling/logalimacs [master] refactor: use nthcar

Back to archive index

null+****@clear***** null+****@clear*****
Fri Apr 13 01:43:44 JST 2012


yuta yamada	2012-04-13 01:43:44 +0900 (Fri, 13 Apr 2012)

  New Revision: dcdddf667e9bad2ce24742734fa9fb6026ac240e

  Log:
    refactor: use nthcar

  Modified files:
    logalimacs.el

  Modified: logalimacs.el (+4 -5)
===================================================================
--- logalimacs.el    2012-04-13 00:39:46 +0900 (6655903)
+++ logalimacs.el    2012-04-13 01:43:44 +0900 (856e355)
@@ -161,11 +161,10 @@
     (concat find-word " " (mapconcat 'identity options " "))))
 
 (defun loga-word-cache (word)
-  (cond ((<= loga-word-cache-limit (length loga-word-cache))
-         (setq loga-word-cache (reverse loga-word-cache)
-               loga-word-cache (cdr loga-word-cache)
-               loga-word-cache (reverse loga-word-cache))))
-  (push word loga-word-cache))
+  (let* ((len (length loga-word-cache)))
+    (cond ((<= loga-word-cache-limit len)
+           (setq loga-word-cache (nthcar (- len 1) loga-word-cache))))
+    (push word loga-word-cache)))
 
 ;;;###autoload
 (defun loga-add ()




More information about the logaling-commit mailing list
Back to archive index