develooper Front page | perl.fwp | Postings from December 2001

Sorted Code

Thread Next
From:
Alistair.McGlinchy
Date:
December 13, 2001 17:40
Subject:
Sorted Code
Message ID:
74EB97D91561D311A67D0001FA7E847704D2C35B@GBHEXCHGPRI0001
Hi All,

Using only ASCII chars " " to "~" excluding the "#"  ie 
	@chars= map {chr} (32..34,36..126)
what is the longest piece of perl code $c which is "perl -c" correct with
the requirement that each character in $c is ord-less than the next one.  ie

	@sub_set= split//,$c;
	@seen{@sub_set} = (1)x@sub_set;
	$c eq join"",sort keys %seen;

A hand-generated example is 
 &'()-.0123456789>ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz{}

I'm off on holiday for the next week so I thought I'd leave my computer busy
while I was gone.  I've written some horridly inefficent code to work this
out by brute force. However doubtless some of you will be able to beat my
computer's exhaustive search with some deeper insight into syntactically
correct code. 

A second piece of fun:
What's the most useful piece of code you can write with this restriction?
[For very loose definitions of the work "useful"]

Cheers,

Alistair
> ----------------------------------------------------------------------
> Alistair McGlinchy,           alistair.mcglinchy@marks-and-spencer.com
> Sizing and Performance, Central IT,   ext. 5012,   ph +44 20 7268-5012
> Marks and Spencer, 3 Longwalk Rd, Stockley Park, Uxbridge UB11 1AW, UK 
> 


-----------------------------------------------------------------------


Registered Office:
Marks & Spencer p.l.c
Michael House, Baker Street,
London, W1U 8EP
Registered No. 214436 in England and Wales.

Telephone (020) 7935 4422 
Facsimile (020) 7487 2670

www.marksandspencer.com

Please note that electronic mail may be monitored.

This e-mail is confidential. If you received it by mistake, please let us know and then delete it from your system; you should not copy, disclose, or distribute its contents to anyone nor act in reliance on this e-mail, as this is prohibited and may be unlawful.

The registered office of Marks and Spencer Financial Services Limited, Marks and Spencer Unit Trust Management Limited, Marks and Spencer Life Assurance Limited and Marks and Spencer Savings and Investments Limited is Kings Meadow, Chester, CH99 9FB.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About