用于构建列表的 elisp 数据 structures/workflow
elisp data structures/workflow for constructing a list
arrayA = ["arrayA_1", "arrayA_2", "arrayA_3", "arrayA_4", "arrayA_5"]
arrayB = ["arrayB_1", "arrayB_2", "arrayB_3", "arrayB_4", "arrayB_5"]
arrayC = ["arrayC_1", "arrayC_2", "arrayC_3", "arrayC_4", "arrayC_5"]
arrayA.length.times do |x|
p list = [ [arrayA[x]] , [arrayB[x]] , [arrayC[x]] ]
end
如何在 elisp 中复制这个简单的 Ruby 代码块?
更新
在帮助下建立了很棒的#emacs irc 频道@freenode.net(非常感谢 wgreenhouse、forcer、paluche 和其他人)
(setq listA '("firstA" "secondA" "thirdA"))
(setq listB '("firstB" "secondB" "thirdB"))
(setq listC '("firstC" "secondC" "thirdC"))
(setq mylist (cl-loop for a in listA
for b in listB
for c in listC
collect (concat a b c)))
(print mylist (current-buffer))
ELISP> (cl-mapcar 'concat
'("firstA" "secondA" "thirdA")
'("firstB" "secondB" "thirdB")
'("firstC" "secondC" "thirdC"))
("firstAfirstBfirstC" "secondAsecondBsecondC" "thirdAthirdBthirdC")
arrayA = ["arrayA_1", "arrayA_2", "arrayA_3", "arrayA_4", "arrayA_5"]
arrayB = ["arrayB_1", "arrayB_2", "arrayB_3", "arrayB_4", "arrayB_5"]
arrayC = ["arrayC_1", "arrayC_2", "arrayC_3", "arrayC_4", "arrayC_5"]
arrayA.length.times do |x|
p list = [ [arrayA[x]] , [arrayB[x]] , [arrayC[x]] ]
end
如何在 elisp 中复制这个简单的 Ruby 代码块?
更新 在帮助下建立了很棒的#emacs irc 频道@freenode.net(非常感谢 wgreenhouse、forcer、paluche 和其他人)
(setq listA '("firstA" "secondA" "thirdA"))
(setq listB '("firstB" "secondB" "thirdB"))
(setq listC '("firstC" "secondC" "thirdC"))
(setq mylist (cl-loop for a in listA
for b in listB
for c in listC
collect (concat a b c)))
(print mylist (current-buffer))
ELISP> (cl-mapcar 'concat
'("firstA" "secondA" "thirdA")
'("firstB" "secondB" "thirdB")
'("firstC" "secondC" "thirdC"))
("firstAfirstBfirstC" "secondAsecondBsecondC" "thirdAthirdBthirdC")