home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / lisp / 2118 < prev    next >
Encoding:
Text File  |  1992-07-27  |  1.2 KB  |  41 lines

  1. Newsgroups: comp.lang.lisp
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!wupost!micro-heart-of-gold.mit.edu!bloom-beacon!bloom-picayune.mit.edu!athena.mit.edu!wwinston
  3. From: wwinston@athena.mit.edu (R. Whitney Winston)
  4. Subject: Re: Want macro to produce 3 function calls
  5. Message-ID: <1992Jul27.180128.22493@athena.mit.edu>
  6. Sender: news@athena.mit.edu (News system)
  7. Nntp-Posting-Host: e40-008-13.mit.edu
  8. Organization: Massachusetts Institute of Technology
  9. References:  <Bs1zz1.E89@news.cso.uiuc.edu>
  10. Date: Mon, 27 Jul 1992 18:01:28 GMT
  11. Lines: 28
  12.  
  13. In article <Bs1zz1.E89@news.cso.uiuc.edu>, jmrg9881@uxa.cso.uiuc.edu (Jon Reid) writes:
  14. |> OK, this LISP beginner needs more help.  Here's what I'm trying to do:
  15. |> 
  16. |> There are 3 functions I call whose parameters are closely related.  I'm
  17. |> trying to write a single macro to produce the 3 function calls.
  18. |> 
  19. |> How can I do this?  Every macro I've seen evaluates to *one* list.
  20. |> 
  21. |> -- Jon Reid  (j-reid@uiuc.edu)
  22.  
  23. You're right, a macro is expanded to one list and then it is eval'd.
  24. You can make 3 function calls as follows:
  25.  
  26. (defmacro three-calls (one two three)
  27.     `(progn (print ,one)
  28.         (print ,two)
  29.         ,three))
  30.  
  31. >(three-calls '1 '2 '3)
  32. 1
  33. 2
  34. 3
  35. >
  36.  
  37. ---------
  38. >>whitney
  39. <wwinston@athena.mit.edu>
  40. <wwinston@speckle.ncsl.nist.gov>
  41.