Re: confused about lists and strings...

Liste des GroupesRevenir à cl tcl 
Sujet : Re: confused about lists and strings...
De : rich (at) *nospam* example.invalid (Rich)
Groupes : comp.lang.tcl
Date : 02. Jul 2025, 13:59:32
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <1043afk$3h3vi$2@dont-email.me>
References : 1 2 3
User-Agent : tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Mark Summerfield <m.n.summerfield@gmail.com> wrote:
Thanks, I hadn't realised that using `args` would give me a list in a
list.

The proc man page documents this 'special nature' of 'args' (note the
third sentence below):

   There is one special case to permit procedures with variable numbers
   of arguments.  If the last formal argument has the name “args”, then
   a call to the procedure may contain more actual arguments than the
   proce‐ dure has formal arguments.  In this case, all of the actual
   arguments starting at the one that would be assigned to args are
   combined into a list (as if the list command had been used); this
   combined value is as‐ signed to the local variable args.

Note also from the above that it is only 'special' when it is the "last
argument" to the proc.

  $ rlwrap tclsh
  % proc abc {args y} {puts "args='$args' y='$y'" }
  % abc 1 2
  args='1' y='2'
  %


Date Sujet#  Auteur
2 Jul 25 * confused about lists and strings...8Mark Summerfield
2 Jul 25 `* Re: confused about lists and strings...7Harald Oehlmann
2 Jul 25  `* Re: confused about lists and strings...6Mark Summerfield
2 Jul 25   +* Re: confused about lists and strings...3et99
2 Jul 25   i`* Re: confused about lists and strings...2Rich
2 Jul 25   i `- Re: confused about lists and strings...1et99
2 Jul 25   +- Re: confused about lists and strings...1Rich
2 Jul 25   `- Re: confused about lists and strings...1Christian Gollwitzer

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal