From: Heime <heimeborgia@protonmail.com>
To: Heime via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: Printing a hash table
Date: Mon, 23 Sep 2024 02:30:31 +0000 [thread overview]
Message-ID: <cnMBb_MXLXEunGJJB-0wM_m7XERzPkmId_DqwmwqOq5q6pWYTvzoqAnIdJPf5uf2WcqIqFg0Yp2hdTcVNRKNLOHDm7IAoFQUyavdw25H9Ws=@protonmail.com> (raw)
Is this the way to fill a hash table and print the values.
(defvar marshal-fpln (make-hash-table :test 'equal)
"Hash table storing paths for different marshal components.")
(defun marshal-insert ()
(puthash "MRSHL" marshal-waypt marshal-fpln)
(puthash "NAPLN" (concat marshal-waypt "/poleon") marshal-fpln)
(puthash "FLKTR" (concat rellana-waypt "/alkotr") marshal-fpln)
(puthash "GLXKS" (concat rellana-waypt "/xiakos") marshal-fpln)
(puthash "ARKTK" (concat rellana-waypt "/ritika") marshal-fpln) )
(defun torium-hash-table (hash-table &optional bfrn)
"Print HASH-TABLE to the buffer BFRN."
(let* ( (bfname (or bfrn "Torium Hash Table"))
(dbuffer (get-buffer-create (concat "𒆳 " bfname))) )
(with-current-buffer dbuffer
(maphash (lambda (key value)
(let* ( (start (point)) )
(insert (format " ━ %-8s" key))
(insert (format "\n %s\n" value))))
hash-table))))
I am getting the following error and cannot figure out how I can get out of it.
Debugger entered--Lisp error: (wrong-type-argument hash-table-p (("MRSHL") ("NAPLN") ("FLKTR") ("GLXKS") ("ARKTK" . t)))
maphash((closure (t) (key value) (let* ((start (point))) (insert (format " ━ %-8s" key)) (add-text-properties start (point) '(face (:foreground "green"))) (insert (format "\n %s\n" value)))) (("MRSHL") ("NAPLN") ("FLKTR") ("GLXKS") ("ARKTK" . t)))
(save-current-buffer (set-buffer dbuffer) (face-remap-add-relative 'default :background "blue") (insert "\n Hash Table \n\n") (maphash #'(lambda (key value) (let* ((start (point))) (insert (format " ━ %-8s" key)) (add-text-properties start (point) '(face ...)) (insert (format "\n %s\n" value)))) hash-table))
(let* ((bfname (or bfrn "Torium Hash Table")) (dbuffer (get-buffer-create (concat "𒆳 " bfname)))) (save-current-buffer (set-buffer dbuffer) (face-remap-add-relative 'default :background "blue") (insert "\n Hash Table \n\n") (maphash #'(lambda (key value) (let* ((start ...)) (insert (format " ━ %-8s" key)) (add-text-properties start (point) '...) (insert (format "\n %s\n" value)))) hash-table)))
torium-hash-table((("MRSHL") ("NAPLN") ("FLKTR") ("GLXKS") ("ARKTK" . t)))
next reply other threads:[~2024-09-23 2:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 2:30 Heime [this message]
2024-09-23 6:32 ` Printing a hash table tomas
2024-09-23 12:10 ` Heime
[not found] <<slrnm95tki.h18.joost.m.kremers@j.kremers4.news.arnhem.chello.nl>
2014-12-18 15:53 ` Drew Adams
-- strict thread matches above, loose matches on Subject: below --
2014-12-18 15:45 Joost Kremers
[not found] ` <mailman.16411.1418918006.1147.help-gnu-emacs@gnu.org>
2014-12-18 19:27 ` Joost Kremers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='cnMBb_MXLXEunGJJB-0wM_m7XERzPkmId_DqwmwqOq5q6pWYTvzoqAnIdJPf5uf2WcqIqFg0Yp2hdTcVNRKNLOHDm7IAoFQUyavdw25H9Ws=@protonmail.com' \
--to=heimeborgia@protonmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).