#!/usr/bin/guile -s
!#
(define (guess count)
(display "Your guess: ")
(let ((x (read)))
(cond ((> x num) (display "The number is smaller\n") (guess (+ 1 count)))
((< x num) (display "The number is larger\n") (guess (+ 1 count)))
(else (map display (list "It took you " count " guesses to find the number\n"))))))
(define num (+ 1 (random 100 (seed->random-state (current-time)))))
(display "Guess a number between 1 and 100\n")
(guess 1)