home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / tcl / 1201 < prev    next >
Encoding:
Text File  |  1992-08-15  |  1.5 KB  |  41 lines

  1. Newsgroups: comp.lang.tcl
  2. Path: sparky!uunet!gatech!psuvax1!groucho.cs.psu.edu!mchen
  3. From: mchen@groucho.cs.psu.edu (Michael Chen)
  4. Subject: Re: breaking up a list for use as proc arguments
  5. Message-ID: <Bt2Hpn.10r@cs.psu.edu>
  6. Sender: news@cs.psu.edu (Usenet)
  7. Nntp-Posting-Host: groucho.cs.psu.edu
  8. Organization: Penn State Computer Science
  9. References: <Bt0Ftt.Kwt@cs.psu.edu> <1992Aug15.203115.3577@msi.com>
  10. Date: Sun, 16 Aug 1992 08:17:46 GMT
  11. Lines: 28
  12.  
  13. In article <1992Aug15.203115.3577@msi.com> bill@msi.com 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. >:    Well, I've been using eval [concat twoargs $a] to do that sort of thing.
  27. >
  28. >Just eval twoargs $a should also work.  eval does an implicit concat for
  29. >you.
  30.  
  31.    I was having problems using the list given by args when declaring procedures
  32. with variable arguments.  The plain eval would take off the outer list, but
  33. leave the contents as a single argument when passed to another procedure.  It
  34. turned out that doing another concat solved the problem.
  35.  
  36. -- 
  37. _____________________________________________________________________________
  38. | Michael Chen            | From the depths of our most lucid horrors |
  39. |                | spring our fond hopes and pure desires... |
  40. | mchen@groucho.cs.psu.edu    | except what comes from HELL! :-) 7/23/92  |
  41.