Re: Why, oh, why, little regexp?
- From: "Rick DeNatale" <rick.denatale@xxxxxxxxx>
- Date: Wed, 31 Oct 2007 20:17:27 +0900
On 10/31/07, Brian Adkins <lojicdotcom@xxxxxxxxx> wrote:
On Oct 30, 11:58 pm, Phrogz <phr...@xxxxxxx> wrote:
On Oct 30, 9:30 pm, Daniel Waite <rabbitb...@xxxxxxxxx> wrote:
That's clever use of ?a, which I recognize but have never seen anyone
use before. Thanks for the example!
My current favorite use for the ?x syntax is converting single-
character strings representing digits into their integer form:
Yeah, so you can squeeze Ruby code into small places :)
1.upto(?d){|i|i%3<1&&x=:Fizz;puts i%5<1?"#{x}Buzz":x||i}
Except under the upcoming revision (1.9) of the (Ruby) Rules of Golf,
the R(uby)&A(ncient) has outlawed that usage, and instituted the
penalty that ?d will no longer be 100, but "d".
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/
.
- Follow-Ups:
- Re: Why, oh, why, little regexp?
- From: Brian Adkins
- Re: Why, oh, why, little regexp?
- References:
- Why, oh, why, little regexp?
- From: Daniel Waite
- Re: Why, oh, why, little regexp?
- From: Daniel Waite
- Re: Why, oh, why, little regexp?
- From: Phrogz
- Re: Why, oh, why, little regexp?
- From: Brian Adkins
- Why, oh, why, little regexp?
- Prev by Date: Re: error with mysql install.
- Next by Date: Re: Rubyconf Attendees
- Previous by thread: Re: Why, oh, why, little regexp?
- Next by thread: Re: Why, oh, why, little regexp?
- Index(es):
Relevant Pages
|