I'd like to write an elisp-function that has a function as argument and returns a new function.
Let's say the new function double-the-function
should write the returned value of the argument-function twice.
(The argument function operates on a string and returns a string. This is ensured.)
So:
(reverse "abc")
returns: "cba"
If I define the function f
as follows:
(setq f (double-the-function reverse))
I expect that:
(f "abc")
returns "cbacba"
which is equal to (concat (reverse cba) (reverse "cba"))
.
How to define double-the-function
?