user-pic

coke

  • About: Perl 6 hacker
Subscribe to feed Recent Actions from coke

  • mattoates commented on Reconsidering Exercise 1

    Just did the Perl 6 example on my Macbook Air and got a very different time! I have a feeling the poster is using the JVM build without understanding that it has about ~8 seconds start up time regardless of what you do, even something like `perl6 -e ''`

    $ perl6 --version
    This is perl6 version 2013.09 built on parrot 5.5.0 revision 0

    $ sysctl -a | grep machdep.cpu.brand.string
    machdep.cpu.brand_string: Intel(R) Core(TM) i5-2557M CPU @ 1.70GHz

    $ time perl6 stuff.p6
    My multiples are: 3 5 6 9 10 12 15 18 20 21 24 25 27 30 33 35 36 ... *snip* ... 993 995 …

  • mattoates commented on Reconsidering Exercise 1

    My times for the Perl 5 version for comparison:

    real 0m0.064s
    user 0m0.010s
    sys 0m0.015s

    So my Mac has a slower time for the Perl 5 code so I'd imagine the OP would have a slightly better time than 1s for the Perl 6 code running in the latest R* parrot build?

  • Timo Paulssen commented on Reconsidering Exercise 1

    Do note that you can use @*ARGS instead of providing a sub MAIN; though the latter will give you a usage message when you don't supply the max and if you write

    sub MAIN( Int $max = 1000 )
    instead, you'll even get a helpful error message if the user writes "over nine thousand" instead of a number.

    Also, for interpolating arrays into strings, you can also just write

    "My multiples are: @multiples[]".say;

    And another thing: I think "1 ..^ $max" looks prettier than "1 .. $max-1".

  • raiph commented on Exercise 1. 3s and 5s.

    In your P6 code you have this line of code:

    unless any(@multiples) $start {

    That looks like TTIAR (two terms in a row) to me (syntax error).

  • Olivier Mengué (dolmen) commented on Exercise 1. 3s and 5s.

    The code is still mangled :(

Subscribe to feed Responses to Comments from coke

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.