(defun zip-list (al bl)
(if (not (equal (length al) (length bl))) nil
(progn
(let ((ls nil))
(while (not (null al))
(setq ls (cons (cons (car al) (car bl)) ls))
(setq al (cdr al))
(setq bl (cdr bl)))
(reverse ls)))))
(zip-list (list 1 2 3) (list 4 5 6))
The above program was wrote by me at the interval of my work. Now sometime to write
a segment of scheme or Emacs lisp code became an interesting of mine.
本文介绍了一个 Emacs Lisp 的自定义函数 `zip-list`,该函数用于将两个列表组合成一个列表,其中每个元素都是来自原始两个列表相应位置元素的配对。作者在工作间隙编写了这段代码,并分享了其在 Emacs Lisp 编程中的乐趣。
654

被折叠的 条评论
为什么被折叠?



