Scheme function error
(define affiche-gagnant
(lambda (j1 j2 g1 g2)
(begin
(display "Le gagnant est : ")
(cond ((> g1 g2) j1)
((< g1 g2) j2)
(else (begin (display "personne. ") (display j1) (display " et ") (display j2) (display " sont exaequos. ")))))))
When j1 or j2 win the game it says :
Le gagnant est :
开发者_JAVA百科
We don't see who win the game :(
I have answered this already.
(define affiche-gagnant
(lambda (j1 j2 g1 g2)
(begin
(display "Le gagnant est : ")
(cond ((> g1 g2) (display j1)) ; You're returning, not displaying
((< g1 g2) (display j2))
(else (begin (display "personne. ") (display j1) (display " et ") (display j2) (display " sont exaequos. ")))))))
精彩评论