Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Why lisp?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
104 replies to this topic

#21 HairyTroll   Members   -  Reputation: 192

Like
Likes
Like

Posted 19 February 2004 - 05:52 AM

quote:
Original post by Arild Fines
The best thing about Lisp is that all it's proponents are so humble.


You actually hit the nail on the head. This puts most newbies off Lisp completely and it's been written about quite often.

Why we hate Lisp

Smug Lisp Weenies

Social Problems of Lisp

It's just difficult discussing the merits of *any* language without coming across as "My C64 rules, your Spectrum sucks", "My Amiga rules, PeeCee sucks", "NVidia versus ATI". etc.

If you want to read a very balanced discussion on the merits of Lisp, try this Q/A session on Slashdot by Kent M Pitman. It's what got me interested in Lisp in the first place.

Kent M. Pitman Answers On Lisp And Much More

Kent M. Pitman's Second Wind

Things like being able to patch a Lisp program - while it is running - really blew me away.


[edited by - HairyTroll on February 19, 2004 1:18:10 PM]

Sponsor:

#22 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 19 February 2004 - 06:16 AM

quote:
Original post by Krippy2k
A good example of this would probably answer the original authors question, as well as mine. What would be a language extension that you could create in Lisp that you wouldnt even dream of doing in C++?
These are all pretty long to explain, so you''ll get best explanations by doing a search:
- continuations
- prolog/logic programming
- undeterministic programs
- pattern matching
- dynamic multiple dispatch (the visitor pattern can be seen as an ugly implementation of dynamic double dispatch, a limited version of multiple dispatch)
- aspect oriented paradigm (I''m not very knowledgeable of this, but from what I''ve heard it at least incorporates Design by Contract as seen in Eiffel)

These are of course just the more common things one might be interested in. The perhaps better and even more justified uses are highly task specific. E.g. you''ll start noticing unavoidable code duplication when writing GUI code using standard idioms. No worries, just extend the language to transform some compact representation of the GUI layout into code.

#23 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 19 February 2004 - 06:34 AM

quote:
Original post by Krippy2k
A recent C/C++ Users Journal showed a reasonably simple way to add lambda functions to C++.
If it''s anything like the lambda seen in Boost (like I''d reasonably assume it to be), then that''s still *far* behind from the usefulness of Lisp''s lambda. What you gonna do with lambda when you got no closure?


#24 SabreMan   Members   -  Reputation: 504

Like
Likes
Like

Posted 19 February 2004 - 12:13 PM

quote:
Original post by Arild Fines
The best thing about Lisp is that all it''s proponents are so humble.

Makes you cringe doesn''t it?


#25 Vlion   Members   -  Reputation: 151

Like
Likes
Like

Posted 21 February 2004 - 08:10 AM

Interesting.
I still don''t percieve any practical advantage Lisp has over .

I think that theres no good reason to write lisp over Prolog or .

Language theory aside- it seems to be needlessly simplified and with a minimum of constructs.

I know that is due to reasonable factors- don''t get me wrong, its a very "nice" language- but I think I''d sooner burn my time on Ruby and advanced C++ constructs and understand the procedural paradigm throughly. I''ve no beef with Lisp- it just takes way too long and too much kludging to get anywhere in terms of what I write: even if I''m doing logical types of questions.

Prolog seems to be a better "other" langauge, frankly.

*shrug*

Peace out.

~V''lion

Bugle4d


#26 Diodor   Members   -  Reputation: 517

Like
Likes
Like

Posted 21 February 2004 - 08:34 AM

quote:
Prolog seems to be a better "other" langauge, frankly.


Paul Graham has a Prolog language embedded in Lisp written in 180 lines in his "On Lisp" book. This should be the kind of example you''re looking for.

#27 Diodor   Members   -  Reputation: 517

Like
Likes
Like

Posted 21 February 2004 - 09:18 AM

Another small example of sublanguage built on Lisp: the loop construct. This is available in Lisp, but it is coded as a set of macros - as an extension language: http://www.ai.sri.com/~pkarp/loop.html



#28 Extrarius   Members   -  Reputation: 1412

Like
Likes
Like

Posted 21 February 2004 - 09:40 AM

I think a good example is the new object system created in the book ANSI Common Lisp. You might think its no big deal, since C++ has an object system too, but I think its nice that in Lisp you can make your own if you want. I don''t particularly like C++''s object system or CLOS, so if I were to ever become a serious lisp programmer one of the first things I''d probably do is make my own object system with the features I want and lacking the ones I don''t.

#29 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 21 February 2004 - 12:04 PM

quote:
Original post by Vlion
Interesting.
I still don''t percieve any practical advantage Lisp has over <good OO language>.
Sigh. The point is that you won''t find the set of features described in this thread from any other single language except Lisp. If you don''t believe those features have any practical advantage, that only shows your ignorance regarding those features. You''re like a C++ newbie who can''t yet use classes and wonders what use they have over the convenient C structs. If you''re not interested in researching a bit on the topics, nobody will be able to convince you. We''ve already presented a bunch of stuff Lisp can do that most other languages can''t, yet you keep on insisting that Lisp has no practical advantage. Is that really logical at all? I mean, what would make Lisp have a practical advantage in your eyes?

#30 Dobbs   Members   -  Reputation: 164

Like
Likes
Like

Posted 21 February 2004 - 12:05 PM

quote:
Original post by Krippy2k
Lisp lacks much of the powerful functionality provided by the STL...


Such as?

Honestly, from a quick glance at SGI''s STL site (link) I see little to nothing in the STL that isn''t either a part of Lisp or trivial to implement (and by trivial I mean a couple lines of code). The Common Lisp standard includes a LOT of useful stuff. Google for "Common Lisp Hyperspec" if you don''t know where to look.

And while I agree with you that the library of C++ code available out there dwarfs that of Lisp, in some areas that code accomplishes something that is largely unnecessary in Lisp (as a couple of examples how about scripting languages, and just about anything related to XML).

--- end of smug Lisp weenie post ---

Disclaimer: I''m not a zealot but I do like Lisp. It just strikes me that your assertion about Lisp and the STL is just plain wrong and probably coming from ignorance.

#31 Diodor   Members   -  Reputation: 517

Like
Likes
Like

Posted 21 February 2004 - 04:20 PM

Memoizing: http://www.bookshelf.jp/texi/onlisp/onlisp_9.html#SEC43

#32 Vlion   Members   -  Reputation: 151

Like
Likes
Like

Posted 21 February 2004 - 05:17 PM

Oooh, look, a loop construct in lisp. How underused but useful.
Excuse me?
This is called elementary procedural programming. This is what you learn in week three of CS101. I''m sorry, but I laugh.

The caching/memoizing construct is interesting- on thought it wouldn''t be difficuly to write some c++ construct to do it. Would have been nice to see the implementation though.

What would make lisp a notably practical language is to present a topic which would require not only pages and pages of backend c++ code, but pages and pages of frontend code; which both could be neatly concatenated and/or made much clearer using lisp.

The prolog application sounds interesting and a good application.

AP: I did do some study and learning. I spent 4-6 weeks trying to work out a concept in lisp. I''m asking this question based on my experience in lisp.

I would submit that string work is non-intuitive in lisp, as I worked somewhat with strings in my code and found the mechanisms difficult to work with clearly.

~V''lion

Bugle4d


#33 Extrarius   Members   -  Reputation: 1412

Like
Likes
Like

Posted 21 February 2004 - 06:21 PM

quote:
Original post by Vlion
Oooh, look, a loop construct in lisp. How underused but useful.
Excuse me?
This is called elementary procedural programming. This is what you learn in week three of CS101. I'm sorry, but I laugh.[...]
Have you looked at the lisp loop construct? Its probably the most complex 'basic' construct you'll find in any language. It is NOT just the basic-style loop/endloop/exitwhen. It can be virtually any kind of loop and can automatically do lots of complex things. It is so complex, in fact, that many lisp books don't cover it. It could be a pair of books itself if somebody felt like explaining both the implementation and usage.

The implementation of memoize can be found on page 65 of the freely download book 'On Lisp' and is as follows:
(defun memoize (fn)
(let ((cache (make-hash-table :test #’equal)))
#’(lambda (&rest args)
(multiple-value-bind (val win) (gethash args cache)
(if win
val
(setf (gethash args cache)
(apply fn args)))))))


[edited by - extrarius on February 22, 2004 1:25:09 AM]

#34 Diodor   Members   -  Reputation: 517

Like
Likes
Like

Posted 21 February 2004 - 08:09 PM

quote:
Original post by Vlion
Oooh, look, a loop construct in lisp. How underused but useful.
Excuse me?
This is called elementary procedural programming. This is what you learn in week three of CS101. I'm sorry, but I laugh.


The point about the loop construct wasn't (just) that it is more powerful than similar looping constructs in other languages, but that it was _added_ [EDIT:] on top of the[:EDIT] Lisp language. If it wasn't there, you could have added it yourself. Now _that_ is something you can't do in that many languages.

quote:

The caching/memoizing construct is interesting- on thought it wouldn't be difficuly to write some c++ construct to do it. Would have been nice to see the implementation though.


The implementation was on the page I linked to, though slightly above. What would be a C++ equivalent of this?

quote:

AP: I did do some study and learning. I spent 4-6 weeks trying to work out a concept in lisp. I'm asking this question based on my experience in lisp.

I would Submit that string work is non-intuitive in lisp, as I worked somewhat with strings in my code and found the mechanisms difficult to work with clearly.



This is the exact same experience I've had with Lisp. It's very obvious that there are very many things to love about Lisp (dynamic types, first class functions, lambda functions, symbols, the interactive way of coding - with instant access to compiler, debugger and execution at the same time, mapping functions, lists, macros) and it's very easy to find things that wow me away (On Lisp is full of such examples), but when the time came for me to actually do something in Lisp, it was all very complicated and clunky, and all the functions I need seemed to be missing. Things will get better with practice (lots of it), Lisp isn't a side language you learn fast and use right away, but you should be able to see that there's more to Lisp than lots of paranthesis.


[edited by - Diodor on February 22, 2004 5:28:49 AM]

#35 Predictor   Members   -  Reputation: 198

Like
Likes
Like

Posted 21 February 2004 - 11:55 PM

quote:
Original post by Anonymous Poster
The point is that you won't find the set of features described in this thread from any other single language except Lisp.


I'm not sure I see the practical value of this. The vast majority of programming effort is spent on well-studied problems. Why not use more than one language? The reason that there is a SQL language is that a powerful need was perceived for dealing with relational data structures. SQL provides an effective and efficient set of tools for dealing with this problem. While SQL is a poor choice for other types of work, like statistical analysis or intricate text manipulation, there are other tools which excel at those functions, like MATLAB and Perl.

The above quoted quality seems better suited to the question, "If you were stuck on a desert island and could only take one programming language, and didn't know ahead of time what sort of develepment challenges would present themselves, what would you take?", than it is to the question, "Which language or languages best suit this problem, in this particular context". (Incidentally, I suspect assembly language and Forth programmers would have brought their favorites to the island!)

-Predictor
http://will.dwinnell.com





[edited by - Predictor on February 22, 2004 9:58:34 AM]

#36 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 22 February 2004 - 12:33 AM

Side question: how does Lisp compare to Haskell ("a purely function language with modadic IO", www.haskell.org)? I''ve only used Haskell and I like it very much. And what is the benefit of Haskell (functional programming) over imperative programming? Added abstraction: higher order functions, partial parametrisation, (in case of Haskell) lazy evaluation, et cetera. Even just being able to write ''map'' and ''fold''.
I had a class on functional programming. It greatly improved my thinking. I still write games is C++; you would have a hard time to do it in Haskell I suppose. But for lab assignments Haskell is great and it is great fun trying to write as elegant code as possible.
Nowadays, I recognize ''map'' and ''fold'' everywhere when programming. In Haskell, I hardly ever write explicit recursion: I recognise the higher-abstraction concept I''m applying and state that instead.
If you study CS, by all means pick up a course on functional programming. It''s great :D.

Thamas

#37 Extrarius   Members   -  Reputation: 1412

Like
Likes
Like

Posted 22 February 2004 - 04:30 AM

quote:
Original post by Predictor
[...]
Well, Lisp isn''t best for all problems, but it a nice, clean language and for trying new things its fun. If all you want to do is write yet another database interface, by all means feel free to use VB or Borland Builder or some other RAD tool. I, personally, prefer doing things I haven''t done before, and for a lot of those kinds of projects, Lisp is a good language. That may just be because of the kinds of things I haven''t done yet (I have spent several years programming random things in C and now C++, so I have more places to expand in other types of language). As everybody has pointed out over and over, because it lacks libraries or premade interfaces to them it isn''t the perfect language, but it is pretty good. The ANSI standard could definitely use an overhaul, and I''d very much like to see it get one.

AP: I''ve not looked into Haskell much, but one thing that makes Lisp very different is that Lisp is not a ''pure functional'' language. It can be used as one, but the ability to redefine variables and things like that makes it a nice halfway point between imperitive and functional. Also, I seem to remeber that Haskell didn''t benchmark too well. I''ve only seen a few benchmarks with Common Lisp in them, but in all of them it seemed to compete very well. It isn''t quite as fast as C++ of course, but close enough for most of the people that visit this site. As you have said, the more you learn such a language you learn to see where the ''callback constructs''(map, etc) come in handy and can use them instead of explicit iteration or recursion.

#38 Diodor   Members   -  Reputation: 517

Like
Likes
Like

Posted 22 February 2004 - 04:54 AM

quote:
Original post by Extrarius
Have you looked at the lisp loop construct? Its probably the most complex 'basic' construct you'll find in any language. It is NOT just the basic-style loop/endloop/exitwhen. It can be virtually any kind of loop and can automatically do lots of complex things. It is so complex, in fact, that many lisp books don't cover it. It could be a pair of books itself if somebody felt like explaining both the implementation and usage


This makes me curious: is there more to loop than the tutorial I've linked to shows? ( http://www.ai.sri.com/~pkarp/loop.html )

quote:
As everybody has pointed out over and over, because it lacks libraries or premade interfaces to them it isn't the perfect language, but it is pretty good.


It should still be possible to use the libraries of other languages. I got to combine C and Lisp by loading a DLL, and made a graphical tic-tac-toe game (SDL + my user interface in C; AI & logic in Lisp), but I wasn't very happy with the solution as it made debugging somewhat difficult (and the Lisp executable was rather big too at 1.3MB).

[edited by - Diodor on February 22, 2004 11:55:20 AM]

#39 Diodor   Members   -  Reputation: 517

Like
Likes
Like

Posted 22 February 2004 - 05:04 AM

quote:
Original post by Predictor
Why not use more than one language?


Which is the very point of Lisp - it makes it easy to use more languages for a single project - without the interfacing and maintainance problems. With Lisp you get many languages working together on the same data, and you have access to all of them at the same time using the same debugger.

[edited by - Diodor on February 22, 2004 12:08:02 PM]

#40 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 22 February 2004 - 06:40 AM

quote:
Original post by Predictor
Why not use more than one language?
It won''t suffice, not by far. When writing a single function, I might find it handy to use pattern matching, continuations and dynamic closure. You might be able to find many languages with the features you want but you wouldn''t be able to interoperate between several languages so easily. If you have to change language after every few lines, you''d be writing more interfacing code than normal code. In fact, it''d be so hard that one would in most cases settle for a sub-par solution within a single language. The jumping between several unrelated languages becomes unbearable or practically impossible, if you really want to use many different features from several languages.

And those languages, even when combined, still wouldn''t be able to give me all the features I can do with macros. There are lots of uses for macros that extend the language in such a way one would never expect to see in some "pre-written" language, because those features would be so highly dependent on a single problem field, or even just your particular application.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS