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.

  • Your question is unclear (to me). You don't even use argument 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 using cl-flet instead of let, 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.
    – Drew
    Sep 8, 2018 at 22:43
  • Is there any reason you’re not able to use apply?
    – Dan
    Sep 8, 2018 at 23:01
  • @Dan let does not bind the function definition to the symbol’s function cell. So the symbol cannot be executed as function with apply. I actually, did discover flet before asking the question, but I didn’t know that it needs to be called using cl-flet (although it is possible to enable an alias to flet – it works on my other system). Also, I didn’t know about symbol-function and #' which is part of the answer by @phils.
    – feklee
    Sep 9, 2018 at 10:43

1 Answer 1


It looks like you want to alias a function name within the scope of the my-run-command body, so I'd suggest something more like:

(defun my-run-command (command)
  (cl-letf (((symbol-function 'my-append) #'append))
    (apply command)))

(my-run-command '(my-append (3 6 8) (4 5)))
=> (3 6 8 4 5)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.