Re:قلب: a non-ASCII programming language written in Arabic
by p_l on Friday October 25, 2019 @11:59AM
(#21356264)
None and none, as what you need is to alias the symbols for most lisps.
[ Parent
| on HN ]
Re:قلب: a non-ASCII programming language written in Arabic
by wostusername on Friday October 25, 2019 @03:16PM
(#21358275)
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.
Re:قلب: a non-ASCII programming language written in Arabic
by p_l on Sunday October 27, 2019 @08:20PM
(#21373382)
hmm, I think worst case symbol-macro should work there :/
I expected specials to work in this case, but apparently not.
Re:قلب: a non-ASCII programming language written in Arabic
by kazinator on Friday October 25, 2019 @05:25PM
(#21359395)
Yes; alias the symbols that are macro operators or special operators via macros, and alias other kinds of symbols in their respective namespaces.
Variables may also have to be done with macros, because you want an assignment to a translated variable name to appear in the original variable. Some Lisp dialects perhaps allow a variable cell to have a binding to two or more symbols which could do the same thing.