Little Schemer and Racket

DrRacket is the (r)evolution of DrScheme; DrRacket will work perfectly for the exercises in “The Little Schemer”. Just don’t forget to: In the Language dialog, choose “Use the language declared in the source” Write #lang racket at the top of each file you create Implement the atom? predicate in each file as explained at the … Read more

Y combinator discussion in “The Little Schemer”

Great question. For the benefit of those without a functioning DrRacket installation (myself included) I’ll try to answer it. First, let’s use some sane (short) variable names, easily trackable by a human eye/mind: ((lambda (h) ; A. (h h)) ; apply h to h (lambda (g) (lambda (lst) (if (null? lst) 0 (add1 ((g g) … Read more

Help understanding Continuations in Scheme

Try something simpler to see how this works. For example, here’s a version of a list-sum function that receives a continuation argument (which is often called k): (define (list-sum l k) (if (null? l) ??? (list-sum (cdr l) ???))) The basic pattern is there, and the missing parts are where the interesting things happen. The … Read more

tech