Should I learn Lisp or C ++ first

Why should I learn Lisp? [closed]


This question does not currently fit our Q&A format. We expect the answers to be supported by fact, testimony, or expertise, but this question is likely to lead to debate, argument, polls, or expanded discussion. If you think this question can be improved and possibly reopened, contact the help center.
Closed 7 years ago.

I really feel like I should learn Lisp and there are plenty of good resources out there to help me out.

I'm not put off by the complicated syntax, but wherever I find places in "traditional commercial programming" it would make sense to use it in place of a procedural language.

Is there a commercial killer app out there written in Lisp?





Reply:


One of the main uses for Lisp is artificial intelligence. A friend of mine in college took an AI graduation course and wrote a "Lights Out" solver in Lisp for his main project. Several versions of his program used slightly different AI routines and tests on around 40 computers produced some pretty good results (wish there was somewhere online that I could link to, but I don't think it is).

Two semesters ago, I used Scheme (a Lisp-based language) to write an interactive program that simulated Abbott's and Costello's Who's on First routine. The user's inputs were compared to some rather complicated data structures (similar to cards in other languages ​​but much more flexible) to decide which answer would be appropriate. I also wrote a routine to solve a 3x3 slide puzzle (an algorithm that can easily be extended to larger slide puzzles).

In conclusion, learning Lisp (or Scheme) may not have many practical uses beyond AI, but it is an extremely valuable learning experience as many others have indicated. Programming in a functional language like Lisp also helps you think recursively (if you have problems recursing in other languages ​​this can be of great help).






Lisp is a large and complex language with a large and complex runtime to support it. For this reason, Lisp is best for large and complicated problems.

A complex Problem is not the same as one complicated . A complex The problem is one with many small details, but it is not difficult. Writing an airline booking system is a complex business, but with enough money and coders, it isn't difficult. Get the difference?

A complicated problem is a complicated one where traditional sharing and conquering doesn't work. Controlling a robot or working with data that is not in tabular form (e.g. languages) or in highly dynamic situations.

Lisp is very suitable for problems where the solution needs to be extensible. The classic example is the Emacs text editor. It is fully programmable and therefore an independent programming environment.

In his famous book PAIP, Norvig says Lisp is ideal for exploratory programming. That is, you are programming a solution to a problem that was not fully understood (as opposed to an online booking system). In other words, complicated problems.

In addition, learning Lisp will remind you of something fundamental that has been forgotten: the difference between Von Neumann and Turing. As we know, Turing's computational model is an interesting theoretical model, but it is useless as a model for computer design. Von Neumann, on the other hand, designed a model for the execution of computers and calculations: the Von Neumann model. The focus of the Von Neumann model is that you only have one memory and store both your code and your data there. Note carefully that a Java program (or C # or whatever you want) is a manifestation of the Turing Model. You put your program in concrete terms once and for all. Then hope you can handle any data that is thrown on it.

Lisp retains the Von Neuman model; There is no sharp, predetermined boundary between code and data. Programming in Lisp opens your mind to the power of the Von Neumann model. When you program in Lisp, you see old concepts in a new light.

Eventually, if you are interactive, you will learn to interact with your programs as you develop them (as opposed to compiling and running). This also changes the way you program and how you view the programming.

With this intro I can finally give an answer to your question: can you find places where it outshines "traditional" languages?

If you are an advanced programmer, you need advanced tools. And there is no more advanced tool than Lisp. In other words, the answer is yes if your problems are difficult. No different.






complicated syntax ?

The syntax for lisp is incredibly easy .

Killer app written in Lisp: Emacs. Lisp lets you extend Emacs however you want to do almost anything you can imagine an editor to do.

But you should only learn Lisp if you want , and you may never be able to use it at work, but it's still great.

Also, let me add: even if you find places where Lisp makes sense, you probably won't convince anyone that it should be used over Java, C ++, C #, Python, Ruby, etc.








I've programmed Lisp professionally for about a year and it's definitely worth learning. You have an unprecedented opportunity to remove redundancy from your code by replacing all of the code on the boiler plate with functions and macros whenever possible. You can also access unprecedented flexibility at runtime and freely translate between code and data. In situations where user actions can trigger the need to dynamically build complex structures, Lisp really shines. Popular airline flight planners are written in Lisp, and there are plenty of CAD / CAM in Lisp as well.


If you enjoy programming, you should learn Lisp for the sheer joy of learning. XKCD perfectly expresses the resulting intellectual enlightenment. Learning Lisp is to the programmer what meditation is to the Buddhist monk (and I meant this with no blasphemous connotation).


Lisp is very useful for creating small DSLs. I have a copy of Lisp in a Box that runs at work and I've written little DSLs to query SQL Server databases and generate data planes etc in C #. All of my code for the boiler plate is now written in Lisp macros that are output to C #. I use it to generate HTML, XML, and all sorts of things. I wish I could use Lisp for day-to-day coding, but Lisp can come in handy.



Any language looks a lot more difficult if you don't use the usual indentation conventions for a language. If you follow them from Lisp, it's pretty easy to see how it expresses a syntax tree structure (note that this is not entirely true as the preview is a bit; the Rs should match the fns in the recursive quicksort argument):







I found that learning a new language always affects your programming style in languages ​​you already know. For me, it has always made me think in different ways to solve a problem in my primary language, Java. I generally think it just broadens your horizons in terms of programming.



If you have to wonder if you should learn to lisp, you probably don't have to.





I took a "Lisp" class in college in the 1980s. Despite all the concepts that were presented in the class, I stayed Nothing left appreciation for what makes Lisp great. I fear many people consider Lisp to be a different programming language, which this college course did for me so many years ago. If you see someone complaining about Lisp syntax (or lack of it), there's a good chance they'll be one of those people who didn't understand the greatness of Lisp. I've been one of those people for a long time.

It wasn't until two decades later, when I rekindled my interest in Lisp, that I began to "understand" what makes Lisp interesting - at least for me. If you can manage to learn Lisp without getting overwhelmed by locks and Lisp macros, you have probably missed the point.



Learning LISP / Schema may not give you a wider scope, but it will help you better understand functional programming, its rules and exceptions.

Well worth the time to learn the difference in the beauty of six nested pure functions and the nightmare of six nested functions with side effects.


From http://www.gigamonkeys.com/book/introduction-why-lisp.html

One of the most repeated myths about Lisp is that it is "dead". Although Common Lisp is not used as widely as, for example, Visual Basic or Java, it seems strange to describe a language that is still used for new development and that continues to attract new users as "dead". Recent Lisp success stories include Paul Graham's Viaweb, which became the Yahoo Store when Yahoo bought his company. ITA Software's QPX airfare and purchasing system used by online ticket vendor Orbitz and others; Naughty Dogs game for the PlayStation 2, Jak and Daxter, written largely in a domain-specific Lisp dialect invented by Naughty Dog called GOAL, the compiler of which is itself written in Common Lisp; and the Roomba, the autonomous robotic vacuum cleaner whose software is written in L, a backward compatible subset of Common Lisp. Perhaps even more telling is the growth of the Common Lisp.net website, which hosts open source Common Lisp projects, and the number of local Lisp user groups that have emerged in recent years.


"Lisp is worth learning for the profound enlightenment experience you will have when you finally get it. This experience will make you a better programmer for the rest of your days, even if you never use Lisp that much yourself. "

- Eric S. Raymond, "How to Become a Hacker"

http://www.paulgraham.com/avg.html


I agree that Lisp is one of those languages ​​that you may never use in a commercial setting. But even if you don't get to it, learning will definitely expand your understanding of programming as a whole. For example, I studied Prologue in college and while I never used it again, I've given myself a better understanding of a lot of programming concepts and (sometimes) a greater appreciation for the languages ​​I use.

But if you want to learn ... be sure to read On Lisp



When you learn Lisp, Javascript is seen in a completely different light! Lisp really forces you to grasp both recursion and the whole "functions as prime objects" paradigm. See Crockford's excellent article on Scheme vs Javascript. Javascript is perhaps the most important language today, so understanding it better is immensely useful!





Gimps Script-Fu is lip-like. It's a Photoshop killer app.


Okay, I may be weird, but I really don't like Paul Graham's essays that much & on Lisp is a really rough book if you don't understand Common Lisp yet. Instead I would choose Siebel's Practical Common Lisp. As for "killer apps", Common Lisp seems to find its place in niche businesses like ITA. While there isn't an app as synonymous with CL as Rails is with Ruby, there are places in the industry that use it if you do a little digging.


Complicated syntax? The nice thing about Lisp is that it has ridiculously simple syntax. It's just a list, in which each element of the list can either be a different list or an elementary data type.

It is worth learning as it improves your coding ability to view and use functions as just another type of data. This improves the way you code in an imperative and / or object-oriented language, as it gives you more mental flexibility with the structure of your code.


How to complete the other answers:

Because the SICP course (the videos are available here) is great: it brings you Lisp and much more at !


Killer app? Franz Inc. has a long list of success stories, but that list only includes AllegroCL users ... there are likely others. My favorite is the story about Naughty Dog as I was a huge fan of the Crash Bandicoot games.

For learning Common Lisp, I would recommend Practical Common Lisp. It has a practical approach that at least made it easier for me than other books I've looked at.


You can use Clojure today to write tests and scripts on the Java VM. While other Lisp languages ​​are implemented in the JVM, Clojure can best integrate with Java in my opinion.

There are times when the Java language itself hinders the writing of tests for Java code (including "traditional commercial programming"). (I don't mean this as an indictment of Java - other languages ​​suffer from the same problem - but it is a fact. Since the subject is not Java, I will not go into it. You are welcome to start a new subject if anyone wishes discuss it.) Clojure removes many of these obstacles.


Lisp can be used anywhere you use traditional programming. It's not that different, it's just more powerful. Write a web app? Can you do it on Lisp and write a desktop application? You can do it on Lisp, whatever, you can probably do it on Lisp, Python, or some other generic programming (there are some languages ​​that are only good for one task).

The biggest obstacle will likely be the acceptance of your boss, your colleagues or your customers. That is something that you have to work with. Choosing a pragmatic solution like Clojure that can leverage the current installation base of Java infrastructure from the JVM to the libraries could help you. If you have a Java program, you can also build a plug-in architecture and write Clojure plug-ins for it and end up writing half your code in Clojure.


No reason, but (trivially) AutoCAD offers LISP and DCL runtime support. It's a convenient way to write complex macros (including ActiveX automation) when you don't want to use VBA or their C ++ or .NET SDKs, or when a DIESEL expression doesn't intersect them.

Many of the AutoCAD functions are LISP routines.