15

I have been working as a C developer on Linux platform for sometime now. Recently finished K & R and did a little study of implementing OOP in C. Beside that I have studied C++ and Java. All of it has been on Linux platform.

Now I plan to learn LISP. I have gone through LISP discussions directed towards beginners on SO, especially What’s the best way to learn LISP.

I understand, moving from procedural to functional programming paradigm is a big move. Thinking in terms of the new paradigm would be the real challenge. Just like the way it was when I learned OOP for the first time.

It is the paradigm I am really worried about. When I started OOP, most of the time was consumed in learning how to view problems in terms of OOP. Syntax was not so difficult to grasp.

Now as I have been working in C, my current projects at my workplace are also in C. I am concerned how could I learn to view problems in terms of functional programming.

  1. What could be the best way to make shift towards LISP for a C developer?
  2. Should I learn some other intermediate language before I move to LISP?
  3. If yes then which language that could be?
  4. Any particular text that would help me think in the way of functional programming?
  5. Any suggestion that would make this shift faster and easier?

Thanks for your time. Any help and suggestion would be greatly appreciated.

Community
  • 1
  • 1
Andrew-Dufresne
  • 5,464
  • 7
  • 46
  • 68
  • 11
    Stop futzing around and write a semi-realistic program in LISP already. That's always the best way to learn. You'll make mistakes and learn from them! – E.M. Aug 20 '10 at 06:55
  • 4
    Forget (or at least ignore) what you know about programming (especially C) and then follow the advice in a "how do I learn LISP" programming. LISP is sufficiently different from C that looking for similarities will slow you down while you learn. – Joachim Sauer Aug 20 '10 at 06:57
  • 5
    +1, Richard Stallman himself is written in LISP. – Tim Post Aug 20 '10 at 07:17
  • You keep saying "functional" (and also WRITING THE NAME in ALL CAPS!). Are you planning to learn Common Lisp, or are you looking at some other dialect of Lisp that's primary functional? – Ken Aug 20 '10 at 14:26
  • @Ken: Thanks for pointing out the upper case thing. My mistake! :) `are you looking at some...` I have started from Practical Common Lisp. At this stage I am focused only at PCL. Amos has mentioned in reply that Lips is not strictly a FP language, so later I will look for strictly FP dialect or language. Have you got any suggestion? Thanks – Andrew-Dufresne Aug 21 '10 at 03:03

8 Answers8

10

Try the books:

Practical Common Lisp by Peter Siebel (available online at http://www.gigamonkeys.com/book/ ).

ANSI Common Lisp by Paul Graham then try On Lisp by the same author.

Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp by Peter Norvig

Other places to find help include the #lisp channel on FreeNode and LispForum ( http://www.lispforum.com/ ).

Of these PCL is probably the easiest to get into, if you're trying to learn Lisp as a way of learning Functional Programming you're going to be disappointed though, you can use Lisp to do FP but it isn't strictly a FP language.

Amos
  • 1,081
  • 2
  • 8
  • 17
6

Possible duplicate

You could do a lot worse than MIT Course 6.001 "Structure and Interpretation of Computer Programs". The class uses Abelson & Sussman's text; see also the book's main site for more information.

The class uses Scheme, a dialect of LISP which is significantly cleaner and easier to use than Common LISP (yes, this is an opinion, deal with it). Switching to Common LISP won't be that difficult later. Paul Graham's On LISP is a "take no prisoners" text on programming in Common LISP. His ANSI Common LISP is a gentler introduction to the subject.

Now for the bad news. Making the shift toward WORKING in LISP is likely to be very difficult, as there are a lot more C/C++ and Java jobs out there.

I'd recommend jumping straight into learning LISP. It isn't that difficult.

You'll need a LISP system to play with. If you are using Scheme, it is hard to beat the MIT/GNU Scheme system. For Common LISP, there are several choices: I'd probably start with GCL - GNU Common LISP. Versions are available for Linux and Windows.

Community
  • 1
  • 1
John R. Strohm
  • 7,547
  • 2
  • 28
  • 33
  • First of all thanks for answering to my question. English is not my native language, so would you please explain what do you mean by `You could do a lot worse than...` You mean if I don't read this book I would do worst? As for duplicate link, I have already mentioned it in my post. Thanks. – Andrew-Dufresne Aug 20 '10 at 06:56
  • 3
    English idiom. It means that you could do it some other way, but it would likely be a lot more painful if you did. Course 6.001 taught LISP to a very large number of MIT freshmen engineering students, with relatively few casualties. The link is to the MIT Open Courseware site, and contains the complete class, not just the textbook. – John R. Strohm Aug 20 '10 at 07:03
  • 4
    GCL is totally outdated. Use SBCL or CCL. – Rainer Joswig Aug 20 '10 at 08:21
  • Saying "you could do a lot worse than x" means that "x" is pretty good. – Gautam Jul 31 '14 at 22:04
  • 1
    @RainerJoswig: Coming back to this years later, I should mention that I've played some with SBCL. I don't get to play with it nearly enough, but I very much like what I've seen. – John R. Strohm Apr 27 '17 at 22:52
  • I spent a fair amount of 2020 working from home, hacking text files using C and Steel Bank Common LISP. The C code did some cleanup on the input file, to fix some Microsoft weirdnesses ("idiocies" is the more correct term) and some character set things that SBCL choked on. I used SBCL to build some delimited files that could then be hauled into Excel for the users to peruse. I could not have done it nearly as well with anything else. – John R. Strohm Jul 22 '22 at 03:26
4

The book I originally learnt lisp with is The Little Schemer by DP Friedman. Really gets your head into a functional programming mindset.

Giles Roberts
  • 6,407
  • 6
  • 48
  • 63
2

Read "Practical Common Lisp". At my company we have at least 70 programmers using Common Lisp every day for complex, practical programs (airline fare search, airline reservation systems), and when a new programmer shows up who is not familiar with Lisp, we just hand him or her a copy of "Practical Common Lisp". I cannot say enough about how great this book is.

Dan Weinreb
  • 533
  • 5
  • 7
1

I found python foundation (lambda functions and such) to be very helpful in grasping lisp.

At one time I decided to learn emacs scripting, which uses lisp dialect, and that was very helpful, since then you know you want what to do, instead of going through exercises.

I think you need a good text editor with lisp support and shell. then just try to make a target project and implement it.

Anycorn
  • 50,217
  • 42
  • 167
  • 261
1

I personally found the GNU Emacs Lisp Tutorial a delight to read. It will give you the general ideas.

PP.
  • 10,764
  • 7
  • 45
  • 59
1

I recommend first reading Successful Lisp up to chapter 3, don't go on and read chapter 4. 3 get's a good grasp of Lisp thinking, however. Then read Gentle, and after that, Practical Common Lisp. From there, just general Common Lisp experimentation will help you on from there.

Alex
  • 57
  • 1
  • @zc00gii: Thanks. From `Successful Lisp`, you mean this [book](http://psg.com/~dlamkins/sl/). What is the complete name of the book `Gentle` that you have mentioned? [Common Lisp: A Gentle Introduction to Symbolic Computation](http://www.cs.cmu.edu/~dst/LispBook/)? – Andrew-Dufresne Aug 29 '10 at 08:35
1

I recently bought Land of Lisp, and found it to be quite entertaining and educational. I can recommend it.

Peter Frings
  • 161
  • 5