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: Jean Louis
Subject: Re: Stepping Back: A Wealth Of Completion systems Re: [ELPA] New package: vertico
Date: Mon, 12 Apr 2021 12:24:54 +0300
User-agent: Mutt/2.0.6 (2021-03-06)

* 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)]"



-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://rms-support-letter.github.io/




reply via email to

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