List Lisp移动列表中的元素
我有一份表格清单:List Lisp移动列表中的元素,list,lisp,List,Lisp,我有一份表格清单: (or a b c (and d e) f g (and h i) (==> x y)) 我喜欢在或之后移动以和开头的子列表,如下所示: (or (and d e) (and h i) a b c f g (==> x y)) 我该怎么做?我不确定什么是最好的方法,因为它是一个列表,我不能像其他数据结构一样,只放置我想要的元素。谢谢,但是首字母或在哪里?谢谢,但是首字母或在哪里? ? (stable-sort (rest '(or a b c (and d e
(or a b c (and d e) f g (and h i) (==> x y))
我喜欢在或
之后移动以和
开头的子列表,如下所示:
(or (and d e) (and h i) a b c f g (==> x y))
我该怎么做?我不确定什么是最好的方法,因为它是一个列表,我不能像其他数据结构一样,只放置我想要的元素。谢谢,但是首字母或在哪里?谢谢,但是首字母或在哪里?
? (stable-sort (rest '(or a b c (and d e) f g (and h i) (==> x y)))
(lambda (x y)
(and (consp x) (eq (first x) 'and))))
((AND H I) (AND D E) A B C F G (==> X Y))