Skip to main content
GameDev.net gamedev.net
🔒 Locked

What is so great about Lisp?

Started by Extrarius Feb 3, 2003 at 2:50 PM 136 replies 22k views
Original Post
Extrarius
Extrarius
I've been programming in C/C++ for a while, and I've noticed some limitations of the language as have many of the other members of this board. Many of those posters seem to worship Lisp as the perfect language, so I decided to check out some of the links and read some tutorials etc to figure out what is so great about Lisp. I haven't noticed anything special about Lisp to set it above the other languages. The syntax seems to be defined to be easy to parse (in fact, the syntax appears to be a text representation of a parse tree), but other than that it doesn't seem to be too different from any of the other several languages I've used. Could somebody explain what makes Lisp so great? Edit: Links that are somehow Lisp-related: http://www.paulgraham.com/diff.html http://www.lisp.org/ http://store4.yimg.com/I/demotivators_1715_12018556 http://www.booksamillion.com/ncom/books?id=2443270818794&pid=0201083191 http://www.lisp.org/table/references.htm#ansi http://cl-sdl.sourceforge.net/ http://www.franz.com/success/customer_apps/animation_graphics/ http://franz.com http://lispworks.com http://clisp.cons.org http://www.gnu.org/software/gcl/ http://www.franz.com/success/customer_apps/animation_graphics/naughtydog.lhtml http://www.strout.net/python/pythonvslisp.html http://www.franz.com/support/documentation/6.0/examples/dll/dll.htm http://www-2.cs.cmu.edu/~dst/LispBook/ http://www.franz.com/resources/educational_resources/cooper.book.pdf http://www.lisp.org/table/performance.htm http://world.std.com/~pitman/PS/Hindsight.html http://www.lisp.org/table/syntax.htm http://www.fun-o.com/products/fundev.phtml [edited by - Extrarius on February 22, 2003 12:26:59 AM]
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
davepermen
davepermen
nothing, but sabreman will for sure come in and fill in a big list.

i don''t like all the fuzz about it. too much overhead it has for me. all possible in runtime means all running in runtime as well.. (sure you can precompile.. but types undefined will often lead to type detection at runtime, something really useless, at least in gamedev)

and the other features don''t sound very useful to me, too.. for scripting stuff, yes. but it sounds really slow to me.

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia
My Page davepermen.net | My Music on Bandcamp and on Soundcloud
daerid
daerid
I''d benchmark it before you make any claims that it''s slow.
I haven''t done it myself, but seems like you''re falling victim to a little bit of premature optimization.
daerid@gmail.com
davepermen
davepermen
any useful realworld applications in lisp, including sourcecode, providing proof its useful for real programming, and not scripting?

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia
My Page davepermen.net | My Music on Bandcamp and on Soundcloud
civguy
civguy
quote:
Original post by Anonymous Poster
You''d never do that in real life unelss you wanted to piss someone off.
True, but I don''t think it''s so good that Lisp forces you to write code that''ll piss someone off . I don''t think LOC is a very valid meter anyway. "Explicity" and "Saying things only once" are things I like, but they''re pretty impossible to measure and LOC is just somewhat related to them. If I want my code in a tight packet, I use ZIP.

It''s true that Lisp has some good features compared to the C league of languages. But if I want to use those features, I''ll use Python that has all (?) the good stuff AND a readable syntax. I don''t know if it lacks something important compared to Lisp though.
dede
dede
/personal experiance, your millage may vary

I like to compare LISP to PHP, its easy, its fast, and its very very powerful, BUT it also becomes unmaintanable faster than other languages.(unless you are a good programmer(tm))

The entire language is redefinable at run time, so you can use Classic Algebra for half of the program, then redefine ADD, and use Alternative Algebra instead. OR heck, you can add a bunch of numbers, and then redefine ADD to MULT, and then multiply the same numbers with 1 line of code...

That is its power, That and pattern matching.

davepermen
quote:

any useful realworld applications in lisp, including sourcecode, providing proof its useful for real programming, and not scripting?



Emacs, my non-*nix friend...



[edited by - dede on February 3, 2003 6:41:09 PM]
SabreMan
SabreMan
quote:
Original post by Extrarius
I haven't noticed anything special about Lisp to set it above the other languages.

What made Lisp different? The best way to answer your question, of course, is to do your own investigations.
quote:

The syntax seems to be defined to be easy to parse

The syntax is defined based loosely on mathematical concepts, centering around the symbolic expression (s-expression). It just so happens to be easy to parse because...
quote:

[...](in fact, the syntax appears to be a text representation of a parse tree)

Right. Which means that you get to grow your own semantics around that representation, if you so desire.
quote:
Original post by davepermen
nothing, but sabreman will for sure come in and fill in a big list.

Your campaign against me is getting predictable aswell as boring. Do change the record.
quote:

i don't like all the fuzz about it.

That's because you don't understand it, and thus feel threatened by it. Why don't you admit it: you're a teenager with no experience of building large systems, and zip experience of Lisp.
quote:

too much overhead it has for me.

Let's see your benchmarks.
quote:

all possible in runtime means all running in runtime as well..

That's a serious logic failure. *Possible* at runtime does not mean it *must* happen at runtime. Let's get this straight: Lisp is a compiled language, and happens to have some interpreters. Just like C.
quote:

(sure you can precompile.. but types undefined will often lead to type detection at runtime, something really useless, at least in gamedev)

It's not useless, unless you happen to think flexibility and expressivity are useless concepts. Note carefully, Lisp allows you to introduce type declarations to optimise code, if that's what you want to do. But, I've told you that before.
quote:
Original post by Anonymous Poster
Lots of Irritating Single Parentheses

Lots of Irritating Superfluous Parentheses. Get it right!
quote:
Original post by Anonymous Poster
Lisp is primarily functional and dynamically typed whereas C++ is primarily imperative with OO extensions and has a relatively strong type system (well... sort of).

Lisp has an excellent OO model, CLOS. It makes far more sense than C++'s OO model, and this has been discussed in other threads. As for the type system, what does the "relatively" refer to? C++ is commonly regarded as having a fairly weak type-system due to all the escape hatches, although it is stricter than C. Lisp has a strong type-system.
quote:
Original post by civguy
[...]if I want to use those features, I'll use Python that has all (?) the good stuff AND a readable syntax.

I thought we'd resolved this recurring criticism about Lisp's syntax. Lisp allows you to evolve your own syntax if that's what you want. Most Lispers don't do that, though, as it's kinda silly. Still, it's good enough to kill the criticism.
quote:

I don't know if it lacks something important compared to Lisp though.

Sure. It lacks uniformity of code and data, and a good macro system. It also lacks the ability to introduce type information, or the ability to specify safety vs. speed trade-offs. It also lacks multimethods.
quote:

any useful realworld applications in lisp, including sourcecode, providing proof its useful for real programming, and not scripting?

The Other Road Ahead, The K2 System and Franz success stories.


[edited by - SabreMan on February 3, 2003 7:05:03 PM]
SabreMan
SabreMan
quote:
Original post by dede
I like to compare LISP to PHP

Let''s kill this one now: LISP is an archaic programming language. The correct spelling for the modern language is "Lisp".
quote:

its easy, its fast, and its very very powerful, BUT it also becomes unmaintanable faster than other languages.(unless you are a good programmer(tm))

I was going to rebut this statement, but then I noticed the extra clause, and it represents a point I happen to agree with. Since Lisp does not put much in the way of programmer expressivity, it is good at revealing the underlying ability. When trying Lisp, bad programmers fail badly, and retreat off to other languages where they can concentrate on the minutiae of broken language features.
quote:

The entire language is redefinable at run time, so you can use Classic Algebra for half of the program, then redefine ADD, and use Alternative Algebra instead. OR heck, you can add a bunch of numbers, and then redefine ADD to MULT, and then multiply the same numbers with 1 line of code...

It is possible to be idiotic with any language.
Extrarius
Extrarius
I don''t see much of a difference between functional programming and imperative programming. Anybody want to clear that up for me?

From that list of what made(past tense) Lisp different, only a few of the items are different from other currently popular languages: A first-class function type, all variables being effectively pointers, no ''statements'', and the whole language always available. I can understand how those things make a difference, but not how they make a big difference. Anybody want to explain?
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
civguy
civguy
quote:
Original post by SabreMan
I thought we''d resolved this recurring criticism about Lisp''s syntax. Lisp allows you to evolve your own syntax if that''s what you want. Most Lispers don''t do that, though, as it''s kinda silly. Still, it''s good enough to kill the criticism.

Not really. If I started writing Lisp with a syntax like

  
(a = b + 2)
(if (a == 5) (
(b += 2)
(a = (5 + b) / 2)
))

...the Lisp fanatics would lynch me (I don''t know if syntax manipulation like that is possible though, just basing it on what I''ve heard here). I''ll much rather pick a language in which everyone writes in a readable manner.
SabreMan
SabreMan
quote:
Original post by civguy
If I started writing Lisp with a syntax like
[...]
...the Lisp fanatics would lynch me

Right.
quote:

I'll much rather pick a language in which everyone writes in a readable manner.

It's ridiculous to claim that Lisp is unreadable. Every language looks unreadable when you are unfamiliar with it (which I'm assuming is your current position). Most languages give you the ability to write obfuscated code, but that's not a valid complaint. The question is whether it lets you write concise and clear code. The important point is that languages which are easy for compilers to parse are easy for humans to parse too. Lisp is easy to parse, C++ is hard. C++ makes some very simple problems incredibly hard, both to write and to read. A recent example on these forums was the factory pattern, which can be implemented in a single line of Lisp. Whichever way you look at it, a single line of code is going to be more readable than the dozens it takes to write a C++ equivalent. The same argument extrapolates to many other scenarios.

If your complaint is really "I refuse to like Lisp", then please tell me so that I know I don't need to waste my time.

[edited by - SabreMan on February 4, 2003 5:38:29 AM]
Crazy_Vasey
Crazy_Vasey
I tried Lisp once but I couldn''t figure it out. I couldn''t find any free compilers like GCC for C++ and the syntax was kinda confusing for someone who doesn''t have much experience outside C++ and Java. If you have any hints for getting started with lisp I''d appreciate it, sounds like an interesting language.
HenryApe
HenryApe
Emacs is probably the best known example of a real world application written in Lisp.

quote:
Since Lisp does not put much in the way of programmer expressivity, it is good at revealing the underlying ability. When trying Lisp, bad programmers fail badly, and retreat off to other languages where they can concentrate on the minutiae of broken language features.

I bet that the market does not seem to understand this ''fact'' has made all the ''good'' Lisp programmers just as frustrated as the Linux junkies who think Linux should be the ruling desktop OS because it''s so good at driving off the ''idiots'' who care about usability and think the technology should help them solve their problems instead of the other way around.
MadKeithV
MadKeithV
Google for lisp:
Lisp.org , which also includes a list of Free implementations.


I think I'll tackle learning a bit of Lisp right after I manage to get Python to work with the OpenGL extensions I want it to support *grr*.


[edited by - MadKeithV on February 4, 2003 7:14:11 AM]
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
SabreMan
SabreMan
quote:
Original post by HenryApe
Emacs is probably the best known example of a real world application written in Lisp.

Some of the examples on Franz''s website are probably of more interest around here.
quote:

I bet that the market does not seem to understand this ''fact'' has made all the ''good'' Lisp programmers just as frustrated as the Linux junkies who think Linux should be the ruling desktop OS because it''s so good at driving off the ''idiots'' who care about usability and think the technology should help them solve their problems instead of the other way around.


This is a false analogy. I''m not saying that Lisp makes problems hard. Quite the opposite. What I''m saying is that there are a subclass of programmer who, given freedom of expression, actually have problems saying anything. IOW, when you can say whatever you want, it becomes apparent that some people have nothing to say.
civguy
civguy
quote:
Original post by SabreMan
It's ridiculous to claim that Lisp is unreadable.
Why? It's not universal truth but it does hold for every Lisp/Scheme-knowing person I've met yet. One of my friends chose Scheme as his first programming language but also agrees that Java and C++ are a lot easier to read.
quote:
Every language looks unreadable when you are unfamiliar with it (which I'm assuming is your current position).
Maybe, but most of them won't stay unreadable.
quote:
The important point is that languages which are easy for compilers to parse are easy for humans to parse too.
You sure about the validity of that point? BrainFuck and assembler are also easy for compilers to parse, but large programs written with them are pain for humans. Don't tell me it's also ridiculous to claim BrainFuck to be unreadable.. Well, following your reasoning, "All it takes is a little time to get accustomed to it", right?
quote:
If your complaint is really "I refuse to like Lisp", then please tell me so that I know I don't need to waste my time.
Actually, I like lisp quite a lot (well, to be precise, I don't know lisp but only scheme. They shouldn't differ too much AFAIK). What I don't like is reading code written in it. But writing it is fun. The same kind of relation I have with Java/C++. I like writing C++ a lot more but I prefer reading Java.

[edited by - civguy on February 4, 2003 11:11:34 AM]
dede
dede
Maybe I should answer the question that I Think you are asking, rather than the question that you wrote.

As a programmer, you should learn at least two langauges with very different syntaxes. (i.e. C, Java, & Pascal together don''t count). The axiom that you should live is "To someone with a hammer, all problems are nails". Even if you never use LISP, learning how to problem solve in LISP as well as a popular language, will help your problem solving ability, whenever you run into a problem that requires a more "LISP" like solution, rather than a more C++ style solution.

Sabreman
Right now, I''m going to follow LISP: An Introduction to the Language and its Applications conventions as my LISP vs Lisp capitalization.

I''ll ask my LISP friend on Thursday, and if agrees with you, I''ll reference it as Lisp after that time.
SabreMan
SabreMan
quote:
Original post by SabreMan
It''s ridiculous to claim that Lisp is unreadable.
quote:
Original post by civguy
Why?

Readability of Lisp programs is largely dictated by the ability of the person who wrote the program to create good abstractions. It''s the same idea in most languages, only each language varies in the mechanisms it provides for creating abstractions. Lisp allows the programmer to evolve their own "mini-languages" specific to the problem domain they are working in, and thus it is the quality of the mini-language which dictates how readable the code is. Many people coming from a block-structured language completely fall at the first hurdle of Lisp: the lack of syntax means that *you* are responsible for what you write.
quote:

You sure about the validity of that point? BrainFuck and assembler are also easy for compilers to parse, but large programs written with them are pain for humans.

That''s because neither of those languages provide good mechanisms for abstracting details, and thus force you to concentrate on irrelevancies. Lisp provides for incredibly powerful abstractions.
quote:

Don''t tell me it''s also ridiculous to claim BrainFuck to be unreadable..

BrainFuck is a joke language, please don''t use it for making a serious point. I''ll take assembly instead. Assembly *is* quite easy to read on a micro level. What''s not easy is reconstituting the big picture from the micro level details, which is what we need to know to understand what is going on at a macro level. If you don''t have abstraction mechanisms, you have to stay at the micro level all the time. *That''s* what makes assembly programs hard to understand.
SabreMan
SabreMan
quote:
Original post by dede
Right now, I''m going to follow LISP: An Introduction to the Language and its Applications conventions as my LISP vs Lisp capitalization.

I don''t know of that resource, but you should take the convention from the source which defines the language, which is the ANSI Standard.
quote:

I''ll ask my LISP friend on Thursday, and if agrees with you, I''ll reference it as Lisp after that time.

Your friend''s opinion on whether the Lisp Standard is correct on what it decides to call itself is kinda irrelevant, dontcha think?
HenryApe
HenryApe
quote:
What I''m saying is that there are a subclass of programmer who, given freedom of expression, actually have problems saying anything. IOW, when you can say whatever you want, it becomes apparent that some people have nothing to say.

Funny how the the world has ended up in the opposite situation where other programming languages are used for most real-world applications while Lisp is most commonly encountered in academic settings where the language is studied for for the sake of itself.

Personally I have only encountered a Lisp dialect in my first CS course at the university in the form of Scheme, but I hear that dialect is related to Algol too so maybe it misses some crucial element that you think makes Lisp so good.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.