home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!gatech!psuvax1!groucho.cs.psu.edu!mchen
- From: mchen@groucho.cs.psu.edu (Michael Chen)
- Subject: Re: breaking up a list for use as proc arguments
- Message-ID: <Bt2Hpn.10r@cs.psu.edu>
- Sender: news@cs.psu.edu (Usenet)
- Nntp-Posting-Host: groucho.cs.psu.edu
- Organization: Penn State Computer Science
- References: <Bt0Ftt.Kwt@cs.psu.edu> <1992Aug15.203115.3577@msi.com>
- Date: Sun, 16 Aug 1992 08:17:46 GMT
- Lines: 28
-
- In article <1992Aug15.203115.3577@msi.com> bill@msi.com writes:
- >: >The list and concat commands can take
- >: >nonlist arguments and create a list from them. What about the
- >: >converse? How do I take a list and break it up so that
- >: >
- >: >proc twoargs {arg1 arg2} {}
- >: >set a [list 1 2]
- >: >twoargs [breakuplist $a]
- >: >
- >: >works? I know that
- >: >
- >: >twoargs [lindex $a 0] [lindex $a 1]
- >: >
- >: Well, I've been using eval [concat twoargs $a] to do that sort of thing.
- >
- >Just eval twoargs $a should also work. eval does an implicit concat for
- >you.
-
- I was having problems using the list given by args when declaring procedures
- with variable arguments. The plain eval would take off the outer list, but
- leave the contents as a single argument when passed to another procedure. It
- turned out that doing another concat solved the problem.
-
- --
- _____________________________________________________________________________
- | Michael Chen | From the depths of our most lucid horrors |
- | | spring our fond hopes and pure desires... |
- | mchen@groucho.cs.psu.edu | except what comes from HELL! :-) 7/23/92 |
-