[HN Gopher] Not Lisp again (2009)
___________________________________________________________________
Not Lisp again (2009)
Author : caslon
Score : 55 points
Date : 2021-02-28 21:03 UTC (1 hours ago)
(HTM) web link (funcall.blogspot.com)
(TXT) w3m dump (funcall.blogspot.com)
| caslon wrote:
| Past threads in reverse-chronological order:
|
| https://news.ycombinator.com/item?id=18308721 (236 comments)
| https://news.ycombinator.com/item?id=14247269 (263 comments)
| https://news.ycombinator.com/item?id=504667 (39 comments)
| p_l wrote:
| Bravo!
| etaioinshrdlu wrote:
| I feel like this is a lot less impressive nowadays that first-
| class functions are common. It might as well be Python:
| dx = .0001 def deriv(f): def f_prime(x):
| return (f(x+dx) - f(x)) / dx return f_prime
| lisper wrote:
| A lisp interpreter including lexical closures and a parser in 114
| lines of Python code:
|
| http://flownet.com/ron/lisp/l.py
| auggierose wrote:
| Every few years I see this great story popping up. I love it! A
| lot of things seem complicated, but are not, if you just approach
| it the right way, and if you don't get bogged down in up-front
| technical optimisations which you feel are necessary, but might
| not be.
| simias wrote:
| I must admit that I never understood what these particular
| examples had to do with Lisp being such a great programing
| language given that you can implement exactly the same logic in
| basically any programing language, including for instance C
| (although you'd have to cheat a bit for the `deriv` function,
| admittedly): #include <stdio.h>
| #define DX 0.0001 #define DERIV(_f) float
| deriv_##_f(float x) { return (_f(x + DX) - _f(x)) / DX; }
| float cube(float x) { return x * x * x; }
| DERIV(cube) int main(void) {
| printf("%f\n", deriv_cube(2)); printf("%f\n",
| deriv_cube(3)); printf("%f\n", deriv_cube(4));
| }
|
| Any language supporting closures or generics could get rid of the
| unsexy DERIV macro.
|
| What sets Lisp apart is its "code as data" approach which lets
| the coder write incredibly powerful macro (and also incredibly
| hard to understand code). The rest can easily be emulated in
| other languages.
|
| I do like this naive approach mind you, there's a certain Zen to
| be found reimplementing these mathematical concepts from first
| principles, I just really fail to see what makes Lisp so
| remarkable in this context.
___________________________________________________________________
(page generated 2021-02-28 23:00 UTC)