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.

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?

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.

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.

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?

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.

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.

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:

quote:Original post by VlionOooh, 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.

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!)

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.

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.

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

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).

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.

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.