For example, C++ is great for 3D development and robotics, but not well suited for quick and dirty scripts the way perl is.
There are many languages that leave me relatively puzzled as to what I'd want to use them for. And therefore I'm never exactly sure if the language I'm learning is the best one for me, or the situation. So I was curious if anybody had extensive knowledge of a language and would be able to describe its specialties, or pros and cons.
I'd also like to specifically request lisp and its variants, as it is seldom mentioned (is it going the way of Fortran?)
Lisp really shines when you want to build your application around a particular model of computation. For example, a theorem prover or rete network for an expert system type application, or a set of functions bound to paths for a web application where you want to view requests as remote procedure calls. Cases where the abstractions you want are very different than the abstractions provided can be really inconvenient (look at Drools), but so are cases where you get the abstraction you really want, but can only use that abstraction (look at any nontrivial file manipulation in Prolog, or if you're really masochistic, Prolog GUI applications). You can build the abstractions you want and use them conveniently in Lisp, and you still have the general purpose language to fall back on for glue.
Since most programs that get talked about are either business or graphics applications, easily implemented as conventional imperative-and-OO programs, or web applications where you want to think of requests as a request for a document, applications where Lisp is obviously the right thing don't get much attention. It's a niche tool, but not one that's likely to die out anytime soon.
Of course, you can and many of us do write programs you could just as well write in C or Python in Lisp, and if everyone involved knows Lisp and likes Lisp (particularly, when "everyone" is just you), then Lisp is also the right thing there. There's no real technical disadvantage, other than maybe not being able to easily find the libraries you want, but then it's just an arbitrary choice and "my coworkers don't know Lisp"/"the python standard library contains a bunch of boring things I don't want to write myself" are good reasons to pick something else.
I fell in love with Lisp at University, but I've not really used it since. It was a wonderful affair; it messed up my head for a while, but it made me a better programmer and gave me a lasting respect for the power of Lisp.
I had a data structures class, and an instructor I didn't respect. She said we could use any language, so I learned Lisp and used it for all my assignments, because I didn't want her to be able to criticise me. I was kind of a dick back then; still am in some ways.
I remember the final project was something implementing red-black trees and doing the rotations and balancing of them. My program was less than two hundred lines long, and a thing of beauty (I'd figured out Lisp pretty well by then). All the other implementations were several thousands of lines of much clumsier code.
I've been hoping for a discussion on this but with human languages. Which languages seem preferable for communicating certain ideas? Sorry to derail.
Make a new discussion about it. I'd definitely want to read all about it!
JackTheBandit seems busy, 8bit. Could you start this discussion. You have "words to say." I'd like to hear them. humanodon, you're multilingual, right? so you might have words as well. Which [human] languages seem preferable for communicating certain ideas?
In a recent discussion with wasoxygen, I mentioned that my multilingual grandfather used Polish for swearing - specifically if he was beating someone in chess, he'd call them a donkey in Polish. I wish I could have asked him this queson. -- but to "communicate" you pretty much have to speak in a language the person in front of you will understand. Multilingual authors might have much to say on a preferred language.
I am, though I wouldn't say I speak anything other than English fluently. I can get by fairly well in a few languages though. Certainly well enough to buy things (like beer!) and flirt with locals. As for higher concepts, perhaps there are particular grammars or vocabularies that express certain concepts more clearly than in another system, but that would be hard to compare and quantify. As for the thing with your grandfather swearing, was he Polish? I ask because linguists have long observed that people tend to curse in their L2 (their acquired language/languages) even if they don't in their L1 (mother tongue).
You have to backslash escape your C++ i.e. C\+\+
Which of course for me when I wrote that I had to also backslash escape my backslashes which looked like C\\\+\\\+
Oh man I love the current syntax I have it committed to memory. -Strike Through- Hyperlink boldBlock Quote
Since you asked about Lisp: Clojure is a modern and currently popular form of Lisp. This talk by its inventor, Rich Hickey, gives a clear and entertaining overview of some of the language's strengths from a high level (more philosophical than technical): http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey Just to mention one strength of Clojure: like other functional languages (e.g. Haskell, Erlang), it steers you towards building your program out of functions that don't have side effects. This could become increasingly important as the number of processing cores in our computers increases, since to take better advantage of the hardware you need to be able to process data in parallel. If your functions don't have side effects parallelism becomes more manageable. Other strengths of Clojure include: a regular and predictable syntax, efficient immutable data structures (see the talk) and easy interop with Java libraries (since it runs on the Java VM).
In my opinion, Clojure could be the perfect modern Lisp if it WASN'T so tied to the JVM. See http://lisp-univ-etc.blogspot.com/2011/11/clojure-complexity.html and http://www.loper-os.org/?p=42. I'm not saying that cool stuff can't be done in Clojure, but it only appears to be the modern Lisp it wants to be.
Want to see something clever? Here's a live demonstration of Clojurescript using the new CSP library in Clojure.I'd also like to specifically request lisp and its variants
is it going the way of Fortran?
Common Lisp is probably seeing decline, but the Clojure dialect is relatively new and trending. Between Clojure and Clojurescript, you can write your web front- and back-end in a single functional language. Plus running on the JVM makes it highly portable.
C, when you need to be close to the hardware. Embedded work (it's what I do). It's often the only thing available at that level, since damn-near no one uses assembly any more (C has killed assembly).
C may make assembly less useful on x86 architectures, but for different custom architectures (like the one I work with, I also do embedded systems), compilers aren't quite so advanced. Assembly can still provide very significant optimisations in those cases.
Good point. I try to use inline assembler for cases like that, if possible. Often you can make a very efficient semaphore with the proper assembler instruction.
To be just a little pedantic, C hasn't necessarily killed Assembly as much the necessity of knowing it to program at the low level. In short, C compilers have become efficient enough to negate the need to write in Assembly directly due to, at the very least, being much more human readable, though not in every case (i.e. certain optimizations).
You're just explaining how C has killed assembly! Of course it still exists; it must (for C compiler writers if for no one else). But a micro with no C support is a non-starter today. That wasn't always so.
>I'd also like to specifically request lisp and its variants, as it is seldom mentioned (is it going the way of Fortran?) Actually most business decision making (banks, insurance, credit, factories, etc) are based on business rules, which started from using LISP for business decisions. Nowadays most popular languange would be DROOLS, but the same IF-THEN approach is still the same.
It comes down to what features you need in a language. A few of them would be: Runtime speed / runtime memory, libraries, development speed, and cross-platform availability. C++ is known for producing fast and somewhat memory-efficient programs (In the right hands...), but has esoteric compiler errors, often forces OOP thinking, and, like C, is prone to memory leaks that can plague a project through its lifetime. On the other hand, Python is generally quick to read and quick to write, but orders of magnitude slower than an efficient C program. If you don't like to compiled libraries, the same python program runs on SPARC, ARM, and x86. No terrible cross-platform build system required. Java / Javascript are debatably middle grounds between these two, with both having run-time optimization, but still increased memory requirements over carefully written C/C++ programs. Bit of oversimplification, but not sure how much detail you want / what languages you are comparing...