Lisp compiler in 89 lines of Python
bernhardkausler.wordpress.com
Lisp compiler in 89 lines of Python
1–9 of 9 posts
Re: Lisp compiler in 89 lines of Python
#2Re: Lisp compiler in 89 lines of Python
#3Currently + is implemented as a special form. You could translate + to operator.add, treat it like a function, and obtain better generality. Also, lambda is not implemented. (The only functions are global ones using 'set'). Lambda is, in some sense, the essence of a Lisp; it seems like a reach to call this a Lisp compiler without lambda.
He made something and shared it with us. That's more than 99% of programmers can say.
Re: Lisp compiler in 89 lines of Python
#4Currently + is implemented as a special form. You could translate + to operator.add, treat it like a function, and obtain better generality. Also, lambda is not implemented. (The only functions are global ones using 'set'). Lambda is, in some sense, the essence of a Lisp; it seems like a reach to call this a Lisp compiler without lambda.
I think that's a running gag when implementing "lisp." I can recall seeing some "lisp in javascript" library a while back that also neglected to implement that "minor detail."
Re: Lisp compiler in 89 lines of Python
#5Currently + is implemented as a special form. You could translate + to operator.add, treat it like a function, and obtain better generality. Also, lambda is not implemented. (The only functions are global ones using 'set'). Lambda is, in some sense, the essence of a Lisp; it seems like a reach to call this a Lisp compiler without lambda.
Good critique but harsh, could you have at least spared some positive notes at the end of this blazer? He made something and shared it with us. That's more than 99% of programmers can say.
Re: Lisp compiler in 89 lines of Python
#6Earlier quoted context omitted.
Good critique but harsh, could you have at least spared some positive notes at the end of this blazer? He made something and shared it with us. That's more than 99% of programmers can say.
I have no clue what you are reacting to. His comment was 100% constructive criticism. Everything was a suggestion.
It was an example designed under pretty specific constraints that preclude the suggestions he was making.
Re: Lisp compiler in 89 lines of Python
#7Currently + is implemented as a special form. You could translate + to operator.add, treat it like a function, and obtain better generality. Also, lambda is not implemented. (The only functions are global ones using 'set'). Lambda is, in some sense, the essence of a Lisp; it seems like a reach to call this a Lisp compiler without lambda.
> it seems like a reach to call this a Lisp compiler without lambda. I think that's a running gag when implementing "lisp." I can recall seeing some "lisp in javascript" library a while back that also neglected to implement that "minor detail."
(eval. '(lambda (x) x) nil)
to the REPL with the following definitions:Re: Lisp compiler in 89 lines of Python
#8Currently + is implemented as a special form. You could translate + to operator.add, treat it like a function, and obtain better generality. Also, lambda is not implemented. (The only functions are global ones using 'set'). Lambda is, in some sense, the essence of a Lisp; it seems like a reach to call this a Lisp compiler without lambda.
Good critique but harsh, could you have at least spared some positive notes at the end of this blazer? He made something and shared it with us. That's more than 99% of programmers can say.
I guess I should probably come up with my own Lisp implementation now :)
Re: Lisp compiler in 89 lines of Python
#9Earlier quoted context omitted.
I have no clue what you are reacting to. His comment was 100% constructive criticism. Everything was a suggestion.
I disagree. It was an example designed under pretty specific constraints that preclude the suggestions he was making.
If that still takes to many lines for his challenge, leave out linked lists or arithmetic. Lambdas are more important in Lisp, and you can re-create both of them as a library in the language, if you have lambdas.