3 ms·
I don't know any Lisp, but I wonder about doing something like this in one, since if I understand correctly, even things like conditionals are functions. I'm su
by pgcj_poster 7y ago
I don't know any Lisp, but I wonder about doing something like this in one, since if I understand correctly, even things like conditionals are functions. I'm sure it would be possible with macros, but I wonder if you make a Chinese Lisp just by redefining functions.
- elangoc 7y agoIndeed! https://elangocheran.com/2014/10/30/exploring-programming-in-thamil-not-english-through-clojure/ https://elangocheran.com/2014/10/30/exploring-programming-in... https://youtu.be/MqjMZNwnYCY https://youtu.be/MqjMZNwnYCY Although I started the above project around the same time as Ramsey started his project in the original link (CLisp in Arabic), they were two entirely independent things. Ramsey's project is a 100% translation, whereas my project scales to other natural languages but is not a 100% translation. Tim and I worked on trying to make programming in other languages easier as a means to help more kids learn programming, and learn FP the Lisp way, which we explain as more natural. https://www.youtube.com/watch?v=Y3-53JoGPE4 https://www.youtube.com/watch?v=Y3-53JoGPE4 https://power-turtle.com/#freestyle https://power-turtle.com/#freestyle
- wostusername 7y agoConditionals are not functions in Lisp. They are 'special forms' since they have to control the evaluation of their arguments and functions always evaluate all their arguments. So, if you want to translate a lisp into another language you have to resort to macros.
- p_l 7y agoNone and none, as what you need is to alias the symbols for most lisps.
- wostusername 7y agoBeen 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.
- p_l 7y agohmm, I think worst case symbol-macro should work there :/ I expected specials to work in this case, but apparently not.
- kazinator 7y agoYes; 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.