in reply to [perl 6] re reduction operators

It's sometimes easier to just join the numbers form 1 to 300000 and take the first 10^6 digits of that.

It also helps to have a repl-loop so you can quickly try out how long the concatenation of 1..300000 takes and correct the number to a better approximation in a few steps.

(... types some quick lines to an interpreter ... things like # ; <@":"0 i.3e5 and 01234567891011121314151617181920212223242526272829303132333435363738394041424344 flicker on the screen ... yep, 1..2e5 is enough)

Yeah, I'm not a lazy languages guy. Quite the opposite. Especially for quick calculations like this. How did you guess?

Replies are listed 'Best First'.
Re^2: [perl 6] re reduction operators
by blazar (Canon) on Sep 18, 2007 at 15:23 UTC
    It also helps to have a repl-loop so you can quickly try out how long the concatenation of 1..300000 takes and correct the number to a better approximation in a few steps.

    Well, that's what I would probably do if I had your skills and that interpreter. Still I'm interested in elegant and smart solutions that fit both in current Perl and in the much more interesting Perl 6 with its additional degrees of freedom. Of course Perl will never be an entirely mathematically oriented language, but if we can "improve" the situation, ain't it good anyway?

    BTW: sorry for replying so late. I've had and I'm still having very big troubles in real life which prevent me from writing all that I would want in virtual one. I was reminded of this long postponed followup by Re^2: [Perl 6] Even more freedom for custom operators?.