Interface, by example:
(my-run-command '(my-append (3 6 8) (4 5)))
Desired output:
(3 6 8 4 5)
Implementation, with bits missing:
(defun my-run-command (command)
(let ((my-append 'append))
[…]))
What should […]
be?
I tried (eval (cons 'funcall command))
, but that tries to evaluate (3 6 8)
, which results in an error message.
command
in your implementation. Maybe that's one of the missing bits, but it's hard to know what you're trying to do. A wild guess is that you should maybe be usingcl-flet
instead oflet
, but again, I have no idea what you're trying to do or asking. If you have trouble clarifying your question, consider showing more code and saying what you expect it to do and what it does that you don't want/expect.let
does not bind the function definition to the symbol’s function cell. So the symbol cannot be executed as function withapply
. I actually, did discoverflet
before asking the question, but I didn’t know that it needs to be called usingcl-flet
(although it is possible to enable an alias toflet
– it works on my other system). Also, I didn’t know aboutsymbol-function
and#'
which is part of the answer by @phils.