home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / tcl / 1200 < prev    next >
Encoding:
Internet Message Format  |  1992-08-15  |  1.3 KB

  1. Path: sparky!uunet!cs.utexas.edu!swrinde!mips!msi!snoopy!bill
  2. From: bill@snoopy (Bill Poitras)
  3. Newsgroups: comp.lang.tcl
  4. Subject: Re: breaking up a list for use as proc arguments
  5. Message-ID: <1992Aug15.203115.3577@msi.com>
  6. Date: 15 Aug 92 20:31:15 GMT
  7. References: <Bt0Ftt.Kwt@cs.psu.edu>
  8. Sender: usenet@msi.com (USENET)
  9. Reply-To: bill@msi.com
  10. Organization: Molecular Simulations, Inc.
  11. Lines: 24
  12. X-Newsreader: Tin 1.1 PL5
  13.  
  14. Michael Chen (mchen@groucho.cs.psu.edu) wrote:
  15. : >The list and concat commands can take
  16. : >nonlist arguments and create a list from them.  What about the 
  17. : >converse?  How do I take a list and break it up so that
  18. : >
  19. : >proc twoargs {arg1 arg2} {}
  20. : >set a [list 1 2]
  21. : >twoargs [breakuplist $a]
  22. : >
  23. : >works?  I know that
  24. : >
  25. : >twoargs [lindex $a 0] [lindex $a 1]
  26. : >
  27. :    Well, I've been using eval [concat twoargs $a] to do that sort of thing.
  28.  
  29. Just eval twoargs $a should also work.  eval does an implicit concat for
  30. you.
  31.  
  32. --
  33. +-----------------+-------------------------------+-------------------------+
  34. | Bill Poitras    | Molecular Simulations Inc.    | Tel (408)522-9229       |
  35. | (bill)          | Sunnyvale, CA USA             |                         | 
  36. |                 | FAX (408)732-0831             | bill@msi.com            |
  37. +-----------------+-------------------------------+-------------------------+
  38.