Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2012-09-21

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:27 am0c joined #perl6
00:29 raiph joined #perl6
00:44 benabik joined #perl6
00:47 yarp joined #perl6
01:10 anuby joined #perl6
01:29 Psyche^ joined #perl6
01:30 hypolin joined #perl6
01:42 FROGGS_ joined #perl6
01:43 leprevost joined #perl6
01:46 flightrecorder joined #perl6
01:57 MikeFair_ joined #perl6
01:59 gootle joined #perl6
02:10 MikeFair_ joined #perl6
02:10 fgomez joined #perl6
02:14 colomon_ joined #perl6
02:14 * [Coke] pushed another set of updates for QAST on partcl-nqp/nqp2, and is now getting this error:
02:15 [Coke] Error while compiling block : Error while compiling op : hash: can't use null as key
02:43 thou joined #perl6
02:50 odoacre joined #perl6
02:56 orafu joined #perl6
03:20 Psyche^ joined #perl6
03:34 MikeFair_ [Coke]: how's that error coming?
04:00 Traceur joined #perl6
04:23 Traceur joined #perl6
04:24 Traceur joined #perl6
04:28 wk joined #perl6
04:28 jaldhar joined #perl6
04:28 sftp joined #perl6
04:28 snarkyboojum joined #perl6
04:28 PerlJam joined #perl6
04:28 bbkr joined #perl6
04:32 telex joined #perl6
04:37 fm__ joined #perl6
04:47 kaleem joined #perl6
05:42 sorear random, certainly unoriginal, thought on number theory:
05:45 TimToady ...
05:47 sorear given a putative number p of the form 4k+1, for all x, let y = x^2, z = y^2, now z^((p+1)/4) = x^(p+1) = y mod p, so square roots are easy iff p is prime (Blum-Goldwasser)
05:48 sorear now imagine turning this into a primality test: take a random number, try to take a square root, fail if the putative root is wrong
05:48 sorear if this test gives a false positive, it has found a square root of a random number modulo a composite
05:48 sorear but we know (Rabin) that that is exactly as hard as factoring.
05:49 sorear so a single iteration of this test will only give the wrong answer, if the test could have factored the number
05:49 sorear if factoring is hard on average for classical algorithms, this algorithm fails with neglible probability on random inputs
05:55 sorear I've seen a lot of primality testers using the generalized Riemann hypothesis
05:55 sorear I can't be the first one to think of primality testing connected to standard cryptographic assumptions
06:29 MikeFair_ you're not, but those who are interested in the field tend to flock together or not talk about their work. :)  In fact I think several movies even make references to such things (sneakers comes to mind, not that many people actually understood what the match the professor was explaining that chip actually did)
06:30 MikeFair_ Anyone here aware of Java's JSR223 Scripting Engine Framework API?
06:30 MikeFair_ I just got made aware of it today, and think it could be relevant to the Perl6 on Java / Parrot on Java discussion
06:33 birdwindupbird joined #perl6
06:34 sorear MikeFair_: nah, what's really interesting here is the faint glimmer of a connection between the GRH and P vs NP.  Pity I'm nowhere near good enough to follow up on it.
06:35 MikeFair_ sorear: I hear that pain. :)
06:38 MikeFair_ Man, some people have done a lot of very cool stuff out there
06:45 flightrecorder joined #perl6
06:46 FROGGS joined #perl6
06:47 sorear o/
06:48 FROGGS good morning
06:50 MayDaniel joined #perl6
06:50 jnthn o/
06:50 jnthn wow, short backlog
06:51 diakopter :)
06:52 sorear o/
06:55 wamba joined #perl6
06:55 GlitchMr joined #perl6
06:58 fhelmberger joined #perl6
07:01 * jnthn commuts
07:03 FROGGS jnthn: latest rakudo complains about the \ in \$arr here: multi method at_pos(::?CLASS:D \$arr: $pos) is rw { # NativeCall.pm#L149
07:03 FROGGS should the \ be removed?
07:03 FROGGS "Obsolete use of | or \ with sigil on param $arr"
07:03 FROGGS just a warning though
07:09 brrt joined #perl6
07:13 tadzik good morning #perl6
07:15 FROGGS morning tadzik
07:17 odoacre_ joined #perl6
07:25 odoacre_ joined #perl6
07:31 GlitchMr FROGGS: it is \arr if I remember correctly
07:32 GlitchMr FROGGS: http://perlcabal.org/syn/S06.html#Parcel_binding
07:34 Psyche^ joined #perl6
07:34 wk joined #perl6
07:35 GlitchMr perl6: class Mumbler { method mumble { say "Mumble!" } };(-> \_ = OUTER::<_> { _.mumble })(Mumbler.new())
07:35 p6eval rakudo ef228d: OUTPUT«Mumble!␤»
07:35 p6eval ..niecza v21-15-gf226bf6: OUTPUT«[31m===[0mSORRY![31m===[0m��Unexpected block in infix position (two terms in a row, or previous statement missing semicolon?) at /tmp/cTelw01ND9 line 1:�------> [32m{ say "Mumble!" } };(-> \_ = OUTER::<_> [33m�[31m{ _.mumble })(Mumbler.new())[0m��P…
07:35 GlitchMr std: class Mumbler { method mumble { say "Mumble!" } };(-> \_ = OUTER::<_> { _.mumble })(Mumbler.new())
07:36 p6eval std 77327a4: OUTPUT«Use of uninitialized value $first in string eq at STD.pm line 65741.�Use of uninitialized value $first in string lt at STD.pm line 65746.�[31m===[0mSORRY![31m===[0m�Unexpected block in infix position (two terms in a row, or previous statement missing semicolon?) …
07:36 GlitchMr std: class Mumbler { method mumble { say "Mumble!" } }; (-> \$_ = OUTER::<$_> { $_.mumble })(Mumbler.new())
07:36 p6eval std 77327a4: OUTPUT«[31m===[0mSORRY![31m===[0mâ�¤Unexpected block in infix position (two terms in a row, or previous statement missing semicolon?) at /tmp/mEPr__Wf87 line 1:â�¤------> [32may "Mumble!" } }; (-> \$_ = OUTER::<$_> [33mâ��[31m{ $_.mumble })(Mumbler.new())[0mâ�¤    expecting…
07:53 wtw joined #perl6
08:30 kresike joined #perl6
08:30 kresike hello all you happy perl6 people
08:36 sorear FROGGS: what GlitchMr says, you're actually supposed to remove the sigil and leave the \
08:36 sorear sleep&
08:42 Khisanth joined #perl6
08:43 GlitchMr Interesting how sleep program on my PC requires time argument
08:43 wtw joined #perl6
08:47 masak morning, #perl6
08:58 erkan joined #perl6
08:58 erkan joined #perl6
09:13 gootle joined #perl6
09:19 leont joined #perl6
09:24 wamba joined #perl6
09:30 wamba joined #perl6
10:43 Chillance joined #perl6
10:53 Chillance_ joined #perl6
10:59 cognominal joined #perl6
11:05 Su-Shee_ joined #perl6
11:06 wamba joined #perl6
11:07 kurahaupo joined #perl6
11:17 cognominal joined #perl6
11:36 mucker joined #perl6
11:40 wk_ joined #perl6
11:43 MissingSemicolon joined #perl6
11:45 masak MissingSemicolon: welcome :)
11:45 masak JavaScript programmer? :P
11:46 MissingSemicolon lol, no, just tried to think of the cleverest screen name I could. Didn't get very far with that, obviously. :-)
11:46 masak it's a fine name.
11:47 MissingSemicolon Thanks. :-) So is this the place to bring my Perl 6 programming questions, or is it more geared for p6 developers?
11:47 masak rn: say "Hey $_, Rakudo and Niecza greet you!" given <Missing Semicolon>.join
11:47 p6eval rakudo ef228d, niecza v21-15-gf226bf6: OUTPUT«Hey MissingSemicolon, Rakudo and Niecza greet you!␤»
11:48 masak MissingSemicolon: right now it's a place for both.
11:48 masak MissingSemicolon: Perl 6 is still small-and-cozy enough to have all conversations in the same cahnnel ;)
11:49 MissingSemicolon yes, I'm hoping it'll become big-and-cozy sometime soon.
11:49 masak working on that.
11:50 MissingSemicolon I've been a Perl programmer since the stone age, and I like a lot of things about Perl 6. I'm now very embarrassingly stumped on an extremely simple problem, though.
11:50 masak bring it.
11:51 MissingSemicolon To get the index of a substring, is it supposed to be $haystack.index(' needle ')?
11:52 MissingSemicolon I'm trying to skip over lines that contain a substring, and I'm doing that with:  next if $line.index('thing_i_do_not_want') == -1;
11:53 MissingSemicolon But with that I get: Parameter '' requires an instance, but a type object was passed
11:53 MissingSemicolon in method Bridge at src/gen/CORE.setting:2786
11:53 MissingSemicolon in sub infix:<==> at src/gen/CORE.setting:2709
11:53 MissingSemicolon in block  at ./exercise1a.p6:10
11:53 Su-Shee MissingSemicolon: why not use grep?
11:53 masak MissingSemicolon: probably $line was never assigned to.
11:53 masak MissingSemicolon: seems it is undefined, whatever the reason.
11:53 masak r: my $line; say $line.index('thing_i_do_not_want') == -1
11:53 p6eval rakudo ef228d: OUTPUT«No such method 'index' for invocant of type 'Any'␤  in block  at /tmp/szPuwtVKy5:1␤␤»
11:53 masak r: my $line = Str; say $line.index('thing_i_do_not_want') == -1
11:53 p6eval rakudo ef228d: OUTPUT«use of uninitialized value of type Str in string context  in block  at /tmp/jLzGprxlTz:1␤␤Parameter '' requires an instance, but a type object was passed␤  in method Bridge at src/gen/CORE.setting:2814␤  in sub infix:<==> at src/gen/CORE.setting:2737␤  in block  at…
11:54 masak that's the error, I think.
11:55 MissingSemicolon OK, but if I use
11:55 GlitchMr joined #perl6
11:56 MissingSemicolon … hang on a sec. Something strange :-)
11:57 drbean joined #perl6
11:57 cognominal joined #perl6
12:17 gongyiliao joined #perl6
12:19 MissingSemicolon rakudo: my $s = 'foobar'; say "OK" if $s.index('baz') == -1;
12:19 p6eval rakudo ef228d: OUTPUT«Parameter '' requires an instance, but a type object was passed␤  in method Bridge at src/gen/CORE.setting:2814␤  in sub infix:<==> at src/gen/CORE.setting:2737␤  in block  at /tmp/Rysur7bGGQ:1␤␤»
12:19 MissingSemicolon There's a minimal example of what I'm seeing.
12:20 MissingSemicolon Am I doing something fundamentally stupid? (quite possible!)
12:29 jnthn r: my $s = 'foobar'; say $s.index('baz).perl
12:29 p6eval rakudo ef228d: OUTPUT«===SORRY!===␤Unable to parse postcircumfix:sym<( )>, couldn't find final ')' at line 2, near "'baz).perl"␤»
12:29 jnthn grr
12:29 jnthn r: my $s = 'foobar'; say $s.index('baz').perl
12:29 p6eval rakudo ef228d: OUTPUT«Int␤»
12:29 jnthn Yeah, so I think index in Perl 6 doesn't return -1
12:29 jnthn Instead it returns an undefiend value
12:30 jnthn So you probably want
12:30 jnthn rakudo: my $s = 'foobar'; say "OK" unless defined $s.index('baz')
12:30 p6eval rakudo ef228d: OUTPUT«OK␤»
12:30 jnthn Like that
12:33 MissingSemicolon Ok, that makes sense.
12:34 MissingSemicolon Thanks!
12:39 cognominal joined #perl6
12:41 MissingSemicolon left #perl6
12:42 birdwindupbird joined #perl6
12:46 [Coke] MikeFair_: I went to bed right after posting, so it's still there. ;)
12:51 brrt joined #perl6
12:55 cognominal joined #perl6
12:56 * [Coke] finds a bunch of :pasttypes that should be :ops
12:58 [Coke] it would be helpful tracking this down if it gave me a line number on the Actions.pm when it died rather than saying only: "Error while compiling block"
12:58 jnthn if it says that, you're way past the actions
13:02 PerlJam "past the actions" ... that's almost punny  :)
13:04 masak you're way qast the actions.
13:04 [Coke] jnthn: ah, excellent. where am I? ;)
13:04 jnthn You're compiling the QAST down to PIR
13:04 jnthn What *is* the error you get?
13:05 [Coke] Error while compiling block : Error while compiling op : hash: can't use null as key
13:05 [Coke] (that after running "./partcl" and entering any command.
13:05 jnthn ah
13:05 jnthn you maybe didn't set the op
13:06 jnthn nqp: use QAST; QAST::Op.new( :pasttype('list') )
13:06 p6eval nqp: OUTPUT«Method 'pasttype' not found for invocant of class 'QAST::Op'␤current instr.: '' pc 1053 (src/stage2/QASTNode.pir:464) (src/stage2/QASTNode.nqp:54)␤»
13:06 jnthn It should do that though
13:06 jnthn Like, as soon as you instantiate it
13:06 jnthn So I'm surprised you're getting as far as you are
13:08 [Coke] found a few more :pirops...
13:08 [Coke] changed, same error.
13:10 jerome joined #perl6
13:12 [Coke] https://gist.github.com/3761375 - jnthn: various types of ops I'm using.
13:13 [Coke] I didn't see docs on the actual ops available, these are leftover or updated (incorrectly?) from the past version
13:20 masak oh! closures are moving code at runtime. macros are moving code at compile time.
13:21 PerlJam "moving code"?
13:22 [Coke] jnthn: so, there are some Ops that don't have an :op() - is that legal?
13:22 [Coke] (some have only a :name() - should those have :op<call> also?
13:24 masak PerlJam: closures are first-class function values. so you can put it in your bag and steal away with it in the night.
13:25 sirrobert Can I export an enum?
13:25 sirrobert how do I reference it in the outer namespace?
13:26 sirrobert outer=remote
13:28 sirrobert figured it out... enum Foo is export <X Y Z>;  elsewhere:  Foo::X
13:29 colomon phenny: tell TimToady I'm having a hard time getting comfortable with the name is-prime, because it feels like it promises something it cannot deliver.  Should it be is-likely-prime?  is-known-composite?
13:29 phenny colomon: I'll pass that on when TimToady is around.
13:29 flussence reading the backscroll gave me an idea: a lot of cryptic errors/warnings come from unexpected undefinedness - maybe it'd be useful to show datatypes (Mu, Any) in the backtrace
13:31 arnsholt Sounds like a good idea to me
13:32 masak sirrobert: um. I think X should also be visible as-is.
13:32 PerlJam colomon: ha! http://irclog.perlgeek.de/​perl6/2012-09-20#i_6004806
13:32 masak sirrobert: dunno if implemented, though.
13:32 colomon PerlJam: glad to see I'm not alone.  :)
13:33 PerlJam colomon: however, later ... http://irclog.perlgeek.de/​perl6/2012-09-20#i_6004983
13:33 sirrobert masak:  X wasn't visible, but it was visible scoped
13:33 sirrobert err namespaced
13:34 masak sirrobert: yeah. I'm thinking of Bool::True and True as an example.
13:34 sirrobert I wonder why that works and this doesn't?
13:35 leprevost joined #perl6
13:37 masak because Bool isn't a real enum?
13:37 masak as implemented, I mean.
13:37 colomon PerlJam: I guess I'm guilty as charged as being wary of probabilistic algorithms.  but citing 4 ** -100 is cheating -- default error rate is 4 ** -10, no?
13:37 sirrobert fair enough =)
13:38 masak I dunno how close Niecza got with this, but I know Rakudo didn't get all the way there, and neither of the main implementors were happy about Bool being an enum.
13:38 masak r: say (class A {}).HOW.WHAT
13:38 p6eval rakudo ef228d: OUTPUT«Perl6::Metamodel::ClassHOW()␤»
13:38 masak r: say (enum E <a b>).HOW.WHAT
13:38 p6eval rakudo ef228d: OUTPUT«Perl6::Metamodel::EnumHOW()␤»
13:39 masak r: say Bool.HOW.WHAT
13:39 p6eval rakudo ef228d: OUTPUT«Perl6::Metamodel::ClassHOW()␤»
13:39 masak yeah.
13:43 sirrobert masak: I still haven't gotten a feel for how I should think about "HOW"
13:43 masak hehe.
13:44 masak I don't blame you. :)
13:44 masak I remember staring dumbfounded at au++'s MOP diagram back in the day, thinking "this is all very nice, but do I really need a metaphysics for my objects?"
13:44 sirrobert heh
13:45 arnsholt That'd be a great title for a Perl 6 parallel to The art of meta-object protocol. "The metaphysics of objects" =D
13:45 masak well, think of it this way: somewhere in Rakudo there is code to tell Perl 6 how to lay out attributes, how to do method lookup, how inheritance works.
13:46 masak having a MOP in the first place means you expose those details to a greater or smaller extent.
13:46 jnthn [Coke]: er, that sounds bad
13:46 jnthn [Coke]: yes, they totaly should have :op<call>
13:46 sirrobert masak: makes sense
13:46 masak the .HOW (and .^) is how you start talking about that API.
13:47 masak sirrobert: turns out OO is a great fit for implementing a MOP :)
13:48 masak which is when you get into the whole metacircularity whirlpool.
13:48 masak r: say (class A {}).WHAT
13:48 p6eval rakudo ef228d: OUTPUT«A()␤»
13:48 masak r: say (class A {}).HOW.WHAT
13:48 p6eval rakudo ef228d: OUTPUT«Perl6::Metamodel::ClassHOW()␤»
13:48 masak r: say (class A {}).HOW.HOW.WHAT
13:48 p6eval rakudo ef228d: OUTPUT«No such method 'gist' for invocant of type 'NQPClassHOW'␤  in sub say at src/gen/CORE.setting:7173␤  in block  at /tmp/flhmjZl_D7:1␤␤»
13:48 masak r: say (class A {}).HOW.HOW.HOW.WHAT
13:48 p6eval rakudo ef228d: OUTPUT«No such method 'gist' for invocant of type 'KnowHOW'␤  in sub say at src/gen/CORE.setting:7173␤  in block  at /tmp/k5Nhxk5MbJ:1␤␤»
13:48 masak r: say (class A {}).HOW.HOW.HOW.HOW.WHAT
13:48 p6eval rakudo ef228d: OUTPUT«No such method 'gist' for invocant of type 'KnowHOW'␤  in sub say at src/gen/CORE.setting:7173␤  in block  at /tmp/RFQnPolDpx:1␤␤»
13:48 masak it's KnowHOW's all the way down from there.
13:48 arnsholt These bits are relevant to what makes Zavolaj tick, incidentally
13:48 bluescreen10 joined #perl6
13:49 masak arnsholt: because of reprs, I presume.
13:49 arnsholt Because repr, yeah
13:50 [Coke] nqp: use QAST; new QAST::Op( :name<eek> );
13:50 p6eval nqp: OUTPUT«Confused at line 2, near "new QAST::"␤current instr.: 'panic' pc 19999 (src/stage2/gen/NQPHLL.pir:7315) (src/stage2/gen/NQPHLL.pm:324)␤»
13:50 [Coke] nqp: use QAST; QAST::Op.new( :name<eek> );
13:50 p6eval nqp:  ( no output )
13:51 jnthn Maybe we should make that complain somehow.
13:51 [Coke] jnthn: so, should that barf, then?
13:51 [Coke] barfing sooner than later is boss.
13:51 jnthn [Coke]: It'd certainly be more helpful if it did
13:54 Guest29702 joined #perl6
13:55 [Coke] jnthn: now I'm getting Error while compiling block : Error while compiling op call: Can only use get_how on a SixModelObject
13:55 [Coke] so, a naive translation is not working. I'll have to do more than a global search and replace, so that means: the weekend.
13:55 [Coke] (unless someone beats me to it. ;)
13:56 jnthn [Coke]: That may mean there's a PAST node in the tree
13:56 jnthn Or an undef or a literal
13:56 jnthn Note that literals must be an IVal, NVal or SVal now
13:56 jnthn Not put directly as a child
14:00 brrt left #perl6
14:01 imarcusthis joined #perl6
14:02 brrt joined #perl6
14:04 stopbit joined #perl6
14:06 FROGGS joined #perl6
14:06 flightrecorder joined #perl6
14:10 PacoAir joined #perl6
14:23 fm_ joined #perl6
14:26 muu joined #perl6
14:47 sirrobert is there an operator (or method?) to compare if two hashes have the same keys and values?
14:47 sirrobert I only need shallow comparison, but deep is cool too
14:48 tadzik Test.pm does that in is_deeply
14:49 sirrobert great, thanks (using it in a test)
14:49 masak eqv should do that.
14:49 masak rn: say { foo => 1, bar => 2 } eqv { bar => 2, foo => 1 }
14:49 p6eval rakudo ef228d, niecza v21-15-gf226bf6: OUTPUT«True␤»
14:49 sirrobert rn: say { foo => 1, bar => 2 } eqv { bar => 2, foo => 5 }
14:49 p6eval rakudo ef228d: OUTPUT«False␤»
14:49 p6eval ..niecza v21-15-gf226bf6: OUTPUT«True␤»
14:50 * masak submits nieczaissue
14:50 sirrobert sad path =)
14:50 masak sirrobert++
14:55 colomon rn: say { foo => 1, bar => 2 } cmp  { bar => 2, foo => 5 }
14:55 p6eval niecza v21-15-gf226bf6: OUTPUT«Same␤»
14:55 p6eval ..rakudo ef228d: OUTPUT«Decrease␤»
14:55 colomon actual bug is in cmp, I think
14:56 * masak adds that to the issue
14:56 * colomon wishes he had TextMate on Linux.
15:01 colomon .... errr, how does one determine Hash cmp Hash?  does the question even make sense?
15:02 jnthn .oO( maybe if you've had enough hash... )
15:02 jnthn I'm not sure increase vs decrease does though
15:03 skids joined #perl6
15:06 sirrobert if:  class A { method foo {"Hallo!"} }; my $mtd = 'foo';
15:06 arnsholt I'd argue that Hash cmp Hash doesn't really make sense
15:06 sirrobert how do I do:  say A.new.$mtd;
15:06 masak I don't really see the problem.
15:06 masak at the first differing key (sorted lexographically), there's bound to be a well-defined ordering.
15:06 masak sirrobert: A.new."$mtd"()
15:07 sirrobert ah, thanks (was missing the () in my tries)
15:07 arnsholt Hmm. masak's idea might work
15:07 arnsholt masak++ # More cleverer than me =)
15:08 arnsholt I'm not sure if it'd be a useful ordering over hashes, but it's workable
15:08 arnsholt It depends on there being an ordering over the keys though, which might not hold for non-Str keys
15:09 sisar joined #perl6
15:09 sisar masak++ #release
15:12 masak arnsholt: troo. it feels a little weird to base any feature of a hash on ordering of its keys.
15:19 arnsholt I guess. I'm not sure we'd really want to make two hashes comparable just for the sake of making them comparable
15:19 kresike bye folks
15:22 flussence I can't say I've ever wanted a built in feature for that in any language
15:22 GlitchMr rn: say { bar => 2, foo => 5} cmp { foo => 1, bar => 2 }
15:22 p6eval rakudo ef228d: OUTPUT«Increase␤»
15:22 p6eval ..niecza v21-15-gf226bf6: OUTPUT«Same␤»
15:23 GlitchMr Wait... why those hashes can be compared? Let me guess, string conversion?
15:23 GlitchMr Hmmm...
15:23 GlitchMr rn: say { bar => 2, foo => 5} cmp { foo => '5', bar => 5.0 }
15:23 p6eval rakudo ef228d: OUTPUT«Increase␤»
15:23 p6eval ..niecza v21-15-gf226bf6: OUTPUT«Same␤»
15:23 GlitchMr rn: say { bar => 2, foo => 5} cmp { foo => '5', bar => 2.0 }
15:24 p6eval rakudo ef228d: OUTPUT«Increase␤»
15:24 p6eval ..niecza v21-15-gf226bf6: OUTPUT«Same␤»
15:24 GlitchMr rn: say { bar => 2, foo => 5} cmp { bar => 2.0, foo => '5'}
15:24 p6eval rakudo ef228d, niecza v21-15-gf226bf6: OUTPUT«Same␤»
15:24 GlitchMr rn: say { bar => 2, foo => 5} eqv { bar => 2.0, foo => '5'}
15:24 p6eval rakudo ef228d: OUTPUT«False␤»
15:24 p6eval ..niecza v21-15-gf226bf6: OUTPUT«True␤»
15:25 TimToady colomon: wikipedia claims: If n is composite then the Miller–Rabin primality test declares n probably prime with a probability at most 4 ** -k. On the other hand, the Solovay–Strassen primality test declares n probably prime with a probability at most 2 ** -k.
15:25 phenny TimToady: 13:29Z <colomon> tell TimToady I'm having a hard time getting comfortable with the name is-prime, because it feels like it promises something it cannot deliver.  Should it be is-likely-prime?  is-known-composite?
15:25 TimToady and we're defaulting to 100 tests
15:25 TimToady so maybe you're thinking of SS instead of MR?
15:26 colomon no, I'm just not comfortable with naming the "is very likely prime" function is-prime.  :)
15:26 GlitchMr When it makes invalid results anyways?
15:27 TimToady anyway, as for the name, if the probability is much larger that a cosmic ray is going to flip a bit in your memory, then all our functions should have "likely" in the name
15:27 fhelmberger joined #perl6
15:28 GlitchMr Also, low primes could be hardcoded?
15:28 TimToady and are, in libtommath
15:29 TimToady so I'd feel uncomfortable saying "is likely prime" when we know for sure :)
15:30 TimToady modulo cosmic rays
15:33 * TimToady has been running his longest left truncating prime program in niecza again for more than 24 clock hours (4500 cpu minutes) just to see if it blows up again in the same place, of if the first blowup was a cosmic ray :)
15:33 sisar joined #perl6
15:33 GlitchMr That's waste of CPU, but whatever
15:34 * TimToady hopes that when is-prime gets into rakudo it can run this faster, and maybe more correctly, since my last rakudo run with a Perl 6 MR test was producing some incorrect results
15:34 GlitchMr Using IRC is waste of CPU too
15:34 TimToady GlitchMr: not a waste at all, it heats up my house quite efficiently
15:34 GlitchMr oh, ok
15:34 huf small house or huuuuge irc?
15:34 TimToady with 100% efficiency, in fact
15:34 TimToady not the irc, that wastes some heat outside the house
15:35 TimToady the ltp algo
15:36 colomon back when I was single (and in Michigan, mind you), I didn't notice that my heat wasn't working one winter for about a month because my computers were generating enough heat to keep me comfortable.
15:37 huf ... what
15:37 huf i cant even imagine that
15:37 benabik I can.  In my college dorms in upstate NY, we regularly had the window open in the middle of winter to handle computer heat.
15:38 huf i've already had a morning when i considered turning the heat on
15:38 huf and it's only september
15:38 TimToady a 1 in one novemdecillion, six hundred six octodecillion, nine hundred thirty eight septendecillion, forty four sexdecillion, two hundred fifty eight quindecillion, nine hundred ninety quattuordecillion, two hundred seventy five tredecillion, five hundred forty one duodecillion, nine hundred sixty two undecillion, ninety two decillion, three hundred forty one nonillion, one hundred sixty two octillion, six hundred two septillion, five hundred twenty two sext
15:39 colomon benabik: of course, one of my buddies had the same issue in his dorm back in the mid-80s.  they just kept the dorm's heat way too high.  :)
15:39 sirrobert I often kept a box fan blowing cold (snowy-cold) air into my dorm
15:40 brrt joined #perl6
15:40 sirrobert I had hot-water pipes running through three of my walls in the dorm =)  (well, two walls and the floor)
15:41 arnsholt TimToady: Do you happen to know what pieces are missing to get is-prime from tommath in Rakudo?
15:41 TimToady moritz++ already has a patch, I believe
15:41 arnsholt Ah, cool. Then I won't duplicate his efforts
15:42 TimToady didn't apply it before release though, sanely enough...
15:42 arnsholt Probably not a bad idea
15:42 * TimToady is not always in favor of sanity :)
15:43 colomon rn: my $a = set 4, 5, 6; say $a.keys.sort
15:43 p6eval rakudo ef228d, niecza v21-15-gf226bf6: OUTPUT«4 5 6␤»
15:44 skids pfeh.  Obviously we need to develop CPUs that have a heating CoP over 1.  But then we'd have to find a way to connect them to the outdoor air or groundwater..
15:44 araujo joined #perl6
15:44 araujo joined #perl6
15:44 TimToady we should invent CPUs that run faster when you put a blowtorch on them...
15:47 sirrobert in HS I had a DX2-66mhz.  The fan fell off the CPU, so it kept slowing and stopping after (fairly short) intervals.  my brother and I ended up keeping ice cube trays in the freezer and putting ice in zip-lock bags to lay on the CPU to keep it cool =)
15:48 colomon rn: my $a = set <a b c>; say $a.keys.sort
15:48 p6eval rakudo ef228d, niecza v21-15-gf226bf6: OUTPUT«a b c␤»
15:49 GlitchMr sirrobert: makes sense :-)
15:49 GlitchMr But isn't "ice cube" water?
15:49 leprevost joined #perl6
15:49 sirrobert that's why we used the plastic bags =)
15:49 sirrobert (and put a paper-towel around the bag, but that was just an implementation detail... I don't think they ever got wet
15:51 jerome joined #perl6
15:57 jevin joined #perl6
16:00 * colomon 's happily productive morning has been derailed by trying to figure out how to make Niecza's cmp handle hashes.
16:03 mucker joined #perl6
16:11 prammer
16:17 kaare_ joined #perl6
16:20 jerome joined #perl6
16:20 MayDaniel joined #perl6
16:25 zby_home joined #perl6
16:37 birdwindupbird joined #perl6
16:59 jerome joined #perl6
17:14 xinming_ joined #perl6
17:18 cognominal joined #perl6
17:22 wamba joined #perl6
17:50 tgt joined #perl6
18:05 TimToady yup, mono crashed again at about the same place.  apparently arbitrary precision integers are not so arbitrary.  or it's just a bug that shows up when integers start to get arbitrary...
18:07 * TimToady now waits patiently(?) for is-prime to show up in rakudo
18:19 fm_ joined #perl6
18:22 sirrobert joined #perl6
18:22 gongyiliao joined #perl6
18:26 diakopter TimToady: it might need some refactoring har har
18:28 diakopter TimToady: incorrect results are incorrect
18:28 TimToady well, one reason I'm waiting is that the current is-prime written in Perl 6 may not work right under rakudo; my program is consistently getting the wrong answer for every base 8 or higher
18:28 TimToady on rakudo, that is
18:29 TimToady niecza works up till the blowup at base 18
18:29 TimToady so if I replace is-prime, that might show where the bug is
18:29 TimToady as a first divide and conquer step
18:30 * TimToady wonders what is different between base 7 and base 8
18:31 TimToady in every case it stops too soon, so it must be calling something composite that is actually prime, or it's not generating all the possibilities to begin with
18:33 diakopter maybe it's related to one of the integer overflow bugs
18:34 TimToady could well be
18:38 TimToady I could probably match against the correct answers and see which pass loses the truncated substring of the correct answer
18:38 cognominal joined #perl6
18:38 diakopter how do you know the correct answers?
18:38 TimToady and in fact that technique might isolate to a single calculation
18:39 TimToady http://rosettacode.org/wiki/Talk:Find_larg​est_left_truncatable_prime_in_a_given_base
18:39 TimToady those answer check for all the cases I've been able to check under niecza
18:39 TimToady *swers
18:40 diakopter Microsoft's MS-PL BigInteger.cs++
18:40 TimToady which is everything up to base 23 except for 18
18:41 * TimToady is just a bit chagrined that ruby can calculate the base 18 case and Perl 6 can't yet
18:42 TimToady the bug could also be that correct answer is in the finalists but the sort isn't sorting it to the front correctly
18:43 * [Coke] sees that java calls is-prime isProbablePrime().
18:45 TimToady the finalists do not contain the correct answer, so it's not being generated
18:45 TimToady [Coke]: and we should take our design decisions from Java because they got it all right, eh?  :)
18:48 * [Coke] refuses to respond to the trollbait.
18:50 diakopter but it's so enticing
18:59 cognominal joined #perl6
19:13 wk joined #perl6
19:26 kurahaupo joined #perl6
19:26 masak evenin', #perl6
19:26 colomon \o
19:42 wk joined #perl6
19:42 sorear good * #perl6
19:44 [Coke] hio.
19:47 fgomez joined #perl6
19:53 colomon o/
19:55 colomon sorear: any idea why adding https://gist.github.com/3763534 to infix:<cmp> makes it blow sky-high when you try to compare two hashes?  error message is "System.InvalidOperationException: Comparison threw an exception. ---> Numeric failed to return core numeric type"
19:59 [Coke] n: my %hash; say +%hash;
19:59 p6eval niecza v21-15-gf226bf6: OUTPUT«0␤»
19:59 [Coke] I presume cmp is cheating. :)
20:00 colomon [Coke]: if you look at the gist, you'll see my attempt to support comparing hashes.  but it doesn't work. :(
20:00 sorear n: say 1 cmp 3
20:00 p6eval niecza v21-15-gf226bf6: OUTPUT«Increase␤»
20:01 colomon I think the error is happening in the sort call, but I've no clue why.
20:01 sorear colomon: if you get to the end of the for loop in the gist, what does cmp return?
20:01 colomon errr.... good question
20:02 colomon adding a return and trying again.
20:02 sorear a return Same; I hope
20:02 colomon based on the full error message I don't think that's the issue, but it certainly was wrong the way I had it.
20:03 sorear n: say Nil.Numeric
20:03 p6eval niecza v21-15-gf226bf6: OUTPUT«0␤»
20:03 colomon n: say set("foo", "bar").keys.sort
20:03 p6eval niecza v21-15-gf226bf6: OUTPUT«bar foo␤»
20:03 colomon if I do that with my cmp-hash patch in, I get the error
20:04 sorear n: say set("foo","bar").keys.WHAT
20:04 p6eval niecza v21-15-gf226bf6: OUTPUT«List()␤»
20:04 sorear n: say set("foo","bar").keys>>.WHAT
20:04 p6eval niecza v21-15-gf226bf6: OUTPUT«Str() Str()␤»
20:05 sorear out of curiousity could you gist the output of "git diff"?  I'd like to see your addition in context
20:05 sorear n: say 0 + Nil
20:05 p6eval niecza v21-15-gf226bf6: OUTPUT«0␤»
20:06 sorear n: say 0 + any("foo","bar")
20:06 p6eval niecza v21-15-gf226bf6: OUTPUT«Unhandled exception: Cannot parse number: foo␤  at /home/p6eval/niecza/lib/CORE.setting line 1435 (die @ 5) ␤  at /home/p6eval/niecza/lib/CORE.setting line 3525 (ANON @ 11) ␤  at /home/p6eval/niecza/lib/CORE.setting line 3527 (NumSyntax.str2num @ 5) ␤  at …
20:06 sorear n: say 0 + set("foo","bar")
20:06 p6eval niecza v21-15-gf226bf6: OUTPUT«2␤»
20:06 colomon https://gist.github.com/3763594
20:08 masak rn: say 0 + set("foo", "foo")
20:08 p6eval rakudo ef228d, niecza v21-15-gf226bf6: OUTPUT«1␤»
20:10 sorear n: say set(<foo bar>).sort
20:10 p6eval niecza v21-15-gf226bf6: OUTPUT«bar foo␤»
20:10 sorear n: say set(<foo bar>).keys.sort
20:10 p6eval niecza v21-15-gf226bf6: OUTPUT«bar foo␤»
20:11 sorear n: say set(<1 2>).keys.sort
20:11 p6eval niecza v21-15-gf226bf6: OUTPUT«1 2␤»
20:11 sorear n: say "foo" ~~ Hash
20:11 p6eval niecza v21-15-gf226bf6: OUTPUT«False␤»
20:14 moritz \o
20:14 sorear o/ moritz
20:15 sorear colomon: I just applied this loc ally and it breaks for me
20:16 sorear ... and it just stopped breaking
20:18 colomon ?
20:18 sorear colomon: it's consistant.  THe "Numeric failed to return core numeric type" occurs if and only if the setting was recompiled in the same run of niecza
20:19 sorear if you rerun your test without changing the setting, it will work.
20:26 sorear colomon: I can reproduce this without your patch:
20:26 sorear $ echo >> lib/CORE.setting
20:26 sorear $ mono run/Niecza.exe --obj-dir=obj -e 'say ["foo", "bar"].sort'
20:26 sorear [auto-compiling setting]
20:26 sorear [done]
20:26 sorear Unhandled exception: System.InvalidOperationException: Comparison threw an exception. ---> Numeric failed to return core numeric type
20:27 colomon it's not my fault!  \o/
20:27 colomon unless, of course, it's because of something I did earlier.  ;)
20:29 moritz bisect can tell, no?
20:32 moritz btw I have a local rakudo path for expmod and is-prime, haven't gotten around to test it
20:32 moritz will do tomorrow, and then push
20:34 cognominal joined #perl6
20:36 jnthn moritz: yay :)
20:37 [Coke] I bet if you stick it somewhere, larry will test it. he seems pretty eager.
20:37 [Coke] ... almost hyper
20:37 moritz oh well, it's after the release, I can afford to break nom for half a day :-)
20:37 jnthn but racing for it would be out of order :P
20:38 dalek nqp: c458a08 | moritz++ | src/ (2 files):
20:38 dalek nqp: make Rabin-Miller prime check available as nqp::isprime_I
20:38 dalek nqp:
20:38 dalek nqp: also special-case 1 not to be a prime
20:38 dalek nqp: review: https://github.com/perl6/nqp/commit/c458a08a72
20:38 jnthn moritz: I can run a spectest
20:39 * jnthn has the next two weeks off o/
20:39 sorear moritz: bisect requires a good revision
20:39 Circlepuller joined #perl6
20:39 sorear this has been broken for much longer than I thought and I'm having trouble finding a revision where it worked
20:39 popl joined #perl6
20:39 dalek rakudo/nom: 2e33656 | moritz++ | / (3 files):
20:39 dalek rakudo/nom: add expmod and is-prime
20:39 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/2e336562bd
20:40 masak moritz++
20:41 masak moritz: is it because of libtommath that mp_prime_is_prime reports 1 as prime?
20:41 masak moritz: would they consider it a bug if we told them?
20:42 moritz masak: I don't know, which is why I haven't done it yet
20:43 moritz masak: it claims to implement the rabin-miller prime test, not to check if something is a prime
20:43 * jnthn has kicked of a build/spectest
20:44 sorear found a good rev.  kicking off a bisect
20:45 masak \o/
20:45 masak manual or with a script?
20:46 sorear script
20:50 sorear remarkably, this is the first time I have used git bisect
20:50 moritz you usually just don't regress stuff :-)
20:56 moritz $ ./perl6 -e 'say (1..100).grep: *.is-prime'
20:56 moritz 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
20:56 moritz looks better than before :-)
20:56 Tene why .is-prime instead of just .prime I wonder ?
20:56 sorear .prime-p
20:57 moritz Tene: maybe to not confuse it with "find the $nth prime"?
20:57 Tene Hmm.
20:57 moritz PrimeQ # in Mathematica
20:57 sorear my $funky = 42 but Prime;
21:00 sorear std: 1 =< 2
21:00 p6eval std 77327a4: OUTPUT«[31m===[0mSORRY![31m===[0m�Unable to parse quote words at /tmp/0GmRNw2zTA line 1:�------> [32m1 =[33m�[31m< 2[0m�Couldn't find final '>'; gave up at /tmp/0GmRNw2zTA line 1 (EOF):�------> [32m1 =< 2[33m�[31m<EOL>[0m�Parse failed�FAILED 00:00 42m�»…
21:00 moritz sorear: I was about to do that too :-)
21:00 moritz eval: 1 =< 2
21:00 buubot_backup moritz: ERROR: Unterminated <> operator at (eval 20) line 1.
21:01 sorear 13:58 <@LeoNerd> Whomever is responsible for   eval: 2 =< 4   giving     Reversed <= operator at (eval 1830) line 1. ERROR:  Unterminated <> operator at (eval 1830) line 1.    I will buy  you a beer :)
21:01 * moritz -> sleep
21:02 [Coke] moritz++
21:02 [Coke] "sleep well, and dream of large numbers."
21:03 sorear bisect blames 3d9f4b463b37ad13de9addc6e793bc3372af846b
21:03 spider-mario joined #perl6
21:04 * masak smiles at the "sleep well and dream of X" meme being picked up
21:04 sorear I'll poke more at this later
21:04 sorear dayjob&
21:05 * masak .oO( sorear has a *job* now!? )
21:05 masak clearly I haven't been keeping up.
21:05 colomon me neither!
21:08 jnthn moritz: spectest looks good :)
21:10 [Coke] O_o
21:13 [Coke] Meme? Why didn't you list among our assets in the first place?
21:14 tgt joined #perl6
21:16 * masak ducks "why didn't you list among our assets" and gets the weirdest webcomic
21:17 [Coke] list *that
21:19 [Coke] masak: it's from the princess bride.
21:19 masak oh, princ... right.
21:19 masak I need to re-watch that movie :)
21:20 [Coke] masak: which is also where your meme is from, btw. :P
21:20 [Coke] at least in my version of your meme.
21:23 wamba joined #perl6
21:24 masak so it seems.
21:25 masak I can honestly say that I wasn't thinking of the movie when I started using the meme on the channel.
21:25 sorear .oO( "my name is S.J.Gould" )
21:25 masak but I'm not too disappointed of it containing prior art -- it contains a lot of nice stuff :)
21:25 PerlJam does that mean that people are going to start saying "as you wish" rather than give hugs?
21:26 [Coke] Good night, #perl6. I'll most likely kill you in the morning.
21:26 masak PerlJam: ;)
21:27 masak anybody want a peanut?
21:27 popl This is how the world ends.
21:28 PerlJam popl: But I haven't been Dread Pirate Roberts yet
21:29 popl s/r/w/g
21:29 popl PerlJam: I always hear it in Andre's voice.
21:30 popl Excuse me, Mr. the Giant.
21:30 PerlJam :-)
21:31 HarryS joined #perl6
21:44 wamba joined #perl6
21:46 raiph joined #perl6
22:05 raiph phenny, tell moritz: there's a typo in https://github.com/moritz/ilbot/b​lob/master/cgi/template/day.tmpl -- "<TMPL_UNLESS NAME=IS_SUMAMRY>" tried to fix and pull request via github but there's something going on that seems to break when i try.
22:05 phenny raiph: I'll pass that on when moritz is around.
22:19 fgomez joined #perl6
22:29 HarryS joined #perl6
22:45 masak 'night, #perl6
22:49 fgomez joined #perl6
22:55 Guest29702 joined #perl6
23:09 whiteknight joined #perl6
23:18 snearch joined #perl6
23:28 timotimo i made a code to calculate the intersection of two lines and i failed horribly :\
23:30 shachaf timotimo: ?
23:33 timotimo i dunno what went wrong, but the coordinates of the intersections are on neither of the lines
23:33 timotimo and i didn't come up with proper tooling to see in what way it went wrong :|
23:34 skids joined #perl6
23:41 raiph timotimo: are you using jnthn's debugger yet?
23:43 timotimo oh! OH!
23:43 timotimo should have totally done that
23:48 timotimo still doesn't help me see what's happened ;)
23:48 timotimo it's probably my formula that's wrong or something
23:49 mdupont joined #perl6

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo