Re:A Tour of Lisps
by hayley-patton on Tuesday January 30, 2024 @08:14AM
(#39189713)
> To optimize this further, you need implementation dependent code and replace abstractions of S-expressions with native machine code
This can be done by a program called a compiler. There are many compilers for Lisp.
(In other words, the same argument applies to every language ever which doesn't exactly correspond to machine code.)
And yet to extend Python, for example, you write code once. To extend Lisp, you have to extend a multiplicity of implementations you find relevant.
Re:A Tour of Lisps
by JonChesterfield on Tuesday January 30, 2024 @03:56PM
(#39195715)
There are properly good lisp compilers. The baseline is good and they're extensible - you can teach them things about your domain. SBCL for lisp. Maybe racket for scheme.
What I would like to do is to use Lisp to solve complex problems. The problem is that abstractions are not often efficient.
For example, consider computing the calculus product rule. An S-expression abstracts the function: (lambda (u v) (* u v). With metaprogramming, this becomes a new S-expression (lambda (u v) (+ (* (d u) v) (* u (d v)))), where (d u) and (d v) further compute the derivative. To optimize this further, you need implementation dependent code and replace abstractions of S-expressions with native machine code. This is where I feel that the troubles with Lisp start.