[Lispweb] IMHO: popup-list
Marco Antoniotti
marcoxa at cs.nyu.edu
Tue Feb 26 11:08:43 CST 2002
> From: mdanish at andrew.cmu.edu
> Cc: lispweb at red-bean.com
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> User-Agent: Mutt/1.3.17i
> Sender: lispweb-admin at red-bean.com
> X-BeenThere: lispweb at red-bean.com
> X-Mailman-Version: 2.0.8
> Precedence: bulk
> Date: Mon, 25 Feb 2002 23:34:01 -0500
> Content-Length: 1831
>
> On Mon, Feb 25, 2002 at 10:12:14PM -0500, Erik Enge wrote:
> > Hi, gang.
> >
> > I want to use the popup-list form-element IMHO offers. In the
> > documentation of the initarg items, it says:
> >
> > assoc list, or function returning alist, of items appearing
> > in the list
> >
> > Fine. So, I assume, then, that this should work:
> >
> > (defun some-items ()
> > '(("1" . ("2" . ()))))
> >
> > (resources
> > :type popup-list
> > :initargs (:items #'some-items))
> >
> > However, I get the error message:
> >
> >
> > Type-error in KERNEL::OBJECT-NOT-LIST-ERROR-HANDLER:
> > FUNCTION is not of type LIST
> >
> > From the source (form-elements.lisp) I can tell that one does not even
> > look to see if the slot items can contain a function and assumes it is
> > a list (which explains the error).
> >
> > So, which is right, documentation or code? Patches accepted?
>
> Code, of course =)
>
> I've always used a-lists of the form
>
> ((:item-1 "Item 1") (:item-2 "Item 2") ...)
>
> and never had trouble with it. Your example a-list doesn't look like one,
> btw.
Please note that your example of an a-list is also somewhat
misleading.
cl-prompt> (defvar *al* '((:item-1 "Item 1") (:item-2 "Item 2")))
*AL*
cl-prompt> (assoc :item-2 *al* :test #'eq)
("Item 1")
I.e. an a-list is always to be thought as
((item1 . content1) (item2 . content2) ...)
Anyway, this begs the question: why a-lists and not HASH-TABLEs?
Cheers
--
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488
719 Broadway 12th Floor fax +1 - 212 - 995 4122
New York, NY 10003, USA http://bioinformatics.cat.nyu.edu
"Hello New York! We'll do what we can!"
Bill Murray in `Ghostbusters'.
More information about the lispweb
mailing list