RosettaCodeData/Task/Remove-duplicate-elements/Lang5/remove-duplicate-elements-1...

9 lines
222 B
Plaintext

: dip swap '_ set execute _ ;
: remove-duplicates
[] swap do unique? length 0 == if break then loop drop ;
: unique?
0 extract swap "2dup in if drop else append then" dip ;
[1 2 6 3 6 4 5 6] remove-duplicates .