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

9 lines
222 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
: 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 .