替换嵌套列表中的普通字符串中的字符串

问题描述 投票:0回答:1

我有嵌套列表((“ H”“ E”“ L”“ L”“ O”)(“ T”“ H”“ I”“ S”)(“ I”“ S”)(“ A” )(“ T”“ E”“ S”“ T”)))我要使用替代将列表中的每个字符串替换为另一个字符串,但是它不起作用,我的代码是:

(substitute "H" "W" paragraph)

段落是嵌套列表的名称。

common-lisp substitution clisp
1个回答
0
投票

使用SUBST

SUBST

如果需要在适当的位置修改列表,请使用(setq new-list (subst "W" "H" old-list :test #'string=))

© www.soinside.com 2019 - 2024. All rights reserved.