jbc*_*oko 1 string 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或其中任何一个,因为我想在功能样式中完全执行此操作.
谢谢你的时间.
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)
| 归档时间: |
|
| 查看次数: |
376 次 |
| 最近记录: |