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

  1. Path: sparky!uunet!cis.ohio-state.edu!rutgers!psuvax1!groucho.cs.psu.edu!mchen
  2. From: mchen@groucho.cs.psu.edu (Michael Chen)
  3. Newsgroups: comp.lang.tcl
  4. Subject: Re: breaking up a list for use as proc arguments
  5. Message-ID: <Bt0Ftt.Kwt@cs.psu.edu>
  6. Date: 15 Aug 92 05:41:52 GMT
  7. References: <1992Aug15.030841.19439@Arco.COM>
  8. Sender: news@cs.psu.edu (Usenet)
  9. Organization: Penn State Computer Science
  10. Lines: 26
  11. Nntp-Posting-Host: groucho.cs.psu.edu
  12.  
  13. In article <1992Aug15.030841.19439@Arco.COM> cgp@Arco.COM (Chris Phillips  (214) 754-6419) writes:
  14. >The list and concat commands can take
  15. >nonlist arguments and create a list from them.  What about the 
  16. >converse?  How do I take a list and break it up so that
  17. >
  18. >proc twoargs {arg1 arg2} {}
  19. >set a [list 1 2]
  20. >twoargs [breakuplist $a]
  21. >
  22. >works?  I know that
  23. >
  24. >twoargs [lindex $a 0] [lindex $a 1]
  25. >
  26. >will work but this can be very tedious for procs that take a lot
  27. >of arguments.  Of course, it's even worse when [llength $a] is not
  28. >known a priori.
  29.  
  30.    Well, I've been using eval [concat twoargs $a] to do that sort of thing.
  31.  
  32. --- Mike 
  33.  
  34. -- 
  35. _____________________________________________________________________________
  36. | Michael Chen            | From the depths of our most lucid horrors |
  37. |                | spring our fond hopes and pure desires... |
  38. | mchen@groucho.cs.psu.edu    | except what comes from HELL! :-) 7/23/92  |
  39.