Live data from Hacker News

What's Special About Lisp?

kresimirbojcic.com

51–60 of 69 posts

Re: What's Special About Lisp?

#51

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…

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 don't end up with nice syntax. Macros are not messy to use they look like a normal function that meens often you don't even know or care if something is implmented in a macro or a function.

The other big part of the macros look like language build ins for example in a REST-Framework you would have something like 'defresource'. The auther of the framework can give you the best syntax to discribe what his library does. (Look on Stackoverflow for DSLs in Clojure)

Writting good macros your self is a little harder and can look wired because your just not used to code looking like this.

The USE of macros is a REALLY REALLY big part of every lisp programm because the HOLE language is build on macros. Almost everything that is normally build in the compiler is just a macro.

Re: What's Special About Lisp?

#52
post #16

I hate to just insert a link into a comment, but this article is a much better response than anything I could come up with: http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-a...

That article is bullshit:

Ruby is a denser functional language than LISP. This is just not true! Sure sometimes you have syntax suger in Ruby that makes something smaller but othertimes you don't in lisp I can always make everything smaller with macros. I would bet that Ruby is not shorter for most programmes.

His hole argument is based around that in lisp you have wo write (lambda ....) and in Ruby you don't.

Ruby gives you about 80% of what you want from macros Ruby may give you some of the power but there is a lot you cant do in ruby and its much, much harder to do those things.

Ruby’s libraries, community, and momentum are good Thats nice but has nothing to do with being lisp.

Not saying anthing against ruby but this article is just very strange.

Re: What's Special About Lisp?

#53
post #18

Earlier quoted context omitted.

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

I think I'm pretty safe saying there are a ton . Every Lisp hacker has their own. Actually, "library" is probably the wrong word for reused Lisp code. A library is a public thing, an institution---and all that goes with it: slow to change, must be easy to understand, etc. Instead of libraries, Lisp hackers have private collections . Like a messy desk, they are often supremely useful once you get the hang of it, but a…

I don't know where you're coming up with this impression at all. Clojure has Leiningen and Maven, Racket has PLaneT, CL has QuickLisp, etc. In my experience Lispers do not waste time solving solved problems.

Certainly Github does not in anyway support your claim: https://github.com/languages/Clojure

Re: What's Special About Lisp?

#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, then get onto the interesting stuff. In Lisp, you have to spend significant time on this trivial stuff. So if you are writing a program on your own PC for your own use, then Lisp is fine. If you are programming anything that is going to run on existing infrastructure or interoperate with other programs, it's very difficult to justify the additional effort of using Lisp.

And I know a bit about this: I wrote Oracle bindings for OCaml! It was fun, sure, but can I justify it when there are already Python bindings? Hmm.

Re: What's Special About Lisp?

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

> In Lisp, you have to spend significant time on this trivial stuff. So if you are writing a program on your own PC for your own use, then Lisp is fine. If you are programming anything that is going to run on existing infrastructure or interoperate with other programs, it's very difficult to justify the additional effort of using Lisp.

Remember: Lisp is a family, not a language.

The best counterexample to your claim is: http://clojure.org/

I'd argue even CL covers a lot vs your claim (but please don't make it my arguement, focus on Clojure) with QuickLisp: http://www.quicklisp.org/beta/

Re: What's Special About Lisp?

#56
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?

I don't believe this is a good example. Ruby has case..when instead of COND, though it's a language construct, not a function; but I think COND can be trivially implemented in any language that has anonymous functions. In Ruby:

  def COND(*args)
      args.each_slice(2){ |s| return s[1].call if s[0].call }
  end

  COND(lambda{ false }, lambda{ "not this"}, lambda{ true }, lambda{ "this" })
(not a lisper, though, so I might be missing something).

Re: What's Special About Lisp?

#57
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.

Re: What's Special About Lisp?

#58
post #51

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…

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 this kind of programming is a major percentage of the code of a Lisp program. To be clear on that comment, I can easily believe that you end up invoking macros a lot, but I don't believe that a large percentage of the code written for a project is actually macros. What percentage of code in a typical project is macros? And how many of those macros can be easily reproduced by using specialised syntax of a language such as ruby (optional parantheses, blocks, re-opening classes, method_missing, etc)?

This is an important point, because if you only have a few hundred lines of this stuff in a typical Lisp program, and it can be reproduced by using a parser in another (dynamic) language, then the advantage just isn't that big. For argument's sake, imagine having a module available in Javascript that provides the Jison parser along with the Javascript grammar, which just re-emits the original Javascript source. In addition, it has a nice API to allow you to modify the grammar (adding / modifying rules). So far so easy, this stuff already exists in CoffeeScript, go copy it from there. Now, having loaded such a module, is Lisp really in a much better position than this modified Javascript?

Re: What's Special About Lisp?

#59

Earlier quoted context omitted.

I think I'm pretty safe saying there are a ton . Every Lisp hacker has their own. Actually, "library" is probably the wrong word for reused Lisp code. A library is a public thing, an institution---and all that goes with it: slow to change, must be easy to understand, etc. Instead of libraries, Lisp hackers have private collections . Like a messy desk, they are often supremely useful once you get the hang of it, but a…

I don't know where you're coming up with this impression at all. Clojure has Leiningen and Maven, Racket has PLaneT, CL has QuickLisp, etc. In my experience Lispers do not waste time solving solved problems. Certainly Github does not in anyway support your claim: https://github.com/languages/Clojure

[deleted]

Re: What's Special About Lisp?

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

"... but instead are able to write code that modifies code and generates code as easily as if you were writing the original code in the first place: the comparison to Ruby is therefore fundamentally flawed."

This. The ability to easily reason about the code and manipulate it because its syntax is simple and predictable is the big deal to me.

I think this is analog to switching from Roman to Arabic numerals. The syntax is regular. No matter how big the number is the rules are the same. There are no exceptions. Hence doing calculations with the former is a lot clumsier than with the latter.

That's the ideal scenario at least. I do realize that math might not be as simple as it could be, but I'm not really qualified to argue about that. But what if we were still using Roman numerals today? Would we be at the level of understanding we are at right now? It seems to me that it's more or less the same thing when you start understanding Lisp and why it is the way it is.

This is just too big of a tradeoff to be ignored. In my experience choosing the simple and regular solutions paves the way to progress, in which useful things that look trivial now would be rightly discarded or would be viewed as too complex if our mental model were grounded on the previous clumsy framework.

Now, I'm not saying "just drop all your clumsy languages right now, because today we have a better idea, and start using Lisp". I certainly don't do that. I don't even work with Lisp. But my point is that not realizing that Lisp has some properties that make it special is perhaps hindering yourself of being able to see that some things can be a lot simpler than you thought they could be.

Post reply on HN