I tried running the following scheme code:
(define affiche-gagnant
(lambda (j1 j2 g1 g2)
(begin
(display "Le gagnant est : ")
(display
(cond ((> g1 g2) j1)
((< g1 g2) j2)
(else (begin (display "personne. ") (display j1) (display " et ") (display j2) (display " sont exaequos. "))))))))
But I get the following output:
Le gagnant est : personne. Alper et Ezgi sont exaequos. #<void>
Where did the #void
come from? How do I get rid of it?
Oops, wrong answer. You have an extra display:
(define affiche-gagnant
(lambda (j1 j2 g1 g2)
(begin
(display "Le gagnant est : ")
(cond ((> g1 g2) (display j1))
((< g1 g2) (display j2))
(else (begin (display "personne. ") (display j1) (display " et ") (display j2) (display " sont exaequos. ")))))))
Should work.
In some implementations of Scheme, any function that shouldn't return anything (such as begin, define, set!) actually returns a special value #<void>
. It is an error to display such a value. In your case, it was an extra "display".
(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. ")))))))