Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top