【发布时间】:2012-12-20 03:17:27
【问题描述】:
简单来说,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...
我的想法是收集原始字符串的第一个字母, 然后使用函数;
(remove letter string)
收集现在的第一个字母,删除的字母串并将其附加到之前已经收集的字母中。 这听起来像递归,但如果递归调用会丢失之前收集的 *letter*s 列表,对吗?我也怀疑是否有任何内置函数。
此外,我不想使用 set 或其中任何一个,因为我想要 完全以实用的方式完成此操作。
感谢您的宝贵时间。
【问题讨论】:
标签: string common-lisp