Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Harald Oehlmann Newsgroups: comp.lang.tcl Subject: Re: The best way to copy a list? Date: Wed, 18 Jun 2025 13:20:26 +0200 Organization: A noiseless patient Spider Lines: 20 Message-ID: <102u7dp$33do6$1@dont-email.me> References: <102tpah$2vfsm$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 18 Jun 2025 13:20:26 +0200 (CEST) Injection-Info: dont-email.me; posting-host="46e43ad874cb5f2d532dea6f981966de"; logging-data="3258118"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX183EseHthjkNRJk1hKzs7Ua" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:Tj1tE7F6hI8LCbTP5K+zApdBLAY= In-Reply-To: <102tpah$2vfsm$1@dont-email.me> Content-Language: en-GB Am 18.06.2025 um 09:19 schrieb Mark Summerfield: > Is using `lmap` the best way to copy a list? For example: > > package require struct::list 1 > set a {a bc def ghij klmno} > # is the following the best way to copy a list? > set b [lmap x $a {expr {$x}}] > puts "a={$a} b={$b} a==b=[struct::list equal $a $b]" > > Output: > > a={a bc def ghij klmno} b={a bc def ghij klmno} a==b=1 Stupid question: set b $a to copy list b to a ?