home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / lisp / 3055 < prev    next >
Encoding:
Internet Message Format  |  1992-12-12  |  2.6 KB

  1. Path: sparky!uunet!newsflash.concordia.ca!mizar.cc.umanitoba.ca!access.usask.ca!cs.Usask.CA!coulman
  2. From: coulman@cs.Usask.CA (Randy Coulman)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Functions
  5. Date: 12 Dec 1992 20:46:38 GMT
  6. Organization: University of Saskatchewan
  7. Lines: 51
  8. Sender: coulman@skorpio (Randy Coulman)
  9. Distribution: world
  10. Message-ID: <1gdj3eINN73l@access.usask.ca>
  11. Reply-To: coulman@cs.Usask.CA
  12. NNTP-Posting-Host: skorpio.usask.ca
  13.  
  14. I'm currently building an application using Allegro CL 4.1 and CLIM 1.1 on 
  15. a Sparc 1+.  One piece of functionality I need to include in my application
  16. is to allow users to specify and edit functions.  These functions would 
  17. ideally be lambda expressions.  Later, the application would use apply or 
  18. funcall to use the lambda expressions.  Unfortunately, the new standard says
  19. that lambda expressions are no longer valid function arguments to funcall
  20. and apply.  Instead, it is necessary to use #'(lambda ... instead of 
  21. '(lambda ...  I can easily make it a requirement that these functions need
  22. to be specified with #'.  However, this takes away the ability to later edit
  23. the function.  
  24.  
  25. As an example, my application uses a class of object called Observers.  Each 
  26. observer knows how to make one binary (i.e., t or nil) observation about the 
  27. real world.  This is accomplished through the use of an observer function 
  28. (ofun).  The application I'm building allows the user to define new
  29. observers, so they need to be able to define the ofun's as well.  E.g.:
  30.  
  31. Defining Observer...
  32. Name: Always
  33. Ofun: '(lambda (c)
  34.          (declare (ignore c))
  35.          t)
  36. ...
  37.  
  38. If I use #'(lambda ... above, then editing would look like this:
  39.  
  40. Editing Observer...
  41. Name: Always
  42. Ofun: #<Interpreted Function (unnamed) @ ...>
  43.  
  44. Am I missing something completely obvious about how to get around this 
  45. problem?  If not, can anyone suggest a reasonable work around?
  46.  
  47. The way I'm doing it now is to define these functions in a source file,
  48. giving them names (strings) and storing them in a hash table.  If the user
  49. wants to define new functions, they have to edit the source file before
  50. loading the system.  This is not acceptable.
  51.  
  52. Thanks in advance for any help.
  53.  
  54. Randy
  55.  
  56. P.S.  Please e-mail instead-of/in-addition-to posting any replies.  Our
  57. news feed is behind by about 5 or 6 days right now.  I'll post a 
  58. summary.
  59.  
  60. -- 
  61. Randy A. Coulman                |       ARIES Laboratory
  62. Research Assistant              |       Department of Computational Science
  63.                                 |       University of Saskatchewan
  64. coulman@cs.Usask.ca             |       Saskatoon, SK   S7N 0W0             
  65.