#reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname reverser-file-io) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
(require 2htdp/batch-io)
(require racket/string)
(require (planet "main.rkt" ("nah22" "racketui.plt" 1 2)))
(define (reverser file-name min-len)
(write-file
(string-append file-name "-output.txt")
(string-join
(map (λ(ln) (if (>= (length (string->list ln)) min-len)
(list->string (reverse (string->list ln)))
ln))
(read-lines file-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])))