kacchi #630(2007/07/12 10:10 GMT) [ Scheme ] Rating0/0=0.00
「なんでも再帰」の相互再帰で。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
(define (remove-comment s) (define (out-comment c) (cond ((eof-object? c)) ((char=? c #\/) (cond ((eof-object? (peek-char)) (display c)) (else (cond ((char=? (peek-char) #\*) (read-char) (in-comment (read-char))) (else (display c) (out-comment (read-char))))))) (else (display c) (out-comment (read-char))))) (define (in-comment c) (cond ((eof-object? c)) ((char=? c #\*) (unless (eof-object? (peek-char)) (cond ((char=? (peek-char) #\/) (read-char) (out-comment (read-char))) (else (in-comment (read-char)))))) (else (in-comment (read-char))))) (with-output-to-string (lambda () (with-input-from-string s (lambda () (out-comment (read-char)))))))
Rating0/0=0.00-0+
[ reply ]
kacchi
#630()
[
Scheme
]
Rating0/0=0.00
Rating0/0=0.00-0+
[ reply ]