Stupid question

ARGH, Verizon's overzealous spamfilter has been eating my replies outbound. :stuck_out_tongue:

First, on Wed, Nov 30, 2011 at 15:14, Aaron D. Gifford

If we're golfing, here's my amateur golf attempt: *chuckle*

s=0;'2011'.chars{|x|s+=x.to_i};s

And another four chars gone! Well done! Just goes to show, using
typical Ruby idioms doesn't always yield (no pun intended) the
shortest code, nor the fastest.

(Are we allowing semicolons?)

Sure, why not. I'll even allow carriage returns, counting them as one char.

Second, on Wed, Nov 30, 2011 at 15:42, Admin Tensor

路路路

<astounding@gmail.com> wrote:
<admin@tensor.heliohost.org> wrote:

If the number of digits is less than five, how about this one for Ruby
Golf :wink:

   "2011".sum(48)%48

Cuuuuute. If we restrict it to years we've had so far (CE), okay.

-Dave

--
LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern languages.
Where: Northern Virginia, Washington DC (near Orange Line), and remote work.
See: davearonson.com (main) * codosaur.us (code) * dare2xl.com (excellence).
Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (Aronson)

Dave Aronson wrote in post #1034582:

   "2011".sum(48)%48

Cuuuuute. If we restrict it to years we've had so far (CE), okay.

As Aaron pointed yesterday, if the number of digits is less than or
equal to five, the shortest code is

    "2011".sum%48

(for some reason it didn't work for me before). And if the digits are
longer, he has some shortest code for that.

Regards,

Bill

路路路

--
Posted via http://www.ruby-forum.com/\.

-----Messaggio originale-----

路路路

Da: Admin Tensor [mailto:admin@tensor.heliohost.org]
Inviato: gioved矛 1 dicembre 2011 17:32
A: ruby-talk ML
Oggetto: Re: Stupid question

Dave Aronson wrote in post #1034582:

   "2011".sum(48)%48

Cuuuuute. If we restrict it to years we've had so far (CE), okay.

As Aaron pointed yesterday, if the number of digits is less than or equal to
five, the shortest code is

    "2011".sum%48

(for some reason it didn't work for me before). And if the digits are
longer, he has some shortest code for that.

Regards,

Bill

--
Posted via http://www.ruby-forum.com/\.

--
Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f

Sponsor:
Capodanno a Riccione, Pacchetto Relax: Mezza Pensione + bagno turco + solarium + massaggio. Wifi e parcheggio gratis. 2 giorni euro 199 a persona
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid979&d)-12