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