3 ms·
Wow! That's wonderful!. Forth and Lisp were my favorite languages long long time ago. Python is my current daily use language among others. I even don't know th
by jjcc 6y ago
Wow! That's wonderful!. Forth and Lisp were my favorite languages long long time ago. Python is my current daily use language among others. I even don't know they are connected.
- Zaak 6y agoThey're not /really/ connected, at least historically. But the author sees a reasonable progression in ease of use, while maintaining a lot of flexibility. And the idea of starting with a forth-like system, building a lisp-like system with it, then putting a python-like syntax on top of it is very interesting.
- asrp 6y agoHere's what I was thinking when I wrote the "incorrect assumption" line. But I think many other interpretations are also valid. You can think of sum([x*x for x in range(10)]) as "desugaring" to sum(list_comp(lambda(x, quote(multiply(x, x))), range(10))) which looks like Lisp if you move every open parens one token to the left and remove the commas (sum (list_comp (lambda x (quote (multiply x x))) (range 10))) To evaluate this, parameters are first recursively evaluated (in order) and then the function is called on the outer value. Let's ignore the lambda for the moment. (sum (list_comp quoted_inner_func (range 10))) results in the following function calls are made at execution time _in this order_ quoted_inner_func 10 range list_comp sum Normally, you'd have to pass the correct parameter to each function. However, in Forth, we use a global parameter stack so provided all the functions respect their inputs and output, running the above body would provide the desired result on the parameter stack!
- jjcc 6y agoThanks. That's a good explanation. I like "desugaring"