Lisp.py
khamidou.com
khamidou.com
Backbone.js was the first time i saw it, and I loved it! https://backbonejs.org/docs/backbone.html It demonstrated to me that the libraries I use are just normal code that other people write, and i myself can read it to understand a problem.
> '[1, 2, 3]
[1, 2, 3]
> '(1 2 3)
(1 2 3)
> '[1, 2]
(1 . 2 )
> '[1,(2 3)]
(1 2 3)
https://github.com/timonoko/nokolis.pyInteresting solution! I wasn't sure if you were joking, but I see this syntax/convention is actually used.
(print-nice (34 100 101 102 113 40 39))
Is there a way to escape the first number if there's a need to create a list with a literal 34? > '(34 72 101 108 108 111)
"Hello"Two random comments: if you haven’t played with the Hy language (hylang) it is pretty cool, a surface Clojure like syntax on top of Python. Also, have you tried the Python version of the book?
What would you propose as "more pythonic" here? Writing your own integer parsing code, by looking at the ASCII values of each character in the string?
It would be nice if it were clearer how to download the plaintext.
(Yes, I know some do without, but usually not without a great reason...for example Clojure needing to maintain JVM calling conventions)
And regardless, adding TCO is relatively simple as well, so not exactly a hard problem to figure out after you've written the first version of your toy lisp.
1: http://neopythonic.blogspot.com/2009/04/tail-recursion-elimi... 2: http://neopythonic.blogspot.com/2009/04/final-words-on-tail-...
- https://github.com/kanaka/mal/blob/master/impls/python/step5...
- Theory: https://github.com/kanaka/mal/blob/master/process/guide.md#s...
Even with the exact same representation, it will speed up the no cases at the expense of slightly slowing down the yes cases (assuming that that is also what the function itself does), but since this is called on tokens with no a-priori reason to expect a match as the normal case, you’ll have more no than yes, so even if it was symmetric speed swap that'd be a win (and I think the existing way you lose more to each exception that you gain avoiding duplicating the check on matches, so it should be a bigger gain that you'd expect if it was symmetric.)