Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Inspired by the numerous posts about the importance of learning Lisp/Scheme I started to learn Scheme two days back, I am using the book "The little Schemer" and have completed half of it.

But I still haven't learned anything new, the book teaches about recursion which I already understand and uses lambda (which I can think of a way to define a function in C). I still haven't got the concept of functional programming (please point to some example of functional compared to normal programming methods in C/C++ so I can get it).

Am I learning in the wrong way? or is "The little Schemer" for a newbie in programming and I should look for some other books?

share|improve this question
    
Get a copy of the book suggested by SK-logic, and make yourself through the exercises! –  Doc Brown Jun 28 '12 at 10:52
    
so are you actually writing scheme i.e. doing exercise while reading this book, or have you just read it without writing code? –  jk. Jun 28 '12 at 11:53
    
@jk. I write sometimes, not always –  nischayn22 Jun 28 '12 at 12:48
    
...I actually liked that book. Nevertheless, nothing is better than hands on practice afterwards! –  arnaud Jun 28 '12 at 13:11
add comment

3 Answers

up vote 9 down vote accepted

Wait until you'll get to the lexical closures.

Than try to grasp the homoiconic property of the language - this is what makes it really different from the C-likes.

And make sure you'll learn a Scheme with a proper define-macro implementation (I'd recommend Racket or Bigloo), not just standard hygienic macros (the latter would not surprise you at all if you're familiar with the C++ templates). Most Scheme textbooks would skip this stuff, unfortunately, but I'd argue that there is nothing nearly as important in Lisps as the proper macros.

It is also important to try to understand the purely functional subset of Scheme and learn how to solve all the possible programming problems with it. "Little Schemer" is a good starting point, but not nearly sufficient. Go through "Structure and Interpretation of Computer programs" after it.

share|improve this answer
3  
-1 for suggesting define-macro. There is no reason to ever use this thing other than the possibility of learning why it is wrong. –  Eli Barzilay Jun 28 '12 at 8:27
2  
I agree with Eli---define-macro has no place in modern Scheme programming. You can write fully procedural macros using syntax-case or explicit renaming without having to stoop to unhygienic macros. –  Chris Jester-Young Jun 28 '12 at 11:51
2  
@SK-logic: You're mixing things up. The issue is expressiveness. You can (easily) implement define-macro using define-syntax -- where the implementation is a macro. If you're dealing with a frontend for the language, then you're not using the macro system (and you can do so in any language, since you don't need macros). So your argument falls into the old Turing Machine bin, where any TM-equivalent language can do the same. (Even with that, a hygienic macro expander in 300 lines would be impressive. You should publicize such a miracle.) –  Eli Barzilay Jun 29 '12 at 15:57
2  
See your earlier comment about implementing a hygienic system as a front-end: this means that it is no longer related to macros, only the ability to run any code at the meta level, which is why your question asks about an irrelevant decision. Macros do help when there is a local transformation rule that you want to implement, and implementing a hygienic macros is not known to be possible with local rules (again, see Costanza's attempt). –  Eli Barzilay Jun 29 '12 at 17:04
2  
As for your side-comments about hygiene being pointless: this is not some opinion that you'd change here, and apparently people who do use Scheme value it. Given this, and given that you have no concrete evidence against it, and given that it contributes nothing, I suggest you just drop it. (And before you start flaming, just think whether there's any point to such flaming.) –  Eli Barzilay Jun 29 '12 at 17:06
show 12 more comments

The best way to get the taste of functional programming is to write programs.

For example, write a simple XML parser in C++ and scheme. (and do not use mutable variables in scheme).

Or solve some euler-project problems in scheme/haskell/ocaml/whatever.

share|improve this answer
add comment

"The Little Schemer" is an exercise book, aimed at giving you a grounding in the Scheme dialect of LISP.

It is most emphatically NOT a textbook on LISP or Scheme programming, much less a text on functional programming. For that, you want, as SK-Logic said, Structure and Interpretation of Computer Programs.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.