RosettaCodeData/Task/Odd-word-problem/Scheme/odd-word-problem.ss

20 lines
368 B
Scheme

(define (odd)
(let ((c (read-char)))
(if (char-alphabetic? c)
(let ((r (odd)))
(write-char c)
r)
(lambda () (write-char c) (char=? c #\.)))))
(define (even)
(let ((c (read-char)))
(write-char c)
(if (char-alphabetic? c)
(even)
(char=? c #\.))))
(let loop ((i #f))
(if (if i ((odd)) (even))
(exit)
(loop (not i))))