racket/collects/tests/mzscheme/benchmarks/shootout/reversefile.ss
2008-02-24 21:27:36 +00:00

14 lines
432 B
Scheme

;;; -*- mode: scheme -*-
;;; $Id: reversefile-mzscheme.code,v 1.10 2006/06/21 15:05:29 bfulgham Exp $
;;; http://shootout.alioth.debian.org/
;;; Provided by Bengt Kleberg
(module reversefile mzscheme
(let ([inport (current-input-port)])
(let rev ([lines null])
(let ([line (read-bytes-line inport)])
(if (eof-object? line)
(for-each (lambda (l) (printf "~a\n" l))
lines)
(rev (cons line lines)))))))