[Factor-talk] Abusing curry?

2007-10-06 Thread Samuel Tardieu
I was in the need of a unique word which, given a sequence, builds a new sequence of the same kind with unique elements of the input sequence while keeping the same order (only subsequent duplicate elements must be ommited). I ended up with: : unique ( seq -- newseq ) [ dup length

Re: [Factor-talk] Abusing curry?

2007-10-06 Thread Slava Pestov
Hi Sam, Take a look at the 'prune' word in the hashtables vocabulary, it does exactly what you want but it runs in O(n) time because it uses a hashtable to track which elements have already been added. Slava On 6-Oct-07, at 1:48 PM, Samuel Tardieu wrote: I was in the need of a unique word