SPUG: A recreational Perl challenge

Jeremy G Kahn kahn at cpan.org
Sat Nov 22 14:02:41 CST 2003

 From the enjoyable Language Log weblog:

The article below suggests a Perl coding challenge that I wish I had the 
time for. It's not exactly useful, but it's fun. Acme::Justify, perhaps.

I quote below (best viewed in monowidth font)

      Right-justified fixed-width raw text, no padding

It is possible to construct raw English text that has
a justified right margin without employing any of the
space padding that is used by old formatting programs
like nroff that were designed to fake right justified
text using daisy-wheel printers and fixed-width fonts
reminiscent of typewriters.  To show that it is not a
problem to do this, I offer this example (and if your
browser doesn't show this as right-justified, you are
using an insane font setting -- your fixed-width font
default must be a non-fixed-width font or something).

As Mark Liberman has pointed out in connection with a
message I recently sent him that had this property, a
problem in recreational computer science is suggested
by the possibility of right-justified raw text: write
a program that takes raw text paragraphs as input and
produces right-justified versions of them, respecting
certain tolerances and line-length preferences, using
transformations that preserve rough synonymy, varying
optional punctuation and substituting synonymous word
sequences as necessary but never adding extra spaces.

Posted by Geoffrey K. Pullum at November 20, 2003 03:01 PM

More information about the spug-list mailing list