Welcome to the CHICKEN Scheme pasting service

bundle for Bunny351 added by wxallowed on Fri Oct 1 22:59:52 2021

;; bundle generates a _message-accepting procedure_
(define (make-point x y)
  (define (get-x) x)
  (define (get-y) y)
  (define (set-x! new-x) (set! x new-x))
  (define (set-y! new-y) (set! y new-y))
  (bundle point? get-x get-y set-x! set-y!))


; thus you can do

(define p1 (make-point 3 4))
(define p2 (make-point -1 1))

(point? p1) ; #t
(point? (lambda (x) x)) ; #f
(p1 'get-x) ; 3

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What's the procedure that returns the car of a cdr?
Visually impaired? Let me spell it for you (wav file) download WAV