Groups | Search | Server Info | Login | Register


Groups > comp.lang.tcl > #55596

Re: How do I get an element of a list without it being substituted?

From Emiliano <emiliano@example.invalid>
Newsgroups comp.lang.tcl
Subject Re: How do I get an element of a list without it being substituted?
Date 2026-03-19 18:08 -0300
Organization A noiseless patient Spider
Message-ID <20260319180807.352f25d7c8ddd320497a5fa7@example.invalid> (permalink)
References <10pevmb$454s$2@dont-email.me> <10pf5rt$73m7$1@dont-email.me> <10pfoql$cht5$2@dont-email.me>

Show all headers | View raw


On Thu, 19 Mar 2026 02:59:33 -0000 (UTC)
Rich <rich@example.invalid> wrote:

[...]
> Are you sure?:
> 
>   % set myList {"First\nElement" {Second Element}}
>   "First\nElement" {Second Element}
>   % llength $myList
>   2
>   % lindex $myList 0
>   First
>   Element
> 
> It looks like the list parser, when encountering a quoted string in the 
> thing it is parsing to a list, has invoked rule 4 and performed 
> "backslash substitution" when creating list element zero.

Yes, this is described in detail in TIP 407 "The String Representation
of Tcl Lists: the Gory Details".

https://core.tcl-lang.org/tips/doc/trunk/tip/407.md

Regards

-- 
Emiliano <emil.gavilan@gmail.com>

Back to comp.lang.tcl | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

How do I get an element of a list without it being substituted? Choosechee <choosechee@pm.me> - 2026-03-18 14:50 -0500
  Re: How do I get an element of a list without it being substituted? Helmut Giese <hgiese@ratiosoft.com> - 2026-03-18 21:16 +0100
    Re: How do I get an element of a list without it being substituted? pmcc <sysfl@free.fr> - 2026-03-18 21:34 +0100
      Re: How do I get an element of a list without it being substituted? Choosechee <choosechee@pm.me> - 2026-03-18 16:31 -0500
    Re: How do I get an element of a list without it being substituted? Choosechee <choosechee@pm.me> - 2026-03-18 16:34 -0500
  Re: How do I get an element of a list without it being substituted? Rich <rich@example.invalid> - 2026-03-18 20:32 +0000
    Re: How do I get an element of a list without it being substituted? Choosechee <choosechee@pm.me> - 2026-03-18 16:33 -0500
      Re: How do I get an element of a list without it being substituted? Rich <rich@example.invalid> - 2026-03-19 02:50 +0000
        Re: How do I get an element of a list without it being substituted? Choosechee <choosechee@pm.me> - 2026-03-18 22:22 -0500
          Re: How do I get an element of a list without it being substituted? Rich <rich@example.invalid> - 2026-03-19 03:55 +0000
    Re: How do I get an element of a list without it being substituted? Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk> - 2026-03-21 06:39 +0000
  Re: How do I get an element of a list without it being substituted? Robert Heller <heller@deepsoft.com> - 2026-03-18 21:35 +0000
    Re: How do I get an element of a list without it being substituted? Rich <rich@example.invalid> - 2026-03-19 02:59 +0000
      Re: How do I get an element of a list without it being substituted? Emiliano <emiliano@example.invalid> - 2026-03-19 18:08 -0300
  Re: How do I get an element of a list without it being substituted? Choosechee <choosechee@pm.me> - 2026-03-18 22:28 -0500
    Re: How do I get an element of a list without it being substituted? Ralf Fassel <ralfixx@gmx.de> - 2026-03-19 11:11 +0100
  Re: How do I get an element of a list without it being substituted? Christian Gollwitzer <auriocus@gmx.de> - 2026-03-20 08:09 +0100

csiph-web