News for hackers. Stuff that matters.
Re:A Tour of Lisps by a2code on Tuesday January 30, 2024 @08:06AM (#39189638)
What makes Lisp (Scheme) great (for me) is that functions are first class citizens, the prefix syntax is consistent, tail call recursion optimization makes it runnable, and metaprogramming allows for powerful abstractions. What I would also emphasize is that using lambda expressions makes you wonder when to define something and when to omit the definition. Lisp is simple to learn but difficult to master.

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.

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.)

Re:A Tour of Lisps by a2code on Tuesday January 30, 2024 @09:15AM (#39190330)
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.