Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ Confessions Thread

Name: Anonymous 2015-04-26 21:07

I've never really understood the Y combinator.

Name: Anonymous 2015-04-27 17:59

>>24
You're doing a complicated "tail recursive with accumulator" version - that lets you easily do an early exit without using continuations.

The idea of the exercise is to start with a normal, direct style version of product:

(define (product xs)
(display (list 'trace xs)) (newline)
(if (null? xs)
1
(* (car xs) (product (cdr xs)))))


and then insert a shift (fun _ -> M) to discard the continuation in the case where you see a 0.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List