获取字符串中使用的字母列表的好方法或有效方法是什么

jbc*_*oko 1 string common-lisp

简单地说,如何从Common Lisp中的字符串中获取列表中不重复的字母?

例如:

"common"
-> ("c" "o" "m" "n") or in characters, (#\c #\o #\m #\n)
I'd care less about the order and type, if it is in string or character.

"overflow" -> (o v e r f l w)
"tomtomtom" -> (t o m)
   etc...
Run Code Online (Sandbox Code Playgroud)

我在想的是收集原始字符串的第一个字母,然后使用该函数;

(remove letter string)
Run Code Online (Sandbox Code Playgroud)

收集现在的第一个字母,删除字母串并将其附加到之前收集的字母.这听起来像递归,但如果递归调用会松开以前收集的*letter*s列表,对吗?我也怀疑是否有任何内置功能.

此外,我不想使用set或其中任何一个,因为我想在功能样式中完全执行此操作.

谢谢你的时间.

Vse*_*kin 8

CL-USER> (remove-duplicates (coerce "common" 'list))
(#\c #\m #\o #\n)
Run Code Online (Sandbox Code Playgroud)

或者你甚至可以这样做:

CL-USER> (remove-duplicates "common")
"comn"
Run Code Online (Sandbox Code Playgroud)