home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!rutgers!psuvax1!groucho.cs.psu.edu!mchen
- From: mchen@groucho.cs.psu.edu (Michael Chen)
- Newsgroups: comp.lang.tcl
- Subject: Re: breaking up a list for use as proc arguments
- Message-ID: <Bt0Ftt.Kwt@cs.psu.edu>
- Date: 15 Aug 92 05:41:52 GMT
- References: <1992Aug15.030841.19439@Arco.COM>
- Sender: news@cs.psu.edu (Usenet)
- Organization: Penn State Computer Science
- Lines: 26
- Nntp-Posting-Host: groucho.cs.psu.edu
-
- In article <1992Aug15.030841.19439@Arco.COM> cgp@Arco.COM (Chris Phillips (214) 754-6419) 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]
- >
- >will work but this can be very tedious for procs that take a lot
- >of arguments. Of course, it's even worse when [llength $a] is not
- >known a priori.
-
- Well, I've been using eval [concat twoargs $a] to do that sort of thing.
-
- --- Mike
-
- --
- _____________________________________________________________________________
- | 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 |
-