[英]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代碼塊?
ELISP> (cl-mapcar 'concat
'("firstA" "secondA" "thirdA")
'("firstB" "secondB" "thirdB")
'("firstC" "secondC" "thirdC"))
("firstAfirstBfirstC" "secondAsecondBsecondC" "thirdAthirdBthirdC")
通過強大的#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))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.