这些字符串是我去掉了基础的 url 的一部分。parse
在某些 html
文件中检测到四个 url。我已将问题缩小为:
REBOL []
images: [{,W,H,wi,1TV1Rvu8EF9FDdUxKy+hTKK/RNifw3WQDJEI/sYkX78tyNifGd0/U4RpaBox1rO448B4dv24sYoTgxOMVC7Lz5J9sJXlk0nkM89n55HzX7qbRiX/cSkd3lepAEIj3LVTN7gmQLCI2+INwwg18IyDklZ3VZWkw011+77dkfgTTRlRaY397ricx4dk4BTHvCLZ} {,W,H,wi,1TV1Rvu8EF9FDdUxKy+hTKK/RNifw3WQDJEI/sYkX78tyNifGd0/U4RpaBox1rO448B4dv24sYoTgxOMVC7Lz5J9sJXlk0nkM89n55HzX7qbRiX/cSkd3lepAEIj3LVTN7gmQLCI2+INwwg18IyDklZ3VZWkw011+77dkfgTTRlRaY397ricx4dk4BTHvCLZ} {,W,H,wi,1TV1Rvu8EF9FDdUxKy+hTKK/RNifw3WQDJEI/sYkX78wvYn3cKtEeN/9Y8EfNR8J48B4dv24sYoTgxOMVC7Lz5J9sJXlk0nkM89n55HzX7qbRiX/cSkd3lepAEIj3LVTN7gmQLCI2+INwwg18IyDklZ3VZWkw011+77dkfgTTRlRaY397ricx4dk4BTHvCLZ} {,W,H,wi,1TV1Rvu8EF9FDdUxKy+hTKK/RNifw3WQDJEI/sYkX78wvYn3cKtEeN/9Y8EfNR8J48B4dv24sYoTgxOMVC7Lz5J9sJXlk0nkM89n55HzX7qbRiX/cSkd3lepAEIj3LVTN7gmQLCI2+INwwg18IyDklZ3VZWkw011+77dkfgTTRlRaY397ricx4dk4BTHvCLZ}]
print join "before: " length? images
unique images
print join "after: " length? images
print join "1=2? " images/1 = images/2
print join "1=3? " images/1 = images/3
print join "1=4? " images/1 = images/4
print join "2=3? " images/2 = images/3
print join "2=4? " images/2 = images/4
print join "3=4? " images/3 = images/4
可以看出,urls 1 和 2 是相同的,urls 3 和 4 也可以说相同。但是,
unique
并没有删除重复项。为什么会出现这种情况,如何处理? 最佳答案
UNIQUE
不修改原始系列。函数是否修改通常会在其帮助字符串中提及,例如参见 SORT
。只需将您的块设置为 UNIQUE
的结果,如下所示:
>> a: [1 2 3 4 3 4 4]
== [1 2 3 4 3 4 4]
>> unique a
== [1 2 3 4]
>> a
== [1 2 3 4 3 4 4]
>> a: unique a
== [1 2 3 4]
>> a
== [1 2 3 4]
关于rebol - 块的唯一性不会删除重复项,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31609202/