all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Using hash table to apply command sequence with arguments
@ 2024-11-25 12:05 Heime via Users list for the GNU Emacs text editor
  2024-12-22 12:42 ` Joel Reicher
  0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread

* Re: Using hash table to apply command sequence with arguments
  2024-11-25 12:05 Using hash table to apply command sequence with arguments Heime via Users list for the GNU Emacs text editor
@ 2024-12-22 12:42 ` Joel Reicher
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Reicher @ 2024-12-22 12:42 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor; +Cc: Heime

Heime via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> writes:

> How can use a hash table to execute a sequence of commands, 
> possibly with arguments.

Hash tables aren't sequences.

Regards,

        - Joel



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-22 12:42 UTC | newest]

Thread overview: 2+ messages (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
2024-12-22 12:42 ` Joel Reicher

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.