help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: completing-read() on list of vectors


From: Nordlöw
Subject: Re: completing-read() on list of vectors
Date: Fri, 12 Sep 2008 04:19:14 -0700 (PDT)
User-agent: G2/1.0

On 12 Sep, 12:30, Nordlöw <per.nord...@gmail.com> wrote:
> If I have the following association list (alist):
>
> (defvar c++-stl-algorithms
>   '(
>     ("adjacent_difference" "<numeric>" "Compute the differences
> between adjacent elements in a range")
>     ("adjacent_find" "<algorithm>" "Finds two items that are adjacent
> to eachother")
>   ))
>
> how can I modify the use of completing-read() to make the function
>
> (defun read-c++-stl-algorithm ()
>   (let* ((sym (thing-at-point 'symbol))
>          (cont (completing-read (concat "C++ STL Algorithm (default "
> sym "): ")
>                                 c++-stl-algorithms nil t nil nil
> sym)))
>     (list cont)))
>
> to instead work on this list of vectors:
>
> (defvar c++-stl-algorithms
>   '(
>     ["adjacent_difference" "<numeric>" "Compute the differences
> between adjacent elements in a range"]
>     ["adjacent_find" "<algorithm>" "Finds two items that are adjacent
> to eachother"]
>   ))
>
> I guess I need to give it an explicit completion function (as second
> argument) to achieve lookups of list of vectors where for example
> "accumulate" is used as key and the return value is the whole list
> element (vector).
>
> Why doesn't completing-read() already work on list of vectors where
> first vector element is a string aswell?
>
> Thanks in advance,
> Nordlöw

It believe it boils down to the search for a function like assoc()
that takes a list of vectors as arguments.

/Nordlöw


reply via email to

[Prev in Thread] Current Thread [Next in Thread]