in reply to (Challenge) Rotateable numbers
sub r{ local$_=$@=pop;y/2569/5296/;$@!~/[347]/&&$@==reverse }
Update: 46 characters:
sub r{ y/2569/5296/for$@=pop;$@!~/[347]/&&$@==reverse }
Update: 43 characters:
sub r{ y/2569/5296/for$@=pop;!/[347]/&&$@==reverse } # A slightly different take ... sub r2{ y/2569/5296/for$@=pop;!(/[347]/|$@-reverse) }
Update: 42 characters ... I'm not so certain about this one, but it passes my tests. *shrugs* It looks like it should work because I'm bit-anding SV_yes and SV_no values, which should DWIM in that context.
sub r{ y/2569/5296/for$@=pop;!/[347]/&$@==reverse } sub r{ y/2569/5296/for$@=pop;!y/347//&$@==reverse }
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
I shouldn't have to say this, but any code, unless otherwise stated, is untested
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: (Challenge) Rotateable numbers
by belg4mit (Prior) on Sep 16, 2004 at 02:37 UTC |