Live data from Hacker News

Why Lisp?

blog.rongarret.info

11–20 of 248 posts

Re: Why Lisp?

#11

Which lisp do you use? I've used SBCL and tried using mocl and ECL on mobile platforms, but without any real luck. Too much work getting them set up.

Clozure CL is easy to install/run on just about any desktop platform (windows included). On *nix, SBCL is a good choice. I've heard good things about MOCL but haven't tried it myself, and I know getting ECL working on mobile is an uphill battle (but achievable if you have the time). ECL switched maintainers recently, so maybe mobile is something they will focus on in the future.

Seconding the Clozure CL recommendation. It supports threads on Windows, which really expands your options if you want to do web development in Common Lisp.

I run Linux on my web servers but develop from a Windows desktop. CCL works great on both.

Re: Why Lisp?

#12
The article doesn't discuss macros, which is one of the answers to "Why Lisp?"

I didn't "get" macros until I read a footnote in the (freely available) book Practical Common Lisp. In chapter 7, it introduces the `dolist` macro.

    DOLIST loops across the items of a list, executing the loop
    body with a variable holding the successive items of the list.
    This is the basic skeleton (leaving out some of the more
    esoteric options):

    (dolist (var list-form)
      body-form*)

    ...For instance:

    CL-USER> (dolist (x '(1 2 3))
               (print x))
    1
    2
    3
    NIL
Buried in a footnote is this:

"DOLIST is similar to Perl's `foreach` or Python's `for`. Java added a similar kind of loop construct with the 'enhanced' for loop in Java 1.5, as part of JSR-201.

Notice what a difference macros make. A Lisp programmer who notices a common pattern in their code can write a macro to give themselves a source-level abstraction of that pattern. A Java programmer who notices the same pattern has to convince Sun that this particular abstraction is worth adding to the language. Then Sun has to publish a JSR and convene an industry-wide "expert group" to hash everything out. That process--according to Sun--takes an average of 18 months. After that, the compiler writers all have to go upgrade their compilers to support the new feature. And even once the Java programmer's favorite compiler supports the new version of Java, they probably still can't use the new feature until they're allowed to break source compatibility with older versions of Java.

So an annoyance that Common Lisp programmers can resolve for themselves within five minutes plagues Java programmers for years."

http://www.gigamonkeys.com/book/macros-standard-control-cons...

Re: Why Lisp?

#13
> Among other things, it makes writing interpreters and compilers really easy, and so inventing new languages and writing interpreters and compilers for them becomes [...] a part of day-to-day Lisp programming.

This matches my experience. The barrier between application and language/compiler development disappears, and instead you get a rich new feedback loop between the two. Overall complexity decreases (The effects of this compound over time, so what starts as a mere notational difference turns into a deeply different programming style, one I find so enjoyable that doing without it feels like going back into a straitjacket after escaping.

Re: Why Lisp?

#14

The article doesn't discuss macros, which is one of the answers to "Why Lisp?" I didn't "get" macros until I read a footnote in the (freely available) book Practical Common Lisp . In chapter 7, it introduces the `dolist` macro. DOLIST loops across the items of a list, executing the loop body with a variable holding the successive items of the list. This is the basic skeleton (leaving out some of the more esoteric opt…

And if you want Python-style iterators, that's easy too:

http://blog.rongarret.info/2008/02/joy-of-iterators.html

Re: Why Lisp?

#15

Which lisp do you use? I've used SBCL and tried using mocl and ECL on mobile platforms, but without any real luck. Too much work getting them set up.

Did you reach out to me when you were using mocl? Surprised to hear this. AFAIK most users get up and running w/o much trouble.

Re: Why Lisp?

#16

The article doesn't discuss macros, which is one of the answers to "Why Lisp?" I didn't "get" macros until I read a footnote in the (freely available) book Practical Common Lisp . In chapter 7, it introduces the `dolist` macro. DOLIST loops across the items of a list, executing the loop body with a variable holding the successive items of the list. This is the basic skeleton (leaving out some of the more esoteric opt…

On the other hand, this really hurts readability. When reading other people's code you now effectively have to learn what "language" they use too.

I'd say it's probably worth that cost, if used judiciously.

Re: Why Lisp?

#17

The article doesn't discuss macros, which is one of the answers to "Why Lisp?" I didn't "get" macros until I read a footnote in the (freely available) book Practical Common Lisp . In chapter 7, it introduces the `dolist` macro. DOLIST loops across the items of a list, executing the loop body with a variable holding the successive items of the list. This is the basic skeleton (leaving out some of the more esoteric opt…

Just to expand on your comment. One can write the equivalent code for a for in python[0] but one can't make python rewrite itself.

[0]: https://gist.github.com/PuercoPop/9d192f94f88074d06625

Re: Why Lisp?

#18

The article doesn't discuss macros, which is one of the answers to "Why Lisp?" I didn't "get" macros until I read a footnote in the (freely available) book Practical Common Lisp . In chapter 7, it introduces the `dolist` macro. DOLIST loops across the items of a list, executing the loop body with a variable holding the successive items of the list. This is the basic skeleton (leaving out some of the more esoteric opt…

> The act of describing what you want the machine to do is interleaved with the machine actually doing what you have described, observing the results, and then changing the description of what you want the machine to do based on those observations. There is no bright line where a program is finished and becomes an artifact unto itself.

Author doesn't mention macros explicitly, but I think the above quote is referring to them implicitly.

Re: Why Lisp?

#19

Earlier quoted context omitted.

Clozure CL is easy to install/run on just about any desktop platform (windows included). On *nix, SBCL is a good choice. I've heard good things about MOCL but haven't tried it myself, and I know getting ECL working on mobile is an uphill battle (but achievable if you have the time). ECL switched maintainers recently, so maybe mobile is something they will focus on in the future.

Seconding the Clozure CL recommendation. It supports threads on Windows, which really expands your options if you want to do web development in Common Lisp. I run Linux on my web servers but develop from a Windows desktop. CCL works great on both.

Thirding CCL :-) The built-in IDE and ObjC integration are awesome for developing on a Mac. And you can deploy finished code on Linux and Windows.

Re: Why Lisp?

#20

The article doesn't discuss macros, which is one of the answers to "Why Lisp?" I didn't "get" macros until I read a footnote in the (freely available) book Practical Common Lisp . In chapter 7, it introduces the `dolist` macro. DOLIST loops across the items of a list, executing the loop body with a variable holding the successive items of the list. This is the basic skeleton (leaving out some of the more esoteric opt…

It would help if I saw a real world problem and how you can solve it Lisp and not in say Python.
Post reply on HN