Questions tagged [hash-tables]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
59 views

How to use markers as keys in a hash map?

I'm creating a hash map and I'd like to use markers as keys. I set the hash map equality test to "equal", but the last line from the below code is returning ("bye" "fly") ...
user avatar
  • 113
1 vote
1 answer
44 views

Access hash table by value, not key?

Q: how can I access a hash table by its value, not its key? Association lists can be accessed via either their key or their value: (setq alist '((a .1) (b . 2) (c . 3))) (assoc 'a alist) ...
user avatar
  • 31.1k
2 votes
1 answer
109 views

Is there a way to change order of the key in a hashtable?

Say i have following keys in hashtable: "first1" "second2" "third3" "forth4" Is there a way to put key "third3" at the top. So that when i run func hash-table-keys i get following list: ("third3" "...
user avatar
  • 31
0 votes
1 answer
56 views

How to define a singe weak reference in elisp?

Hash tables in elisp supports weak references, however weak references may be useful without the need to use a hash. How can a weak reference to an object be defined without having to use a hash-...
user avatar
  • 7,179
0 votes
1 answer
69 views

Helm source from a hash-table

I want to build a helm-source from a large hash-table, is there a smarter/faster way to to this, than the way described below? (setq tab #s(hash-table size 16 test equal ...
user avatar
  • 175
1 vote
1 answer
318 views

how to implement a simple lookup table in lisp

I want to write an elisp function, when a country name is given, it returns the short code for the country. I've been reading about hash tables, but still not sure how to hashify my data set and make ...
user avatar
4 votes
3 answers
1k views

Get a better printed representation of a hash-table

I work with ELisp hash-table and I would like to have a better printed representation of it. I'm on Emacs version 24.5.1. When I create a hash-table (setq table (make-hash-table)) (puthash :name "...
user avatar
  • 141
7 votes
1 answer
6k views

Accessing JSON data in elisp

JSON: { "name": "xxxxx", "job": "xxxxxx", "projects": [ { "name": "xxxxx", "date": "xxxxx", "about": "xxxxxxxxxx" }, { "name": "xxxxx", "date": "xxxxx",...
user avatar
  • 73
2 votes
1 answer
91 views

Insert an entry into hash using put

(defvar-local hash-entries nil) (put 'hash-entries "key" "val") (message "%S" hash-entries) I try to add a key-value pair to the hash variable, hash-entries using the function put. But when i print ...
user avatar
  • 1,887
1 vote
1 answer
119 views

What's the most concise way to make a hash table with data in it?

I'd like to create a hash table with data already in it. I know I can do so as follows: (let ((my-table (make-hash-table))) (puthash 'k1 'v1 my-table) (puthash 'k2 'v2 my-table) (puthash 'k3 '...
user avatar
  • 8,584
7 votes
2 answers
304 views

How to speed up the loading of large hashtables?

As I understand from the manual (last paragraphs of http://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Hash.html) and the question https://stackoverflow.com/questions/11745097/ on ...
user avatar
  • 7,344
1 vote
3 answers
198 views

How to increment several numeric keys of a hash-table

Q: How to programmatically increment several numeric keys of a hash-table. Background: I am working on a modificion of speedbar to support the concept of speedbar-get-marked-files -- speedbar -- ...
user avatar
  • 17.7k
0 votes
2 answers
66 views

"Lisp error" when trying to append hash tables to a list

Q:  Is there a way to create one cache that consists of one cons cell and two hash tables? If so, how, please. If not, what is the best way to handle this scenario? Background: I'm working on a ...
user avatar
  • 17.7k