Find the setf way of doing the equivalent of fset in lisp.
Asked
Active
Viewed 370 times
-6
-
1This is not a question. What do you mean by *fset*? What is the problem? Do you have an example? What did you try? What is the expected result? – coredump Jan 25 '18 at 21:41
-
In lisp code, the _fset_ command does certain things. We need to find a way to use _setf_ to do the same things that _fset_ can do. – defaultname Jan 25 '18 at 21:58
-
what certain things? can you describe them in your own words? – Will Ness Jan 25 '18 at 22:09
-
3This is homework, what did you try to do? Did you search on google? (e.g. https://www.gnu.org/software/emacs/manual/html_node/elisp/Setting-Generalized-Variables.html) – coredump Jan 25 '18 at 22:12
-
I don't think this question is "unclear"; but it is excessively terse, and on review I must agree that it does read like a direct quote of a homework question! – phils Jan 26 '18 at 14:20
1 Answers
2
(symbol-function 'foo)
is a Generalized Variable in elisp, so you can use:
(setf (symbol-function 'forward-word) #'backward-word)
as an alternative to:
(fset 'forward-word #'backward-word)
(As a side-note, you can do the same thing with cl-letf
as a replacement for the deprecated flet
when you want to override a function using dynamic scope.)

phils
- 71,335
- 11
- 153
- 198