Live data from Hacker News

What's Special About Lisp?

kresimirbojcic.com

41–50 of 69 posts

Re: What's Special About Lisp?

#41
I have a question for those that have done a lot of programming in Lisp: Is macro programming a really big part of Lisp programming? I mean, what percentage of a typical project would be macros?

I ask the question because you can achieve the same results in most dynamic languages by grabbing the string representation of a function, run it through a parser, modify the resulting AST and then regenerating the function string before passing to an eval (CoffeeScript being a good example of this approach). Sure, it's messier than in Lisp, but in return for the messiness of macros, you get much easier to read syntax in most of your code. Is the use of macros really such a big part of Lisp programs that it justifies the lack of syntax everywhere else?

Re: What's Special About Lisp?

#42
post #39
post #18

Earlier quoted context omitted.

well, if it's a language for writing libraries - why there are no libraries? :)

popularity, culture and ease of sharing libraries(ex. cpan) for one. But also its not that its great for writing libraries but that its great for writing libraries that extend the language.

I think that Zach Beane is doing a stupendous job with quicklisp. Of course it's nowhere near CPAN at this stage, but it's a tremendous step forward compared to, say, plain asdf-install.

Re: What's Special About Lisp?

#43

I feel for the author and have recently come to a similar (read: not same ) conclusion: Lisp is pretty crappy for maybe 90% of the work being done out there. The more easily-accessible and popular a domain is, the worse Lisp will be for it. This isn't because Lisp magically gets worse; it's because other languages get better , through libraries. Even if nine of ten libraries are crappy, there are enough people in the…

From what I've seen this role is now played as much, if not more, by languages like Scala and Haskell. Certainly languages like that owe a large debt to Lisp but I'm not so sure what you say is as true of Lisp today as it once was.

I agree and should note that pure functional languages more suited for writing libraries than languages with some first-class functional features. This is so because pureness encourages composability of various parts of program.

The state allows parts of program to communicate through implicit information channel. One part of program could signal another to increment a variable by deleting a file. Or vice versa.

That's why I think Haskell is the best for libraries, Scala less so and Lisp even lesser, even taking into account macro system, code-as-data, etc.

Re: What's Special About Lisp?

#44
post #12

From one page the author linked to [1]: "Because coders DO NOT LIKE LISP. Most programmers find Lisp unpleasant and unnatural to use. They're not idiots, they're not ignorant, and they're not willfully choosing a less-powerful or less-efficient tool, they're choosing tools based on what makes them productive and happy." The "profound enlightenment experience you will have when you finally get [functional programming]…

Have you looked at "The Joy of Clojure"? I thought the authors did a very good job of showing why exactly they're so excited to be working with the language.

In any case, this is very much a question of discourse. For historical reasons Lisp (at least Common Lisp) seems to have this reputation of being associated with deadly serious people, or alternatively smug lisp weenies, while Ruby people talk about how happy it makes them feel all the time, even though there are plenty of people who clearly have fun with Lisp (even "crufty" "old" CL), and I'm sure many people would regard working with Ruby a chore. I mean, to each his own, I honestly can't imagine there's an objective scale on which CL (much less exciting new languages like Clojure) is "less fun" than Ruby. Things like homoiconicity, on the other, are objective criteria for comparing languages. There are plenty of reasons to like (say) Python better than (say) CL, but to say that homoiconicity or restarts or MOP are no big deal because if you try hard enough you can replicate 95% of that functionality in (say) Perl is a different question entirely.

Re: What's Special About Lisp?

#45

I have a question for those that have done a lot of programming in Lisp: Is macro programming a really big part of Lisp programming? I mean, what percentage of a typical project would be macros? I ask the question because you can achieve the same results in most dynamic languages by grabbing the string representation of a function, run it through a parser, modify the resulting AST and then regenerating the function s…

How would you implement a new control structure that way? I think it won't be possible unless you write a parser for the whole language. Take clojures "or" for example, it's just a macro. The language has only very few primitives [1] and that's the language, everything else is built out of that.

user=> (macroexpand '(or true false))

(let* [or__3470__auto__ true] (if or__3470__auto__ or__3470__auto__ (clojure.core/or false)))

Also, I don't think that lisp "syntax" is unreadable, on the contrary.

[1] http://clojure.org/special_forms

Re: What's Special About Lisp?

#46
post #7
post #3

Earlier quoted context omitted.

Being a Lisp enthousiast myself I often find those LISP elitists are people new to the language repeating the tired arguments we have heard so often before.

I'm learning clojure, and find it has a certain elegance, but I don't fully "get it" yet.

I "got it" after reading a bulk of SICP and watching some buddy-lectures at http://academicearth.org/courses/the-structure-and-interpret... (I've also started SICM: it's awesome how they use Scheme.[1]) Nevertheless there's still a level I have yet to reach that I hope to achieve with Clojure (which has recently jumped to the top of my list of languages to learn). While Lisp (Scheme in particular, though CL is nice too) is near my heart, my brain still thinks in Python, Python makes me Happy, and that hinders my speed and concentration when I do stuff in Lisp. I liken it to my experience trying to (unsuccessfully) master Dvorak. The layout was easy to memorize so I could touch-type, I could easily see the benefits, and if I ever get spasms in my hands I'm going to force myself to switch over, but dropping from 80-100wpm down to 10-30wpm was too much loss that I didn't let my finger-muscles relearn and so I'm still with QWERTY.

[1] Even though it's trivial I still adore this simple example:

    guile> (define D derivative)
    guile> (define f (literal-function 'f))
    guile> (define f^2 (expt f 2))
    guile> (pe ((D f^2) 't))
    (* 2 (f t) ((D f) t))
Add in the little things like being able to have boolean-returning-functions ending with '?', Lisp is very free.

Re: What's Special About Lisp?

#47
Homoiconicity is part of the answer. The other part is that Lisp is built up from a small number of axioms (probably the smallest such number) that are Turing-complete and at the same time are a language that people would actually want to use.

As pg says: "In 1960, John McCarthy published a remarkable paper in which he did for programming something like what Euclid did for geometry. He showed how, given a handful of simple operators and a notation for functions, you can build a whole programming language. [...] It's worth understanding what McCarthy discovered [my emphasis], not just as a landmark in the history of computers, but as a model for what programming is tending to become in our own time. " http://www.paulgraham.com/rootsoflisp.html

Why does pg say McCarthy discovered Lisp, not invented it? I think because it's something of such simplicity that one can imagine others inventing the same thing. So if humans contacted intelligent aliens, it wouldn't surprise me if they had independently invented Lisp, just as it wouldn't surprise me if they'd invented prime numbers, or cartesian co-ordinates.

Re: What's Special About Lisp?

#48

I do love ruby and feel that it's metaprogramming techniques to allow you to easily emulated many features of Lisp's macros. That said the author missing an obvious thing here. They key with macros is that they allow you to alter syntax (not calculate values as many who try initially misunderstand them), and s-exps are essential to being able to do this (because they are effectively an abstract syntax tree). I say th…

> and s-exps are essential to being able to do this

Counterexample: macros in Dylan (http://www.opendylan.org/books/dpg/db_329.html).

It's certainly true that Lisp's super-simple syntax makes it much easier to have a powerful macro system. Dylan macros are like Scheme's hygienic macros, based on pattern-matching and not as flexible as CL's fully general code-generating macros -- but still pretty powerful. (And there's an unofficial procedural macro system too, which I haven't looked at but I understand gives you CL-like power without too much pain.)

Re: What's Special About Lisp?

#49
post #22

A ton of responses and no one mentions the one-word answer? "homoiconicity": the property of a language whereby code written in said language is stored, in a natural and immediate fashion, as a data structure of the same language What this means for Lisp is that if you want to manipulate Lisp code, you aren't dealing with some crazy complex AST: you can actually /see/ how the code is parsed by looking at the code its…

> A ton of responses and no one mentions the one-word answer?

Statements like "You can easily do this is Ruby" hint that author understood exactly nothing and focused on some random uninteresting example code while missing big picture.

Does Ruby have COND?

If it doesn't, can one implement it using existing Ruby constructs?

If it does, can one implement it using existing Ruby constructs except COND?

Re: What's Special About Lisp?

#50

I have a question for those that have done a lot of programming in Lisp: Is macro programming a really big part of Lisp programming? I mean, what percentage of a typical project would be macros? I ask the question because you can achieve the same results in most dynamic languages by grabbing the string representation of a function, run it through a parser, modify the resulting AST and then regenerating the function s…

can you get an ast in perl/ruby/python?
Post reply on HN