News for hackers. Stuff that matters.
Re:Lisp Wins (Steve Yegge article) by ken on Wednesday May 14, 2008 @04:33PM (#189967)
If you just want to print the same output, you can be ever so slightly shorter than his Perl/Python:

(dotimes (i 5) (print (expt (1+ i) 2)))

This doesn't follow his semantic steps, so it's kind of cheating, though in a real program I have a bunch of utility functions to help me out so it's about the same:

(join " " (mapcar #'sq (range 1 5)))

I think the point is not that Lisp is shorter for any given toy problem, but that Lisp allows you to build such abstractions. Even if you had join() and range() and sq() in Java, what's Java for (f x (mapcar #'g (h y z)))?

There are no comments on this comment yet.