Live data from Hacker News

What's Special About Lisp?

kresimirbojcic.com

61–69 of 69 posts

Re: What's Special About Lisp?

#61
I think whole point of comparing programming languages from this angle is pointless. You should not go and judge a language by several phrases. Go speak/write/read it for a while, learn some slang.

Like all other languages, programming languages are also just that, languages - tools to express your thoughts. To me and many others Common Lisp reduces the friction between those thoughts and written description of them. It is so much more to this language than just its syntax and politics. It is joy to develop in thanks to SLIME, it almost never gets in your way, it performs, it has wisdom of half a century and people who possess it. Yes, it is far from perfect, but then again - there is no perfect language! and even if there was one it would sound like those studio processed pop-star voices rather than perfection to me, because it would still superimpose its perfection over you own views.

In other words, please don't judge the language by how you can pronounce "how can I get to the city centre", it sounds similar in most.

Now all this spoken/written language comparison might sound weird to you, but to me it makes perfect sense, because programming to me is nothing but a dialogue between me, computer and the future version of me reading the source. And I like the language which allows me to do this on my terms, rather than that of Guido, Matz or whoever. And to me Common Lisp is pretty close to that.

P.S. Just as a side note, folks on #lisp and #sbcl are one of the most pragmatic and intelligent people I have ever seen, I learned more from their discussions than by reading a couple of books. To any of you reading, rock on Lispers ;)

Re: What's Special About Lisp?

#62
A Common Lisp variant of an excercise found in the Seasoned Schemer:

  (defun sum-of-prefixes (tup)
   (let ((sonssf 0))
     (loop for n in tup
           do (setf sonssf (+ sonssf n))
           collect sonssf)))
The variable 'sonssf' is an acronym for "sum of numbers seen so far;" this function creates a list of sums of all numbers it visits as it traverses the input list.

ie:

  (sum-of-prefixes '(1 1 1)) 
  => (1, 2, 3)

  (sum-of-prefixes '(1 2 3 4 5))
  => (1, 3, 6, 10, 15)
It's a simple bit of code that I go into in more detail with an example in Python and Scheme: http://agentultra.com/?p=670

The reason why I think Lisp is a great language is that I haven't yet needed to use any "patterns" in any of my (admittedly small) projects. Patterns, IMO, are boilerplate code to work around the limitations of a language. I haven't encountered a need for that in Lisp yet. It's a good sign to me.

I also have dynamically scoped variables, generic functions, parametric dispatch (or multimethods or whatever you call it), macros, and a very powerful OO system if I need it. Best of all is that all of it is unified by a small amount of syntax, backed by a small set of axioms, and surrounded by a wonderful (but small) community.

edit: Fixed the example output

Re: What's Special About Lisp?

#63
post #30

> You can fake it anywhere else with more or less work That doesn't make sense, because there's no way to twist it. It's more work and duplication. I want macros all the time in JavaScript and that is a pretty flexible and dynamic language. Most of Lisp's other features are common now. Macros are still a big one but you don't need them every day. Lisp has powerful exception handling but I'd rather have Erlang style e…

> Most of Lisp's other features are common now. Special variables, restarts and flexible reader are some of the basic features, that are not only uncommon, but, actually, unseen in any other language. Just to name a few.

Thanks, I knew I'd miss some since I'm only an amateur Lisp hacker.

Factor has a cool and flexible reader too but it's pretty far from mainstream.

Re: What's Special About Lisp?

#64
post #30

> You can fake it anywhere else with more or less work That doesn't make sense, because there's no way to twist it. It's more work and duplication. I want macros all the time in JavaScript and that is a pretty flexible and dynamic language. Most of Lisp's other features are common now. Macros are still a big one but you don't need them every day. Lisp has powerful exception handling but I'd rather have Erlang style e…

I assume when you say 'Lisp has powerful exception handling' you are referring to Common Lisp's conditions.

There's nothing inherently Lispy about conditions and restarts but they are often cited as one of "Lisp"'s strengths. Sorry for continuing to conflate Lisp the concept with CL.

Re: What's Special About Lisp?

#65
post #51

Earlier quoted context omitted.

Macros are not something you need everyday (at least not your own macros) but when you need them you really need them. CoffeScript is a good example, if JavaScript would have been a real lisp there would be no need for CoffeeScript at all because you could build it in JS. Your example of meta programming is very very messy and putting eval everywhere would also be a security nightmare and if you do it this way you do…

Firstly, CoffeeScript is built in JavaScript. Does that make it a 'real' Lisp? Secondly, Lisp macros are every bit as big a security risk as using eval... That is what the E in REPL stands for, after all. In both cases, if you are taking input from source code, and not from outside sources, there is no security risk. Thirdly, yes, my example is messy. But it is still doable, and I just have a hard time believing that…

In any language you can build a interpreter/compiler for any other language but thats not the point. The point is that you can do random AST transformation at compiletime.

You think of macros as a kind of pay of for s-exp syntax. I have to say that even without macros I would think s-exp syntax is nicer. Sure in Ruby you can do alot when you play around with that suger stuff but this stuff often doesn't come free. See this blogpost for an example of what I mean: http://briancarper.net/blog/579/keyword-arguments-ruby-cloju...

Depending on what you do you are writting a lot of macros. In lisp the interface to a library is almost always in a DSL style witch makes them easy to use. See this list here: http://stackoverflow.com/questions/3968055/are-there-any-clo.... In your own Application your maybe not going to need them that often depending on what you do.

What you discribe is just a macrosystem. Having macros in a language with syntax is duable (look at Dylan or Plot) but you will find that getting everything nice and easy to use is much harder then you think. If CoffeeScript has a macrosystem great. I don't really know CoffeeScript well enought. Could you provide me with some nice examples of how people use this in CoffeeScript?

If I where you I would just learn enought lisp that you can trie it out yourself.

Re: What's Special About Lisp?

#66
post #54

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…

I think it's more subtle than that. An interesting program usually contains parts that are "easy" (e.g. interfacing with a database) and parts that are "hard" (e.g. complex algorithms). To be productive, you would want to get the easy bits out of the way so you could concentrate on the hard bits. Making Python or Scala talk to Oracle (for example) is so trivial you can write that bit of your program in no time at all…

Your point is plain to see, and it is correct in principle, but there are plenty of bindings for Lisps too. As far as I understand, making CL talk to Oracle is a battery included in the commercial implementations, or available through CLSQL (and therefore through higher-level libraries built on top of it such as Elephant). Sure, CL may not have all of the latest and greatest, but plenty of languages don't either. While I cannot pretend to approach any sort of "hacker-level" competence in Lisp (I'm not even a programmer really), I have yet to find a relatively trivial task (where my definition of trivial is "included in Python's standard library or a very widely used / de facto standard module", since I'm coming from Python) for which there isn't a usable (and often excellent) Lisp tool. YMMV, of course.

Re: What's Special About Lisp?

#67
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…

to each his own

That was pretty much my point. That maybe the solution to the mystery of the "profound enlightenment experience" around Lisp is that it makes some very happy, but not me.

Have you looked at "The Joy of Clojure"?

I haven't, I'll look into it, thanks. I haven't given up on solving that mystery yet.

Re: What's Special About Lisp?

#68
What's special about Lisp? Simplicity. No syntax means you don't have to parse code when reading it. Each construct's scope is clear. Whenever I code for a while in Lisp and then have to go back to C or Java, I find myself uncomfortable. Not so the other way around.

Re: What's Special About Lisp?

#69

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…

While I don't use macros a ton, I do use data as code a lot, which is what the code as AST allows me to do easily.
Post reply on HN