list - Common Lisp 从列表中返回关联作为新列表

标签 list lisp common-lisp key-value-store

我有一个关联列表如下:

(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=>value 列表中提取值并将它们放入一个新列表中,例如

(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))
    ))

有什么建议吗?感谢您的帮助。

问候

最佳答案

这似乎产生了你想要的答案,但它看起来不是很漂亮:

(mapcan #'copy-list (mapcar #'cdr *experts2*))

关于list - Common Lisp 从列表中返回关联作为新列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14407812/

相关文章:

macos - 从 Mac 终端编译/运行 Common LIsp

concurrency - 想要一个简单的程序来说明使用线程并发 lisp 的使用

lisp - 创建一个函数库来改变任意全局变量

emacs - Clip + Emacs 编译和加载文件

python - 在 Python 中迭代具有潜在条件的大型列表

formatting - 在 Lisp 中定界输出

java - hibernate - 线程中的异常 "main"java.lang.IndexOutOfBoundsException : Index: 0, 大小:0

lisp - 获取列表中 elt 的 cdr

performance - 使用 Java 8 查找连续子列表的负和

python - 有没有办法循环索引