home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / tcl / 1198 < prev    next >
Encoding:
Text File  |  1992-08-14  |  771 b   |  27 lines

  1. Newsgroups: comp.lang.tcl
  2. Path: sparky!uunet!usc!cs.utexas.edu!tamsun.tamu.edu!inetg1!cgp
  3. From: cgp@Arco.COM (Chris Phillips  (214) 754-6419)
  4. Subject: breaking up a list for use as proc arguments
  5. Message-ID: <1992Aug15.030841.19439@Arco.COM>
  6. Organization: ARCO Oil and Gas Company
  7. Date: Sat, 15 Aug 1992 03:08:41 GMT
  8. Lines: 17
  9.  
  10. The list and concat commands can take
  11. nonlist arguments and create a list from them.  What about the 
  12. converse?  How do I take a list and break it up so that
  13.  
  14. proc twoargs {arg1 arg2} {}
  15. set a [list 1 2]
  16. twoargs [breakuplist $a]
  17.  
  18. works?  I know that
  19.  
  20. twoargs [lindex $a 0] [lindex $a 1]
  21.  
  22. will work but this can be very tedious for procs that take a lot
  23. of arguments.  Of course, it's even worse when [llength $a] is not
  24. known a priori.
  25.  
  26. Chris
  27.