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

Pages: 1-

Message passing

Name: Anonymous 2013-10-04 15:32

Hello /prog/, I am reading chapter 3 of SICP and the Sussman uses message passing to make objects. Should I always make objects like this, or only for mutable data? Can Scheme be used for OOP with this technique?

Example :

(define (make-ball size)
   (define (change-size new-size)
      (set! size new-size)
      'ok)
   (lambda (message)
      (cond ((eq? message change-size) change-size)
            (else (error "Invalid message -- MAKE-BALL" message)))))

;; make a ball with a size of 10
(define my-ball (make-ball 10))

;; change its size to 20
((my-ball 'change-size) 20)

Name: baecke_l 2013-10-04 15:48

hello i'm from epitech
how should i do for my "sapin"

fuck you

Name: Anonymous 2013-10-04 17:34

>>3
e-everything?

Name: Anonymous 2013-10-04 17:41

>>4
EVERYTHING

Name: Anonymous 2013-10-05 10:03

progriders.org

Name: Anonymous 2013-11-17 19:34

(define my-balls)

Name: Anonymous 2013-11-17 21:02

pubic static int numberOfBalls = 2;
pubic int BallPartitioning(Ball* balls, int n)
{
int first = 0;
int last = n-1;
 while(( first < last ) && ( balls[last].Color == Color.blue ))
 {
 last--;
 }
 return last;
}

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2013-11-18 2:48

Colour == Colour.blue
FTFY

Name: Anonymous 2013-11-18 12:14

Check ‘em.

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