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

Puzzling CONS definition from SICP

Name: Anonymous 2010-12-29 6:27

I tried to use it, but couldnt find a way to discern it from ordinary function.

(define (cons x y)
  (define (dispatch m)
    (cond ((= m 0) x)
          ((= m 1) y)
          (else (error "Argument not 0 or 1 -- CONS" m))))
  dispatch)

(define (car z) (z 0))

(define (cdr z) (z 1))

Name: Anonymous 2010-12-29 8:26

>>4
This implementation doesn't give you pair?, which is used in several examples.

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