我有一个关联列表如下:
(defparameter *experts2*
`(
;; direction
(:direction . ( (nn-direction-expert (process-signal) :number-of-neighbors 10)
(fn-direction-expert (process-signal) :number-of-neighbors 10) ))
;; evaluation
(:evaluation . (
;(avoid-line-crossing-evaluation-expert (process-signal))
(nn-single-evaluation-expert (candidate-point))
(fn-single-evaluation-expert (candidate-point))
;(nn-all-evaluation-expert (ranking))
))
;; coordination
(:coordination . (
;(ranking-process (candidate-point))
(action-process (candidate-point ranking))))))
我正在寻找一种方法,从key =>值列表中提取值并将它们放入一个新列表,如
(defparameter *experts*
`(
;; direction
(nn-direction-expert (process-signal) :number-of-neighbors 10)
(fn-direction-expert (process-signal) :number-of-neighbors 10)
;eher als evaluationsexperte
;(avoid-line-crossing-evaluation-expert (process-signal) )
;; evaluation
(nn-single-evaluation-expert (candidate-point))
(fn-single-evaluation-expert (candidate-point))
;(nn-all-evaluation-expert (ranking))
;; coordination
;(ranking-process (candidate-point))
(action-process (candidate-point ranking))
))
有什么建议吗?谢谢你的帮助。
此致
答案 0 :(得分:3)
这似乎可以产生你想要的答案,但它看起来并不漂亮:
(mapcan #'copy-list (mapcar #'cdr *experts2*))
答案 1 :(得分:0)
塞缪尔·埃德温·沃德的答案有效,但这是另一个(现在编辑实际做你需要的)。因此,对于*experts2*
的每个元素,您希望获取其cdr
,然后从返回的列表中获取值并将它们合并到一个列表中:
(apply #'append (mapcan #'cdr *experts2*))