I would like to define this function:
(defun . (object method &rest args)
(apply (plist-get object method) args))
But, not surprisingly I get: if: Dot in wrong context
Not surprising because it looks like a cons cell and isn't. I can use some other character like @ or function name like dot, but it seems like it should be possible to use . too. Is there any way to do something like that?
The application is for a closure that defines a plist of functions, and I want something like a dot notation to access them.
This does work, but the double dot is a little unconventional from what I am used to:
(setq c (let ((counter 0))
(list :inc (lambda (&optional dx)
"Increment counter by DX (default=1)."
(incf counter (or dx 1))))))
(defun .. (object method &rest args)
(apply (plist-get object method) args))
(.. c :inc)