* Using hash table to apply command sequence with arguments
@ 2024-11-25 12:05 Heime via Users list for the GNU Emacs text editor
0 siblings, 0 replies; only message in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-11-25 12:05 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor
How can use a hash table to execute a sequence of commands,
possibly with arguments. Here I am decoupling the action
from the conditions. Would this be a good strategy?
(defun fpln-test (actm-service)
(let ((actm-table (make-hash-table :test 'eq)))
;; Put entry to actm-table
(puthash 'armg (lambda ()
(alkotr-ar ar)
(alkotr-af af)))
actm-table)
;; Put entry to actm-table
(puthash 'go (lambda ()
(require 'alkotr)
(alkotr-ignition gf))
actm-table)
;; Map values from collection with lookup from hash table
(mapc (lambda (actm)
(let ((action (gethash actm actm-table)))
(if action
(funcall action)
(message "[marshal-falkotr]\n%s%s\n"
" └── ACTM Unrecognised:" "'" actm))))
actm-service)))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-11-25 12:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-25 12:05 Using hash table to apply command sequence with arguments Heime via Users list for the GNU Emacs text editor
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).