RosettaCodeData/Task/Remove-duplicate-elements/Lang5/remove-duplicate-elements-1.lang5
2023-07-01 13:44:08 -04:00

8 lines
222 B
Text

: 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 .