<?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/6367" />

	<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>2003-12-13T12:15:44-04:00</updated>

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

		<entry>
		<author><name><![CDATA[GodOfSuicide]]></name></author>
		<updated>2003-12-13T12:15:44-04:00</updated>

		<published>2003-12-13T12:15:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31387#p31387</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31387#p31387"/>
		<title type="html"><![CDATA[array unset procedure]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31387#p31387"><![CDATA[
user, what did you do to your avatar again..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1433">GodOfSuicide</a> — Sat Dec 13, 2003 12:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-12-12T22:31:20-04:00</updated>

		<published>2003-12-12T22:31:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31380#p31380</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31380#p31380"/>
		<title type="html"><![CDATA[array unset procedure]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31380#p31380"><![CDATA[
<blockquote class="uncited"><div>he said and I quote "I just want to unset an element and not the whole array... " so.. that should do what he asked..</div></blockquote>Using array unset to unset single array elements does not work without escaping some chars in the pattern first. (you could argue it works most of the time, but that's not good enough)<br><blockquote class="uncited"><div>lremove &lt;array_element&gt;(proc 1) or &lt;listname&gt; (proc 2)  element (glob style)</div></blockquote>You seem to be a bit confused about arrays/lists<br><br>A list is just a way to format your data while an array element is a place to store the data (think of them as normal variables with strange names <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz">)<br><br>Here's one proc to remove elements from a list and one to unset array elements:<div class="codebox"><p>Code: </p><pre><code># usage: lremove &lt;list&gt; &lt;glob pattern matched against element names&gt;# returns: the new listproc lremove {list mask} {set i 0foreach elem $list {if {[string match $mask $elem]} {set list [lreplace $list $i $i]} {incr i}}set list}# usage: array_unset &lt;array name&gt; &lt;glob pattern matched against element names&gt;# returns: nothingproc array_unset {array mask} {upvar 1 $array arrforeach elem [array names arr $mask] {unset arr($elem)}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Dec 12, 2003 10:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cerberus_gr]]></name></author>
		<updated>2003-12-12T18:28:36-04:00</updated>

		<published>2003-12-12T18:28:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31377#p31377</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31377#p31377"/>
		<title type="html"><![CDATA[array unset procedure]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31377#p31377"><![CDATA[
I have the opinion that tcl8.0, which I'm using, does not support <strong class="text-strong">array unset</strong> command and that's why I have all these problems <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>Sir_Fz I have thougth of this, but I don't know how I should give as argument.<br><div class="codebox"><p>Code: </p><pre><code>proc lremove { list element } {    set temp ""    for {set i 0} {$i &lt; [llength $list]} {incr i} {        if {![string match $element [lindex $list $i]]} { lappend temp [lindex $list $i] }    }     return "$temp"}</code></pre></div>Would be correct this one?<div class="codebox"><p>Code: </p><pre><code>proc lremove { array_element list_element } {     global $array_element    for {set i 0} {$i &lt; [llength $array_element]} {incr i} {        if {![string match $list_element [lindex $array_element $i]]} { lreplace $array_element $i $i }    } }</code></pre></div>Example:<br>I have this array:<br><br>element1 data1 element2 {data2.1 data2.2 data2.3} element3 data3<br><br>and I simply to use:<br>lremove &lt;array_element&gt;(proc 1) or &lt;listname&gt; (proc 2)  element (glob style)<br><br>and not:<br>set array_element [lremove $array_element list_element] <br><br>Thx for your time <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2661">cerberus_gr</a> — Fri Dec 12, 2003 6:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-12-12T15:07:48-04:00</updated>

		<published>2003-12-12T15:07:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31370#p31370</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31370#p31370"/>
		<title type="html"><![CDATA[array unset procedure]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31370#p31370"><![CDATA[
he said and I quote "I just want to unset an element and not the whole array... " so.. that should do what he asked..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri Dec 12, 2003 3:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-12-12T13:13:07-04:00</updated>

		<published>2003-12-12T13:13:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31367#p31367</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31367#p31367"/>
		<title type="html"><![CDATA[I've said this before...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31367#p31367"><![CDATA[
<blockquote class="uncited"><div>something like this should do it..<div class="codebox"><p>Code: </p><pre><code>array unset yourarray $element</code></pre></div>Don't forget to call globaly the array via an global yourarray and no need of $ in front of yourarray like $yourarray..</div></blockquote>And don't forget that the part you called 'element' is actually a PATTERN (glob), so to unset single elements, using the good old 'unset' would probably make your life alot easier.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Dec 12, 2003 1:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-12-12T11:40:56-04:00</updated>

		<published>2003-12-12T11:40:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31360#p31360</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31360#p31360"/>
		<title type="html"><![CDATA[array unset procedure]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31360#p31360"><![CDATA[
something like this should do it..<div class="codebox"><p>Code: </p><pre><code>array unset yourarray $element</code></pre></div>Don't forget to call globaly the array via an global yourarray and no need of $ in front of yourarray like $yourarray..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri Dec 12, 2003 11:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-12-12T11:01:01-04:00</updated>

		<published>2003-12-12T11:01:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31356#p31356</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31356#p31356"/>
		<title type="html"><![CDATA[array unset procedure]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31356#p31356"><![CDATA[
call globaly a variable, and use <strong class="text-strong">set variable [lreplace.....]</strong><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Fri Dec 12, 2003 11:01 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cerberus_gr]]></name></author>
		<updated>2003-12-11T18:53:52-04:00</updated>

		<published>2003-12-11T18:53:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31345#p31345</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31345#p31345"/>
		<title type="html"><![CDATA[array unset procedure]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31345#p31345"><![CDATA[
I have a list in an array and I want to remove an element from the array and not from the list... I could do this in the way I said before, but I want to make a procedure for this.<br><br>The only way that I have thougthis to call lremove like:<br>set listname [lremove listname guss]<br><br>and lremove procedure to return a new list without these elements...<br><br>Any ideas to make a procedure which returns 0 or 1 and it sipmly removes the list element from the array element?<br><br>Example:<br>Tcl: invite {loutrino_arkoudaki thanoulis thanoulis2 thanoulis2323 skynet mar|a guss pranky white_tiger}<br><br>array element: invite<br>array get $array invite returns the list<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2661">cerberus_gr</a> — Thu Dec 11, 2003 6:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-12-11T11:42:24-04:00</updated>

		<published>2003-12-11T11:42:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31328#p31328</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31328#p31328"/>
		<title type="html"><![CDATA[array unset procedure]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31328#p31328"><![CDATA[
use <strong class="text-strong">unset arrayname(stored-value)</strong> same this as <strong class="text-strong">array unset arrayname stored-value</strong><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Thu Dec 11, 2003 11:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cerberus_gr]]></name></author>
		<updated>2003-12-11T07:39:00-04:00</updated>

		<published>2003-12-11T07:39:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31314#p31314</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31314#p31314"/>
		<title type="html"><![CDATA[array unset procedure]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31314#p31314"><![CDATA[
array unset arrayName ?pattern?<br><br>I just want to unset an element and not the whole array...<br><br>hmmmm<br><br>I think about that again and it seems that I just want to delete an element from a LIST and not from an array where I could do this you said CrazyCat.<br><div class="codebox"><p>Code: </p><pre><code>proc lremove { list element } {#  uplevel????   for {set i 0} {$i &lt; [llength $list]} {incr i} {       if {[string match $element [lindex $list $i]]} { lreplace $list $i $i }   } }</code></pre></div>I have to use uplevel. right?<br>Any help about it?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2661">cerberus_gr</a> — Thu Dec 11, 2003 7:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2003-12-11T07:35:42-04:00</updated>

		<published>2003-12-11T07:35:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31312#p31312</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31312#p31312"/>
		<title type="html"><![CDATA[array unset procedure]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31312#p31312"><![CDATA[
set $array_name ""<br>unset $array_name<br><br>Not tested, but I think it may works<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Thu Dec 11, 2003 7:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cerberus_gr]]></name></author>
		<updated>2003-12-11T07:08:56-04:00</updated>

		<published>2003-12-11T07:08:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=31310#p31310</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=31310#p31310"/>
		<title type="html"><![CDATA[array unset procedure]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=31310#p31310"><![CDATA[
Hello,<br><br>I use tcl 8.0 which doesn't support "array unset" command.<br>How could I create a proc to do the same as unset option?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2661">cerberus_gr</a> — Thu Dec 11, 2003 7:08 am</p><hr />
]]></content>
	</entry>
	</feed>
