home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!swrinde!mips!msi!snoopy!bill
- From: bill@snoopy (Bill Poitras)
- Newsgroups: comp.lang.tcl
- Subject: Re: breaking up a list for use as proc arguments
- Message-ID: <1992Aug15.203115.3577@msi.com>
- Date: 15 Aug 92 20:31:15 GMT
- References: <Bt0Ftt.Kwt@cs.psu.edu>
- Sender: usenet@msi.com (USENET)
- Reply-To: bill@msi.com
- Organization: Molecular Simulations, Inc.
- Lines: 24
- X-Newsreader: Tin 1.1 PL5
-
- Michael Chen (mchen@groucho.cs.psu.edu) wrote:
- : >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.
-
- --
- +-----------------+-------------------------------+-------------------------+
- | Bill Poitras | Molecular Simulations Inc. | Tel (408)522-9229 |
- | (bill) | Sunnyvale, CA USA | |
- | | FAX (408)732-0831 | bill@msi.com |
- +-----------------+-------------------------------+-------------------------+
-