emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/pyim 819f9c6 04/36: Move pyim-permutate-list* to pyim-c


From: ELPA Syncer
Subject: [elpa] externals/pyim 819f9c6 04/36: Move pyim-permutate-list* to pyim-common.el
Date: Thu, 22 Apr 2021 22:57:15 -0400 (EDT)

branch: externals/pyim
commit 819f9c669544daf8e372f1b40e644fdc5489c144
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    Move pyim-permutate-list* to pyim-common.el
    
    * pyim-common.el (pyim-permutate-list, pyim-permutate-list2)
        (pyim-permutate-list2-internal): Move from pyim.el
---
 pyim-common.el | 34 ++++++++++++++++++++++++++++++++++
 pyim.el        | 34 ----------------------------------
 2 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/pyim-common.el b/pyim-common.el
index 1927bdc..a751f34 100644
--- a/pyim-common.el
+++ b/pyim-common.el
@@ -147,6 +147,40 @@ VARIABLE 变量,FORCE-RESTORE 设置为 t 时,强制恢复,变量原来的
   "测试当前是否是 exwm 环境。"
   (string-match-p " \\*temp\\*" (buffer-name)))
 
+(defun pyim-permutate-list (list)
+  "使用排列组合的方式重新排列 LIST.
+这个函数由 ‘二中’ 提供,`pyim-hanzi2pinyin' 没有使用这个函数
+(速度稍微有点慢)。"
+  (let ((list-head (car list))
+        (list-tail (cdr list)))
+    (cond ((null list-tail)
+           (cl-loop for element0 in list-head
+                    append (cons (cons element0 nil) nil)))
+          (t (cl-loop for element in list-head
+                      append (mapcar (lambda (l) (cons element l))
+                                     (pyim-permutate-list list-tail)))))))
+
+(defun pyim-permutate-list2 (list)
+  "使用排列组合的方式重新排列 LIST.
+这个函数由 ’翀/ty‘ 提供,`pyim-hanzi2pinyin' 默认使用这个函数。"
+  (if (= (length list) 1)
+      (mapcar #'list (car list))
+    (pyim-permutate-list2-internal (car list) (cdr list))))
+
+(defun pyim-permutate-list2-internal (one two)
+  "`pyim-permutate-list2' 的内部函数。"
+  (let (return)
+    (if (null (car two))
+        one
+      (dolist (x1 one)
+        (dolist (x2 (car two))
+          (push (if (listp x1)
+                    (append x1 (list x2))
+                  (list x1 x2))
+                return)))
+      (setq one return)
+      (pyim-permutate-list2-internal one (cdr two)))))
+
 ;; * Footer
 (provide 'pyim-common)
 
diff --git a/pyim.el b/pyim.el
index 05b0ba4..3ab09b2 100644
--- a/pyim.el
+++ b/pyim.el
@@ -3968,40 +3968,6 @@ BUG: 当 STRING 中包含其它标点符号,并且设置 SEPERATER 时,结
             list
           (mapconcat #'identity list " "))))))
 
-(defun pyim-permutate-list (list)
-  "使用排列组合的方式重新排列 LIST.
-这个函数由 ‘二中’ 提供,`pyim-hanzi2pinyin' 没有使用这个函数
-(速度稍微有点慢)。"
-  (let ((list-head (car list))
-        (list-tail (cdr list)))
-    (cond ((null list-tail)
-           (cl-loop for element0 in list-head
-                    append (cons (cons element0 nil) nil)))
-          (t (cl-loop for element in list-head
-                      append (mapcar (lambda (l) (cons element l))
-                                     (pyim-permutate-list list-tail)))))))
-
-(defun pyim-permutate-list2 (list)
-  "使用排列组合的方式重新排列 LIST.
-这个函数由 ’翀/ty‘ 提供,`pyim-hanzi2pinyin' 默认使用这个函数。"
-  (if (= (length list) 1)
-      (mapcar #'list (car list))
-    (pyim-permutate-list2-internal (car list) (cdr list))))
-
-(defun pyim-permutate-list2-internal (one two)
-  "`pyim-permutate-list2' 的内部函数。"
-  (let (return)
-    (if (null (car two))
-        one
-      (dolist (x1 one)
-        (dolist (x2 (car two))
-          (push (if (listp x1)
-                    (append x1 (list x2))
-                  (list x1 x2))
-                return)))
-      (setq one return)
-      (pyim-permutate-list2-internal one (cdr two)))))
-
 ;;;###autoload
 (defun pyim-hanzi2pinyin-simple (string &optional shou-zi-mu separator 
return-list)
   "简化版的 `pyim-hanzi2pinyin', 不处理多音字。"



reply via email to

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