Remove duplicate elements: Difference between revisions

adding lambdatalk
(Replace println() with print(); replace output "syntaxhighlight" tag with "pre" tag)
(adding lambdatalk)
Line 3,230:
Original set of elements = [ 1 $23.19 2 elbow 3 2 Bork 4 3 elbow 2 $23.19 ]
With duplicates removed = [ 1 $23.19 2 elbow 3 Bork 4 ]
 
=={{header|Lambdatalk}}==
<syntaxhighlight lang="scheme">
 
{def removedup
{def removedup.loop
{lambda {:a :b}
{if {A.empty? :a}
then :b
else {removedup.loop {A.rest :a}
{if {= {A.in? {A.first :a} :b} -1}
then {A.addlast! {A.first :a} :b}
else :b}}}}}
{lambda {:s}
{S.replace (\[|\]|,) by space in
{A.disp
{removedup.loop {A.new :s} {A.new}}}}}}
-> removedup
 
{removedup 1 2 3 a b c 2 3 4 b c d}
-> 1 2 3 a b c 4 d
</syntaxhighlight>
 
=={{header|Logo}}==
99

edits