[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parameter specializer (eql object) -- I'm confused
- To: comp-lang-lisp-mcl@services.cambridge.apple.com
- Subject: Re: parameter specializer (eql object) -- I'm confused
- From: Alexander Clark <asc@aclark.demon.co.uk>
- Date: Tue, 21 Jun 1994 09:37:50 GMT
- Newsgroups: comp.lang.clos, comp.lang.lisp.mcl
- Organization: None
- References: <PSHANNON.94Jun20211219@iapetus.cv.nrao.edu>
- Sender: news@demon.co.uk (Usenet Administration)
- Xref: services.cambridge.apple.com comp.lang.clos:2075 comp.lang.lisp.mcl:5596
Subject: parameter specializer (eql object) -- I'm confused
From: Paul Shannon, pshannon@iapetus.cv.nrao.edu
Date: Tue, 21 Jun 1994 01:12:19 GMT
In article <PSHANNON.94Jun20211219@iapetus.cv.nrao.edu> Paul Shannon, pshannon@iapetus.cv.nrao.edu writes:
>I would like to be able to specialize a method on the value of
>an object, like this:
>
> (defmethod dispatch ((eql "Save"))
> ...)
>
>I can't get this to work under Macintosh Common Lisp (2.0.1)
>Specifically:
>
>(defmethod dispatch-callback ((eql "Apple") (eql "Save"))
> (format t "dispatch-callback: apple, save~%"))
>
>Error: Illegal arg "Apple"
>
>I guess I've misconstrued this kind of parameter specializer. Keene's
>book (as far as I can tell) doesn't present examples.
>
>Any advice?
>
>Thanks.
>
> - Paul Shannon
> pshannon@nrao.edu
> National Radio Astronomy Observatory
> Charlottesville, Virginia
>
>
The syntax is like this
(defmethod dispatch-callback ((var1 (eql "Apple"))
(var2 (eql "Save")))
(format t "dispatch-callback: apple, save~%"))
but this won't work anyway because you need 'equal' for strings not 'eql'
What effect are you trying to get? What do the other methods look like for this function?
---------------------------
Alexander Clark
asc@aclark.demon.co.uk
---------------------------