2

In the beginning part of Chapter 9 in "The Little Schemer" , there are several examples such as looking, shift, align, and shuffle,


(define looking
    (lambda (a lat)
      (keep-looking a (pick 1 lat) lat)))

(define shift (lambda (pair) (build (first (first pair)) (build (second (first pair)) (second pair)))))

(define align (lambda (pora) (cond ((atom? pora) pora) ((a-pair? (first pora)) (align (shift pora))) (else (build (first pora) (align (second pora)))))))

(define shuffle (lambda (pora) (cond ((atom? pora) pora) ((a-pair? (first pora))(shuffle (revpair pora))) (else (build (first pora) (shuffle (second pora)))))))

I think I understand them cursorily, but I do not know these examples' hints, whether I need to have some prerequisites, some one can tell me?

BEST REGARDS

abelard2008
  • 1,984
  • 1
  • 20
  • 35

1 Answers1

0

There are no prerequisites for reading "The Little Schemer", it's a pretty much self-contained book. If you've been reading so far as the 9th chapter you already know all you need to know to understand the examples, maybe you need to backtrack a little but rest assured, it's all there in the book.

Now if you just jumped straight to the 9th chapter there will be some holes, better go back and read all the previous chapters in order.

Óscar López
  • 232,561
  • 37
  • 312
  • 386
  • Thanks, I can understand these examples, but I don't think they are helpful for me to study "Y combinator" after them in Chapter 9, whether I missed something? thanks again! – abelard2008 Jul 02 '12 at 15:21
  • @abelard2008 didn't say he doesn't understand how or why they work. He did say he doesn't find the lesson the author meant to covey to the reader by teaching them. Me neither. – SRachamim Apr 06 '16 at 07:25