<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/9863" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2005-06-21T04:07:49-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/9863</id>

		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2005-06-21T04:07:49-04:00</updated>

		<published>2005-06-21T04:07:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51169#p51169</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51169#p51169"/>
		<title type="html"><![CDATA[Removing duplicate or more elements from a list.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51169#p51169"><![CDATA[
Ah thanks, I didn't bother to lookup lsort. I know what it is used to arranging elements in some order and sorting them didn't know about the 'unique' switch. I'll give it a go, this is more simpler and easier.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Tue Jun 21, 2005 4:07 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-06-21T03:56:44-04:00</updated>

		<published>2005-06-21T03:56:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51167#p51167</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51167#p51167"/>
		<title type="html"><![CDATA[Removing duplicate or more elements from a list.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51167#p51167"><![CDATA[
amazingly simple as it may sound, yet valid and effective:<br><div class="codebox"><p>Code: </p><pre><code>proc remdum alist {   return [lsort -unique $alist]}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Tue Jun 21, 2005 3:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2005-06-21T03:32:22-04:00</updated>

		<published>2005-06-21T03:32:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51166#p51166</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51166#p51166"/>
		<title type="html"><![CDATA[Removing duplicate or more elements from a list.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51166#p51166"><![CDATA[
Yeah I had that in mind actually, posted that earlier and above. Some one told me a way like:<br><div class="codebox"><p>Code: </p><pre><code>[lreplace $mylist [lsearch -exact $mylist $element] [lsearch -exact $mylist $element]]</code></pre></div>Or it was something similar to something like this -- wanted to do it with lreplace.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Tue Jun 21, 2005 3:32 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-06-21T03:12:34-04:00</updated>

		<published>2005-06-21T03:12:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51165#p51165</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51165#p51165"/>
		<title type="html"><![CDATA[Removing duplicate or more elements from a list.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51165#p51165"><![CDATA[
looping through the list, adding current element to another list after checking whether it's already there:<br><div class="codebox"><p>Code: </p><pre><code>proc remdup alist {   set blist {}   foreach elem $alist {      if {[lsearch -exact $blist $elem] == -1} {         lappend blist $elem      }    }   return blist}</code></pre></div>on a side note, [lset] has been introduced only recently (in Tcl 8.3 or 8.4 I believe), so it's not so good idea to use it in a general purpose script<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Tue Jun 21, 2005 3:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2005-06-21T03:09:22-04:00</updated>

		<published>2005-06-21T03:09:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51163#p51163</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51163#p51163"/>
		<title type="html"><![CDATA[Removing duplicate or more elements from a list.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51163#p51163"><![CDATA[
Something like this:<br><div class="codebox"><p>Code: </p><pre><code>set mynewlist [list]foreach element $mylist { if {[lsearch -exact [string tolower $mylist] [string tolower $element]] == -1} {  lappend mynewlist $element  }}</code></pre></div>Someone has something better maybe?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Tue Jun 21, 2005 3:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2005-06-21T02:52:43-04:00</updated>

		<published>2005-06-21T02:52:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51161#p51161</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51161#p51161"/>
		<title type="html"><![CDATA[Removing duplicate or more elements from a list.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51161#p51161"><![CDATA[
What is the best and easiest way to remove 2 or more than 2 duplicate elements from a list? LREPLACE? LSET? and how?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Tue Jun 21, 2005 2:52 am</p><hr />
]]></content>
	</entry>
	</feed>
