块的唯一不会删除重复项

时间:2015-07-24 11:18:43

标签: rebol rebol3

字符串是我删除基础的网址的一部分。 parse检测到某个html文件中的四个网址。我把问题缩小到了这个范围:

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

可以看出,网址1和网址2是相同的,网址3和网址4也是如此。unique不会删除重复项。为什么会发生这种情况,如何应对呢?

1 个答案:

答案 0 :(得分:4)

Script scriptabc.mt Run 不修改原始系列。是否通常在其帮助字符串中提及功能修改,例如,请参阅UNIQUE。只需将您的块设置为SORT的结果,如下所示:

UNIQUE