emacs-devel
[Top][All Lists]
Advanced

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

Re: Stepping Back: A Wealth Of Completion systems Re: [ELPA] New package


From: Philip Kaludercic
Subject: Re: Stepping Back: A Wealth Of Completion systems Re: [ELPA] New package: vertico
Date: Mon, 12 Apr 2021 12:14:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Jean Louis <bugs@gnu.support> writes:

> * Philip Kaludercic <philipk@posteo.net> [2021-04-11 18:53]:
>> Jean Louis <bugs@gnu.support> writes:
>> 
>> > One way I use for complex data structures is to have some kind of ID
>> > and visual description, then by using the ID I fetch the data
>> > structure later.
>> 
>> I'm not sure I completely understood your example. What do hash tables
>> offer over lists of objects that can have a programmed
>> representation?
>
> Completing read supports hash tables, once representation candidate
> has been selected one can then use the key to get value of some quite
> different or very complex data structure.
>
> (setq h (make-hash-table :test 'equal))
> (puthash "United States" [("ABC" 30 t)] h)
> (puthash "Australia" 2 h)
> (puthash "United Kingdom" 3 h)
>
> (message "%s" (gethash (completing-read "Choice: " h) h)) ⇒ "[(ABC 30 t)]"

But don't you think that it is weird that completing-read returns the
representation and not the object itself. That is exactly what I want to
avoid by having the representation computed using a method.

The best I can think of is using hash-maps to generate anonymous methods
but even that seems to be looking at the issue backwards.

-- 
        Philip K.



reply via email to

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