Skip to content
Extraits de code Groupes Projets
Valider 8f21c65e rédigé par Nicolas Verbois's avatar Nicolas Verbois
Parcourir les fichiers

Upload New File

parent c17f6565
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
#lang r5rs
(define (point x y)
(define (setx value)
(set! x value))
(define (add point)
(list (+ x (point 'getx)) (+ y (point 'gety))))
(define (self m)
(cond ((eq? m 'getx) x)
((eq? m 'gety) y)
((eq? m 'type) 'point)
((eq? m 'info) (list (self 'type) (self 'getx) (self 'gety)) )
((eq? m 'setx!) setx )
((eq? m 'add) add)
(else (display "ERROR"))))
self)
(display "coucou")
(define p1 (point 1 2))
(define p2 (point 3 4))
(display (p1 'getx))
(newline)
(display (p1 'gety))
(newline)
(display (p1 'type))
(newline)
(display (p1 'info))
(newline)
((p1 'setx!) 5)
(display (p1 'getx))
(newline)
(display ((p1 'add) p2))
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter