;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib"htdp-intermediate-lambda-reader.ss""lang")((modnamereverser-file-io) (read-case-sensitive#t) (teachpacks ()) (htdp-settings#(#tconstructorrepeating-decimal#f#tnone#f ())))
(require2htdp/batch-io)
(requireracket/string) ; string-join
(require (planetnah22/racketui))
; reverser : file-name number -> file-name
; produces the name of the output file in which all lines from
; the given input file that are at least min-len characters
; have been reversed.
(define (reverserfile-namemin-len)
(write-file
(string-appendfile-name"-output.txt")
(string-join
(map (λ(ln) (if (>= (length (string->listln)) min-len)
(list->string (reverse (string->listln)))
ln))
(read-linesfile-name))
"\n")))
(web-launch"Data Reverser"
(function"This program reverses all lines from a given input file that exceed a given number of characters. It writes the result to an output file."
(reverser ["Input file"filename] ["Minimum line length"number]
-> ["Processed output file"filename])))