Re: Canonical Way to Mask SETF?
- From: Kent M Pitman <pitman@xxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 23:33:57 GMT
Robert Uhl <eadmund42@xxxxxxxxxxxxxxx> writes:
> I'm playing with a menu system, and would like to be able to write the
> following:
>
> (menu-item menu) -> item
> (setf (menu-item menu) item)
>
> I figured that something like this would do the trick:
>
> (defun menu-item (menu)
> (getf menu :title))
>
> (defsetf menu-title (menu) (title)
> `(setf (getf ,menu :title) ,title))
>
> But of course it doesn't work. Any advice on how this needs to be
> written?
Maybe you want to call the defun menu-TITLE, not menu-ITEM?
Or you want to call the setf function menu-ITEM, not menu-TITLE?
Otherwise I don't see why it shouldn't work.
> Unfortunately there aren't too many online references which deal with
> DEFSETF--at least none that I've found.
It's not supposed to be hard. It's like you did it, just with spelling
done right.
.
- Follow-Ups:
- Re: Canonical Way to Mask SETF?
- From: Kent M Pitman
- Re: Canonical Way to Mask SETF?
- References:
- Canonical Way to Mask SETF?
- From: Robert Uhl
- Canonical Way to Mask SETF?
- Prev by Date: Re: ILC2005: McCarthy denounces Common Lisp, "Lisp", XML, and Rahul
- Next by Date: Re: ILC2005: McCarthy denounces Common Lisp, "Lisp", XML, and Rahul
- Previous by thread: Re: Canonical Way to Mask SETF?
- Next by thread: Re: Canonical Way to Mask SETF?
- Index(es):
Relevant Pages
|