(list, compare)
| 38850 | |
| 38851 | |
| 38852 | function unique_pred(list, compare) { |
| 38853 | var ptr = 1 |
| 38854 | , len = list.length |
| 38855 | , a=list[0], b=list[0] |
| 38856 | for(var i=1; i<len; ++i) { |
| 38857 | b = a |
| 38858 | a = list[i] |
| 38859 | if(compare(a, b)) { |
| 38860 | if(i === ptr) { |
| 38861 | ptr++ |
| 38862 | continue |
| 38863 | } |
| 38864 | list[ptr++] = a |
| 38865 | } |
| 38866 | } |
| 38867 | list.length = ptr |
| 38868 | return list |
| 38869 | } |
| 38870 | |
| 38871 | function unique_eq(list) { |
| 38872 | var ptr = 1 |