|
|
|
|
|
by wostusername
2433 days ago
|
|
Been a while since I've done Lisp seriously, but I don't believe that's possible, at least in Common Lisp (SBCL). While if responds to symbol function: * (symbol-function 'if)
#<CLOSURE (:SPECIAL IF) {1000C5084B}>
SBCL refuses to set that value to an alias: * (setf (symbol-function 'foo) (symbol-function 'if))
#<THREAD "main thread" RUNNING {10005205B3}>:
#<CLOSURE (:SPECIAL IF) {1000C5084B}> is not acceptable to (SETF SYMBOL-FUNCTION)
Trying this with regular functions works as intended: * (setf (symbol-function 'bar) (symbol-function 'mapcar))
#<FUNCTION MAPCAR>
* (bar #'1+ '(1 2 3))
(2 3 4)
Special forms are, well, special and a lot of the regular parts of lisp doesn't work with them. |
|
I expected specials to work in this case, but apparently not.