»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg p6eval perl6: ... | irclog: irc.perl6.org/ | UTF-8 is our friend!
Set by sorear on 4 February 2011.
masak so, I solved the Sierpinski mini-challenge: gist.github.com/4600143 00:00
I'm pretty sure this is the trickiest recursion problem I've solved.
it's not so much that it's *hard*, it's that there are many loose ends, and I ended up being very aware of both parameters and return values. 00:01
if anyone spots any simplification, I'd be happy to hear it.
shachaf What is the Sierpinski mini-challenge? 00:02
masak irclog.perlgeek.de/perl6/2013-01-22#i_6364169 00:05
00:07 orafu left, orafu joined
lue hello o/ 00:08
masak or, to put it differentely, the final solution consists of two mutually recursive routines, each with three inputs and two outputs, some of which are higher-order functions. :) 00:09
lue! \o/
timotimo philippe.bruhat.net/stuff/git-fractals/ whhhyyyyyyyyyyyyyy?
masak yeah, that's the stuff.
oh, 404 :/
BooK: ping. see irclog.perlgeek.de/perl6/2013-01-22#i_6364169 and gist.github.com/4600143 :) 00:10
BooK: (and if you don't pong, I'm going to mail you a summary) :)
timotimo (archive org has it)
web.archive.org/web/20120310215139/...t-fractals
oh, but it doesn' thave the sierpinski yet at that date. hold on
lue just read jnthn's gist earlier. It sounds like a nice idea.
timotimo huh. it *does*! 00:11
web.archive.org/liveweb/http://gg.j...git/sierp/ - here you can apparently find the implementation for git
00:12 fgomez left, fgomez joined
masak timotimo: hm, that appears to be a recursive solution. 00:13
if I'm reading it right, though, it creates somewhat different triangles.
too tired to understand it in detail :)
lue question: would jnthn's change remove the (imo weird) .[] forms?
masak if my memory serves me, BooK couldn't figure out a recursive solution, and that's why I tried.
timotimo you should publish a paper :) 00:14
masak I might write it up as a blog post. 00:16
lue: no.
lue: what's weird about them? .[] is to $obj.[] as .method is to $obj.method (with the dot in '$obj.[]' being optional)
lue: I like writing stuff like `say "%s-%s-%s", .[1], .[2], .[0] given @values` 00:17
lue I guess I don't conceptualize [] and {} as method names
masak er `say sprintf "%s-%s-%s", .[1], .[2], .[0] given @values` 00:18
lue Ah. I was just about to say I can't recall ever seeing .[] be used, and thus if it's even necessary. Nevermind :)
masak lue: they're not. postcircumfix:<[ ]> and postcircumfix:<{ }> are the method names.
the .[] and .{} forms are sugar.
anyway. past my bedtime. 00:19
'night, #perl6
timotimo when exactly do you need the .[] and .{} forms?
i think i've only seen that once so far
lue good ♞, masak o/
timotimo: see masak above.
timotimo oh, i get it 00:20
that's kind of smart
00:20 benabik joined
lue But in the usual use of subscripts, @array.[0] is time wasted on another keypress :) 00:21
timotimo right
lue r: my @a = <a b c>; say sprintf "%s-%s-%s", @a[0] # haven't seen this in a while 00:23
p6eval rakudo a26956: OUTPUT«Null PMC access in get_string()␤ in sub sprintf at src/gen/CORE.setting:2429␤ in block at /tmp/g6gzDCvevT:1␤␤»
timotimo huh? 00:25
oh, the null pmc access?
lue yep. Can't remember that last time I ran across one myself. 00:27
The cause is obvious, it just shouldn't be a Parrot message (at least I would think).
timotimo why does --profile output no information whatsoever? :(
benabik IIRC, it doesn't output on a non-zero exit. 00:28
00:28 fgomez left
timotimo aaaaaaw man 00:29
00:29 Guest80864 left 00:33 kivutar left
timotimo trying to figure out what takes panda 3 seconds to start up in order to display the usage 00:35
00:43 fgomez joined 00:44 atrodo left 00:49 atrodo joined 01:03 alec__ is now known as alec 01:05 anuby joined 01:12 hypolin joined 01:27 autumn is now known as subroutine 01:29 aindilis` left, subroutine is now known as autumn 01:41 benabik left, stevan_ joined 01:42 stevan_ left 01:44 dduncan joined, dduncan left, benabik joined 01:45 araujo joined, araujo left, araujo joined 01:52 dayangkun left 01:56 stevan_ joined 02:00 donghongbo joined 02:29 aindilis joined 02:36 xenoterracide left, xenoterracide joined
timotimo oh, the hmac specification is pretty short 02:42
02:45 swarles joined
swarles Can anyone tell me if I'm using the '!' negation correctly here? My comments should say what I'm trying to match well enough if the name of the token isn't already self explanatory. pastebin.com/2ZgYJJDn 02:45
timotimo did you try the rakudo-debugger yet? 02:46
flussence r: q{'\\'} ~~ / "'" [ [! [ "'" | "\\" ] ] | "\\" . ]* "'" /; 02:47
p6eval rakudo a26956: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter ! (must be quoted to match literally)␤at /tmp/jPqE_9AXEe:1␤------> q{'\\'} ~~ / "'" [ [⏏! [ "'" | "\\" ] ] | "\\" . ]* "'" /;␤Unrecognized regex metacharacter [ (must be quoted to ma…
swarles no, I'm under Windows. I need to get around to setting up an environment
flussence computer says no
swarles oh :(
timotimo is trying to install it right now
flussence: :D
there's also grammar::debugger i think 02:48
flussence r: q{'\\ \n'} ~~ / \' ~ \' [ '\\' . | . ] /;
p6eval rakudo a26956: OUTPUT«Unable to parse expression in ; couldn't find final \'␤ in any FAILGOAL at src/stage2/QRegex.nqp:1038␤ in regex at /tmp/BMaKlMLA2E:1␤ in method ACCEPTS at src/gen/CORE.setting:10731␤ in block at /tmp/BMaKlMLA2E:1␤␤»
flussence hrm
r: q{'\\ \n'} ~~ / ' ~ ' [ '\\' . | . ] /;
p6eval rakudo a26956: ( no output )
flussence r: say q{'\\ \n'} ~~ / ' ~ ' [ '\\' . | . ] /;
p6eval rakudo a26956: OUTPUT«#<failed match>␤»
flussence bah.
r: say q{'\\ \n'} ~~ / "'" ~ "'" [ '\\' . | . ] /;
p6eval rakudo a26956: OUTPUT«Unable to parse expression in ; couldn't find final "'"␤ in any FAILGOAL at src/stage2/QRegex.nqp:1038␤ in regex at /tmp/oYbcitYAUY:1␤ in method ACCEPTS at src/gen/CORE.setting:10731␤ in block at /tmp/oYbcitYAUY:1␤␤»
swarles r: "'hello \''" ~~ /"'"[<!['\\]>|"\\".]*"'"/ 02:49
p6eval rakudo a26956: ( no output )
swarles r: say "'hello \''" ~~ /"'"[<!['\\]>|"\\".]*"'"/
p6eval rakudo a26956: OUTPUT«「''」␤␤»
timotimo the <!['\\]>|"\\".]* is skipping "hello" completely 02:52
02:53 FROGGS_ joined
timotimo i made an endless recursion i think 02:53
r: say "'hello \''" ~~ /"'"[<![a..z A..Z]>|"\\".]*"'"/
p6eval rakudo a26956: OUTPUT«(timeout)» 02:54
02:54 swarles left
timotimo i don't know anything about perl6 regex syntax :| 02:55
flussence okay, I think I'm going insane here... I'm getting an error that makes no sense
r: say q{'quoted string'} ~~ / "'" ~ "'" /
p6eval rakudo a26956: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter ~ (must be quoted to match literally)␤at /tmp/YcF8pog68P:1␤------> say q{'quoted string'} ~~ / "'" ~ "'" ⏏/␤Unable to parse regex; couldn't find final '/'␤at /tmp/YcF8pog68P:1␤------…
flussence r: say q{'quoted string'} ~~ / "'" ~ "'" .* / 02:56
p6eval rakudo a26956: OUTPUT«Unable to parse expression in ; couldn't find final "'"␤ in any FAILGOAL at src/stage2/QRegex.nqp:1038␤ in regex at /tmp/e5srqWSbow:1␤ in method ACCEPTS at src/gen/CORE.setting:10731␤ in block at /tmp/e5srqWSbow:1␤␤»
flussence oh, that... doesn't make much more sense.
LTA on the first one though 02:57
02:57 FROGGS left
benabik LTA error on both, I think. 02:58
Well, especially since the second should succeed? 02:59
flussence yeah... looks okay to me :/
benabik NYI?
flussence r: say q{'quoted string'} ~~ / \' ~ \' .* /
p6eval rakudo a26956: OUTPUT«Unable to parse expression in ; couldn't find final \'␤ in any FAILGOAL at src/stage2/QRegex.nqp:1038␤ in regex at /tmp/lO60T6RbMC:1␤ in method ACCEPTS at src/gen/CORE.setting:10731␤ in block at /tmp/lO60T6RbMC:1␤␤»
flussence don't think it's NYI; it was definitelyI last time I tried doing anything with it... 03:00
benabik NLI, then, I guess. ;-) 03:01
flussence star: use JSON::Tiny; say from-json('{ "a": "abc\n" }') 03:03
p6eval star 2012.12: OUTPUT«("a" => "abc\n").hash␤»
flussence well that works fine...
03:03 alec left
flussence locally too... 03:04
03:04 alec__ joined, Swarley_ joined
benabik star: say q{'quoted string'} ~~ / \' ~ \' .* / 03:04
p6eval star 2012.12: OUTPUT«Unable to parse expression in ; couldn't find final \'␤ in any FAILGOAL at src/stage2/QRegex.nqp:1038␤ in regex at /tmp/40ecDBnVwk:1␤ in method ACCEPTS at src/gen/CORE.setting:10531␤ in block at /tmp/40ecDBnVwk:1␤␤»
benabik huh.
colomon n: say q{'quoted string'} ~~ / \' ~ \' .* /
p6eval niecza v24-18-gaf64300: OUTPUT«Unhandled exception: Unable to parse anonymous regex␤Couldn't find final "'"; gave up␤ at /home/p6eval/niecza/lib/CORE.setting line 1435 (die @ 5) ␤ at /home/p6eval/niecza/lib/CORE.setting line 2753 (Cursor.FAILGOAL @ 6) ␤ at /tmp/GYCdl2xWlq line 1 (ANO…
timotimo what's the ~ syntax for? 03:05
03:05 alec__ is now known as alec
flussence S05:859 03:05
03:05 dayangkun joined
timotimo you're fast! 03:05
flussence had it open that time :)
benabik timotimo: / \' ~ \' .* / is about the same as / \' .* \' / (the former can give better errors)
timotimo oh, that's cute! 03:06
flussence r: say q{'quoted string'} ~~ / \' ~ \' <-[']>* /
p6eval rakudo a26956: OUTPUT«「'quoted string'」␤␤»
flussence there we go... user error :)
benabik And I guess it backtracks differently.
timotimo <-[') looks funny. a bit like a duck's head 03:07
benabik say 'quack!' ~~ / quack <-[']> / 03:08
r: say 'quack!' ~~ / quack <-[']> /
p6eval rakudo a26956: OUTPUT«「quack!」␤␤»
timotimo ah, -[...] is an inverted character class
flussence
.oO( duck-typed regex )
still, I'd have imagined there to be an easier way to write what that's supposed to mean... 03:09
timotimo r: say q{'quoted \'string\''} ~~ / \' ~ \' <-['] | \\\' >* / 03:10
p6eval rakudo a26956: OUTPUT«===SORRY!===␤regex assertion not terminated by angle bracket␤at /tmp/DdPNOOHDSG:1␤------> 'quoted \'string\''} ~~ / \' ~ \' <-['] ⏏| \\\' >* /␤ expecting any of:␤ postfix␤ infix or meta-infix␤ infix stopp…
timotimo r: say q{'quoted \'string\''} ~~ / \' ~ \' <-['] | "\'" >* / 03:11
p6eval rakudo a26956: OUTPUT«===SORRY!===␤regex assertion not terminated by angle bracket␤at /tmp/1NlvJu0UFm:1␤------> 'quoted \'string\''} ~~ / \' ~ \' <-['] ⏏| "\'" >* /␤ expecting any of:␤ postfix␤ infix or meta-infix␤ infix stopp…
timotimo er
r: say q{'quoted \'string\''} ~~ / \' ~ \' < <-[']> | <"\'"> >* /
p6eval rakudo a26956: OUTPUT«===SORRY!===␤Quote words construct too complex to use in a regex␤at /tmp/rGov6VfLjg:1␤------> ing\''} ~~ / \' ~ \' < <-[']> | <"\'"> >⏏* /␤»
timotimo r: say q{'quoted \'string\''} ~~ / \' ~ \' < <-[']> | < \\\' > >* /
p6eval rakudo a26956: OUTPUT«===SORRY!===␤Quote words construct too complex to use in a regex␤at /tmp/r7R0whY_PJ:1␤------> g\''} ~~ / \' ~ \' < <-[']> | < \\\' > >⏏* /␤»
timotimo i don't even know what i'm doing
r: say q{'quoted \'string\''} ~~ / \' ~ \' < <-[']> | \\\' >* /
p6eval rakudo a26956: OUTPUT«===SORRY!===␤Quote words construct too complex to use in a regex␤at /tmp/eo4YgNEFC8:1␤------> tring\''} ~~ / \' ~ \' < <-[']> | \\\' >⏏* /␤»
flussence I think you meant [...]*
timotimo so [...]* is not only for character classes? 03:12
r: say q{'quoted \'string\''} ~~ / \' ~ \' [<-[']> | \\\']* /
p6eval rakudo a26956: OUTPUT«「'quoted \'string\''」␤␤»
benabik <[ ]> is a character class. [ ] is a non-capturing group
flussence <[...]> is a character class
<...> in general means "weird thing here"
timotimo what's the new meaning of ( ... )?
flussence ( ... )
timotimo "regular thing here"? "precedence clarification for you"?
oh, so it matches literal braces? 03:13
flussence no, it does the same as p5
benabik It's a capturing group.
timotimo ah. ( ) capturing group, [ ] non capturing group
kind of like bars in a prison window
if they're ( ), they'll still capture
but if you bend them to look like [ ] you can escape
flussence (?:people didn't like writing this all the time) 03:14
timotimo i can see why
hm. are perl6 regexes implemented as a grammar? 03:16
benabik In that perl6 is implemented with grammars, yes.
timotimo that breaks my head very slightly 03:17
benabik github.com/rakudo/rakudo/blob/nom/...Grammar.pm
03:18 Khisanth left
timotimo may be too many meta-layers for this late time 03:18
benabik Grammars are made of rules, not the other way around.
flussence if you want to be horrified, there's also a grammar engine written entirely in perl6 03:19
timotimo is that the glacier thingie?
flussence yep
timotimo glacier grammar engine i think
why are there babble, quibble and nibble? where did those names come from? :D 03:21
03:21 adu joined
sorear The warped and twisted mind of TimToady, I think. 03:25
03:27 donghongbo left 03:32 Khisanth joined 03:35 orafu left, orafu joined 03:41 s1n joined
Swarley_ r: "49494_4949" ~~ /[<[0..9]>|_<!before _>]*/ 03:52
p6eval rakudo a26956: ( no output )
Swarley_ r: say "49494_4949" ~~ /[<[0..9]>|_<!before _>]*/
p6eval rakudo a26956: OUTPUT«「49494_4949」␤␤»
Swarley_ r: say "49494__4949" ~~ /[<[0..9]>|_<!before _>]*/
p6eval rakudo a26956: OUTPUT«「49494」␤␤»
timotimo fwiw, the % operator is perhaps one of the greatest inventions in perl6 regex. feel free to amaze me further with other things 03:57
04:05 atrodo left 04:19 preflex left 04:20 adu left, preflex_ joined 04:21 preflex_ is now known as preflex 04:40 skids left 04:59 kaleem joined 05:08 jaldhar left 05:11 kaleem left 05:35 Swarley_ left 05:48 fhelmberger joined 05:51 erkan joined 06:05 thou joined 06:07 thou left 06:12 SamuraiJack joined
lue r: say "abc" ~~ /<!digit>+/ 06:15
p6eval rakudo a26956: OUTPUT«(timeout)»
lue oh, that thing. 06:16
r: say "abc" ~~ /<!digit>/
p6eval rakudo a26956: OUTPUT«「」␤␤»
lue r: say "abc" ~~ /<-digit>/
p6eval rakudo a26956: OUTPUT«「a」␤␤»
06:24 slavik1 left 06:31 slavik1 joined 06:41 sizz left 06:44 kaleem joined 06:45 sizz joined 06:53 crazedpsyc joined 06:59 sizz left 07:14 quester joined 07:32 FROGGS_ left 07:47 vividsnow joined 07:50 ermlich left 07:54 vividsnow left 08:04 quester left
BooK masak: looking 08:08
08:09 kaleem left 08:10 vividsnow joined 08:11 FROGGS joined
BooK masak: some reference for the players: philippe.bruhat.net/stuff/git-fractals/ 08:11
jnthn morning, #perl6 08:12
moritz \o 08:15
FROGGS morning 08:20
jnthn hi moritz, FROGGS
jnthn waits patiently for his class to all show up :) 08:21
FROGGS .oO( glass? )
jnthn :P 08:23
no, sadly this is work, not drinking :) 08:24
nice work though :)
arnsholt o/
jnthn o/ arnsholt 08:25
arnsholt is preparing for his class
jnthn :)
arnsholt Teaching Python
jnthn Advanced c# here
sorear o/ 08:27
FROGGS hi sorear
sorear hi FROGGS 08:30
jnthn o/ sorear
FROGGS jnthn: btw, I'm up to fixing: 08:31
rn: my $s = "abc"; say $s ~~ s[x] = "y"
p6eval niecza v24-18-gaf64300: OUTPUT«False␤» 08:32
..rakudo a26956: OUTPUT«True␤»
jnthn ++FROGGS
FROGGS I'm in the make_smartmatch in the Actions.pm, the ~$/[1] is 's[x] = "y"', how do I proper check for the quote:sym<s> here? 08:33
$/[1]<sym> is empty
jnthn um, I'd have to look and gotta teach now, sorry
jnthn bbiab 08:34
FROGGS ya, no hurry 08:36
just wanted to ask so I dont forget
08:37 hoelzro|away is now known as hoelzro
moritz FROGGS: maybe the easiest way is to tag the code as begin a substitution in method quote:sym<s> in Actions 08:38
e.g. something like $past<is_subst> := 1;
and then check that flag in make_smartmatch
08:39 MikeFair_ left
FROGGS moritz: cool! will try 08:39
08:44 vividsnow left 09:01 kaleem joined 09:03 sqirrel joined 09:05 kresike joined
kresike hello all you happy perl6 people 09:06
tadzik hello hello
kresike tadzik, o/ ☺
moritz it's Wednesday. That means: new episode of HPMoR podcast, new podcastle episode \o/ 09:10
tadzik and another 2 exams to pass! \o/ 09:13
and then I'm free until monday
moritz tadzik: good luck then!
tadzik thanks, that'll come in handy :) 09:14
09:14 alec left
FROGGS moritz: HPMoR? 09:16
moritz FROGGS: hpmor.com/ 09:21
FROGGS cool
09:28 alec joined 09:42 dakkar joined, snearch joined 09:43 Psyche^ joined 09:46 snearch left, Patterner left, Psyche^ is now known as Patterner
jnthn tadzik: good luck with exams :) 09:49
09:53 dayangkun left 10:04 snearch joined, hypolin left
sjn moritz: love the HPMOR podcast :) 10:06
10:06 dayangkun joined 10:07 dayangkun left 10:08 dayangkun joined
masak BooK: well, I believe I have solved the merge point problem once and for all. I will blog about it, explaining it in detail. 10:18
10:18 snearch left 10:23 b1rkh0ff joined
BooK masak: cool. I'll link your post from the git-fractals page :-) 10:32
masak something is rotten in the state of state.
nr: sub f { say ++state $ ; }; f; f; f
p6eval rakudo a26956: OUTPUT«1␤1␤1␤»
..niecza v24-18-gaf64300: OUTPUT«1␤2␤3␤»
masak submits rakuobug
what's worse:
nr: sub f { say ++(state $ = 0); }; f; f; f
p6eval rakudo a26956: OUTPUT«===SORRY!===␤Error while compiling block : Error while compiling op call: Error while compiling block : Error while compiling block f: Error while compiling op p6typecheckrv: Error while compiling op lexotic: Error while compiling op p6decontrv: Error while compili…
..niecza v24-18-gaf64300: OUTPUT«1␤2␤3␤»
masak BooK: I will probably not have the focus and tuits to blog until Friday.
BooK: after solving the problem, I had to tear myself from the screen and go to bed. for 30 minutes, my brain helpfully suggested improvements to the code instead of going to sleep. I'm not incorporating those improvements. 10:33
tadzik oooh yeaah 10:44
that feeling to be a part of 36% of people who passed monday's murderer-exam :) 10:45
BooK usually, a good night of sleep lets the ideas sediment well, and the code flows better in the morning 10:46
masak tadzik: I didn't realize your major was murder. 10:47
BooK: yeah, but here it was more a matter of the hands leaving the keyboard, but the brain keeping at it :)
(so far, all of the feverish brain optimization seem to hold up) :P
I just eliminated the higher-order function, and stuff still works. 10:48
tadzik masak: yeah, if I only knew... ;)
masak now to eliminate all if statements.
here, this sierpinski looks not so bad: gist.github.com/4600143 11:00
removing all the comments actually makes the code fit on one screen :)
jnthn masak: odd bug. wonder if it relates to my fixing the over-sharing bug.
If so, it means we're missign some test coverage...
masak yah.
jnthn is surprised we'd be missing it for anon state vars 11:01
masak yes.
me too.
jnthn: when did you fix? I'd like to bisect.
jnthn Not sure, recently
It was the bug when my @ and a later my @ would share the value
11:01 sivoais left
jnthn I think the commit message said "over-sharing" 11:01
don't have a repo here 11:02
masak goes looking
'Fix (my %) over-sharing.', perhaps? 11:03
2013-01-12.
github.com/rakudo/rakudo/commit/bd...f974af3d8a
11:06 Su-Shee_ joined, Su-Shee left, Su-Shee_ is now known as Su-Shee 11:07 dayangkun left
masak jnthn: confirmed #1: in bd9bc6f^, 'state' works. 11:13
jnthn: confirmed #2: in bd9bc6f, 'state' is b0rken. 11:19
masak adds this to the RT ticket
moritz masak: re ticket subject, state + anon variable is broken 11:24
seems that state + named variables is just fine
otherwise we'd notice the test fallout
masak oh! 11:25
moritz: yes, that explains how this snuck under the radar.
thing is, 'state $' is quickly establishing itself as a pattern.
moritz nr: sub f { say ++state $a ; }; f; f; f # OK not used
p6eval niecza v24-18-gaf64300: OUTPUT«Potential difficulties:␤ $a is declared but not used at /tmp/RxlEi_cDOk line 1:␤------> sub f { say ++state ⏏$a ; }; f; f; f # OK not used␤␤1␤2␤3␤»
..rakudo a26956: OUTPUT«1␤2␤3␤»
masak actually, there are two things I'd like to talk about there. 11:26
moritz I'm not trying to downplay the problem, just narrowing it down
masak r: sub f { say (state $)++ }; f; f; f
p6eval rakudo a26956: OUTPUT«0␤0␤0␤»
masak r: sub f { say ++state $; }; f; f; f
p6eval rakudo a26956: OUTPUT«===SORRY!===␤Unsupported use of $; variable; in Perl 6 please use real multidimensional hashes␤at /tmp/RIi6jfh778:1␤------> sub f { say ++state $;⏏ }; f; f; f␤»
masak ah, there we go.
moritz r: sub f { say ++state $ }; f; f; f 11:27
p6eval rakudo a26956: OUTPUT«1␤1␤1␤»
masak maybe there's nothing to be done about that, but I'm pretty sure I didn't mean '$;' the obsolete variable :P
moritz std: ++ state $;
p6eval std 7deb9d7: OUTPUT«===SORRY!===␤Unsupported use of $; variable; in Perl 6 please use real multidimensional hashes at /tmp/3b6x5c9dzG line 1:␤------> ++ state $;⏏<EOL>␤Parse failed␤FAILED 00:00 41m␤»
moritz well, one could always remove that case of obsoletion warning 11:28
masak depends how strict is the rule of "sigil + punctuation mark always makes a variable, no matter how unsupported". 11:29
& 11:42
11:44 MayDaniel joined 12:05 hoelzro is now known as hoelzro|away
dalek kudo/nom: 388c1bb | (Tobias Leich)++ | src/Perl6/Actions.pm:
proper return value for smartmatching against a substitution

We will return True if there was a match, otherwise False. If the rhs is not a substitution, we still will call ACCEPTS and return its result.
12:05
12:08 hoelzro|away is now known as hoelzro
dalek ast: bd732d6 | (Tobias Leich)++ | S05-substitution/subst.t:
no-match substitution returns false now
12:09
FROGGS rn: my $s = "abc"; say $s ~~ s[x] = "y" 12:10
p6eval niecza v24-18-gaf64300: OUTPUT«False␤»
..rakudo a26956: OUTPUT«True␤»
12:13 imyat joined
FROGGS rn: my $s = "abc"; say $s ~~ s[x] = "y" 12:14
p6eval rakudo 388c1b, niecza v24-18-gaf64300: OUTPUT«False␤»
FROGGS rn: my $s = "abc"; say $s ~~ s[c] = "y"
p6eval rakudo 388c1b, niecza v24-18-gaf64300: OUTPUT«True␤»
FROGGS \o/
12:24 vividsnow joined
masak FROGGS++ 12:29
FROGGS rn: say ?(all() ~~ /^ \d+ $/) 12:31
p6eval rakudo 388c1b: OUTPUT«False␤»
..niecza v24-18-gaf64300: OUTPUT«True␤»
FROGGS o.O
masak: which one is right? 12:32
niecza?
r: enum X <a b c>; say a ~~ Int; say True ~~ Int 12:33
p6eval rakudo 388c1b: OUTPUT«True␤False␤»
FROGGS n: enum X <a b c>; say a ~~ Int; say True ~~ Int
p6eval niecza v24-18-gaf64300: OUTPUT«True␤True␤» 12:34
masak FROGGS: rn: say ?all()
rn: say ?all()
p6eval rakudo 388c1b, niecza v24-18-gaf64300: OUTPUT«True␤»
moritz niecza is right 12:35
FROGGS ahh, is it the same bug?
masak rn: say all() ~~ /^ \d+ $/
p6eval niecza v24-18-gaf64300: OUTPUT«all()␤»
..rakudo 388c1b: OUTPUT«#<failed match>␤»
masak yes, Niecza++ is right.
moritz I think it's a known bug that ~~ doesn't autothread in rakudo
masak seems rakudo collapses the junc... right.
FROGGS rn: say [] ... [] 12:37
p6eval rakudo 388c1b: OUTPUT«(timeout)»
..niecza v24-18-gaf64300: OUTPUT«␤»
moritz rn: say [] ~~ []
p6eval rakudo 388c1b, niecza v24-18-gaf64300: OUTPUT«True␤»
masak TimToady: remember back when '$/' in regexes meant "the $/ variable", but then STD changed because of real-world November code? 12:38
TimToady: well, this '++state $;' thing feels a bit like that. what do you think?
12:45 dayangkun joined 13:00 imyat left 13:07 kaleem left
FROGGS n: '12'.subst(/(.)(.)/,{$()*2}) 13:12
p6eval niecza v24-18-gaf64300: ( no output )
FROGGS n: say '12'.subst(/(.)(.)/,{$()*2})
p6eval niecza v24-18-gaf64300: OUTPUT«24␤»
FROGGS n: say '12'.subst(/(.)(.)/,{$(0)*2})
p6eval niecza v24-18-gaf64300: OUTPUT«0␤»
FROGGS n: say '12'.subst(/((.)(.))/,{$()*2}) 13:13
p6eval niecza v24-18-gaf64300: OUTPUT«24␤»
FROGGS n: say '12'.subst(/(..)/,{$()*2})
p6eval niecza v24-18-gaf64300: OUTPUT«24␤»
FROGGS n: say '1a'.subst(/(.)(.)/,{$()*2})
p6eval niecza v24-18-gaf64300: OUTPUT«Unhandled exception: Cannot parse number: 1a␤ at /home/p6eval/niecza/lib/CORE.setting line 1435 (die @ 5) ␤ at /home/p6eval/niecza/lib/CORE.setting line 3539 (ANON @ 10) ␤ at /home/p6eval/niecza/lib/CORE.setting line 3541 (NumSyntax.str2num @ 5) ␤ at /…
FROGGS n: say '1a'.subst(/(.)(.)/,{$0*2})
p6eval niecza v24-18-gaf64300: OUTPUT«2␤»
FROGGS n: say '12'.subst(/../,{$()*2}) 13:14
p6eval niecza v24-18-gaf64300: OUTPUT«24␤»
FROGGS n: say '12'.subst(/../,{$/*2})
p6eval niecza v24-18-gaf64300: OUTPUT«24␤»
FROGGS r: say '12'.subst(/../,{$/*2})
p6eval rakudo 388c1b: OUTPUT«24␤»
FROGGS so $() is the same as $/, right?
r: say '12'.subst(/../,{$/*2}); say $()
p6eval rakudo 388c1b: OUTPUT«24␤␤»
FROGGS n: say '12'.subst(/../,{$/*2}); say $() 13:15
p6eval niecza v24-18-gaf64300: OUTPUT«24␤Unhandled exception: Unable to resolve method ast in type Any␤ at /tmp/X1nre_sWh0 line 1 (mainline @ 6) ␤ at /home/p6eval/niecza/lib/CORE.setting line 4218 (ANON @ 3) ␤ at /home/p6eval/niecza/lib/CORE.setting line 4219 (module-CORE @ 580) ␤ at /home…
FROGGS ... inside that closure
moritz $() can also involved $/.ast somehow 13:17
it's in the specs somewhere
masak S05:2883 13:19
$($/.ast // ~$/)
FROGGS interesting 13:22
moritz increases percentual test coverage at $work by deleting unused library functions 13:24
FROGGS cheater!
jnthn Deleting dead code isn't cheating :) 13:25
There's plenty of reasons to do it besides "increase test coverage" though :)
masak no, it's admirable.
well, if the test coverage was the thing that discovered that the library functions were unused, then that's a good thing. 13:26
13:26 kaleem joined
moritz FROGGS: cheating is technique! :-) 13:26
FROGGS that's my job too
FROGGS is calculating fees for 400 employees 13:27
Su-Shee FROGGS: 401.. ;) my account number is.. ;) 13:28
FROGGS ENOSUCHNUMBER
;o)
r: $() = 42; say $() 13:29
p6eval rakudo 388c1b: OUTPUT«Cannot assign to a readonly variable or a value␤ in block at /tmp/zoA_h1D1U5:1␤␤»
FROGGS r: $/ = 42; say $/
p6eval rakudo 388c1b: OUTPUT«42␤»
moritz $() isn't really a variale 13:33
it's more like a call
FROGGS I try to find the code where that happens, but it looks like SciTE doesnt like dollars in search strings... 13:35
will grep for it
masak r: $/ = (class { has $.ast is rw }).new; $() = 42; say "alive"
p6eval rakudo 388c1b: OUTPUT«Cannot assign to a readonly variable or a value␤ in block at /tmp/lGRykrJX92:1␤␤»
FROGGS say $().WHAT 13:36
r: say $().WHAT
p6eval rakudo 388c1b: OUTPUT«Parcel()␤»
13:41 b1rkh0ff left 13:55 b1rkh0ff joined 13:59 vividsnow left 14:01 hash_table joined
FROGGS can you guide me where $() is declared? 14:01
tadzik it's not a variable. It's just nothing in item context, methinks 14:02
r: say $(5).WHAT 14:03
p6eval rakudo 388c1b: OUTPUT«Int()␤»
tadzik r: say $(Nil).WHAT
moritz aye
p6eval rakudo 388c1b: OUTPUT«Nil␤»
moritz it's the same as (...).item
r: .say for $(1, 2, 3)
p6eval rakudo 388c1b: OUTPUT«1 2 3␤»
moritz only one iteration
FROGGS right, so if there is no param it should give us $/.ast // ~$/
[Coke] shudders at the new list model. 14:04
[Coke] hasn't internalized it yet, so I keep doing things wrong with it.
tadzik [Coke]: look for pmichaud's talk about them, it really clears things up 14:05
masak [Coke]: I've been bitten by it too. I'd like to hear what trips you up.
r: say <a b c d>.kv.reverse.perl
p6eval rakudo 388c1b: OUTPUT«((3, "d"), (2, "c"), (1, "b"), (0, "a")).list␤»
masak I'd really expect that to flatten.
r: say <a b c d>.kv.flat.reverse.perl
p6eval rakudo 388c1b: OUTPUT«("d", 3, "c", 2, "b", 1, "a", 0).list␤»
moritz i guess it should
masak submits rakudobug 14:06
tadzik wait, wfhy
why do you expect a list of pairs to flatten?
masak they're not pairs.
moritz problem is, many of the methods were written by folk (including me) that didn't really understand the list model back then
masak => makes pairs.
[Coke] masak: mainly that sometimes I have to call .list when I'm really not expecting it. (bit me more than once on p6cc2012)
moritz tadzik: .kv != .pairs
masak this is just sublists.
tadzik oh hm]
sublists, not subarrays, aye?
masak [Coke]: oh, that one I've internalized.
[Coke]: basically when you get something out of a container, you might have to do that. 14:07
[Coke] MIGHT?!? ;)
14:07 hash_table left
tadzik it's just that it's hard to predict until you run the code 14:07
which is, what [Coke] said
14:07 atrodo joined
masak yeah, there should be a hard-and-fast rule. 14:07
tadzik: yes, sublists, not subarrays.
tadzik I see 14:08
but honestly, I don't mind them in item context :)
you can always call flat. If you don't want that, you can't call un-flat
[Coke] I have a thing with a Str method. I have a @ of things. Is there a way to pretty print any array of things without having to make an explicit class?
tadzik leaves to learn for the last-ish remaining exam 14:09
14:09 PacoAir joined
[Coke] ponders a role. 14:10
moritz [Coke]: say join ' ', @array.map: &pretty
masak tadzik: yes, you can always call flat. but my expectation is that .kv gives me a flat list already. and then I'm surprised when .reverse reverses things pairwise.
moritz and then a multi pretty(YourType $x) { ... }
masak: it's right for .kv to give you a nested list, but .reverse should flatten 14:11
[Coke] moritz: my $hand = .... but purty; where purty is my pretty printer. WFM.
masak right.
14:11 sivoais joined 14:13 vividsnow joined
masak (though I'm not 100% swayed by sublists yet. they haven't carried their weight so far in code I've written.) 14:16
[Coke] r: // this is a bad comment. 14:17
p6eval rakudo 388c1b: OUTPUT«===SORRY!===␤Null regex not allowed␤at /tmp/7JOja00g5Y:1␤------> //⏏ this is a bad comment.␤»
[Coke] r: // this is a bad comment.␤say "hi" 14:18
p6eval rakudo 388c1b: OUTPUT«===SORRY!===␤Null regex not allowed␤at /tmp/6TYav28cEi:1␤------> //⏏ this is a bad comment.␤»
[Coke] I was getting an error on the . for string concat. arglebargle
FROGGS r: 1 // this is a bad comment.␤say "hi" 14:20
p6eval rakudo 388c1b: OUTPUT«===SORRY!===␤Unsupported use of . to concatenate strings; in Perl 6 please use ~␤at /tmp/LFApPPwQdr:2␤------> <BOL>⏏say "hi"␤»
14:22 bluescreen10 joined
[Coke] Yes, that. :) 14:22
GlitchMr docs.python.org/3.4/library/itertools.html 14:23
accumulate(data, max)
[\max] @data
[Coke] so, if I have a $foo that contains a listy thing, and I want to have a role that operates on that, how can I refer to the thing itself in the role? "self" seems to be a Mu when I call it.
GlitchMr So, Python has function for that and Perl 6 has operator for that.
masak GlitchMr: quite a common situation.
pmichaud Re #116525 I'd be a little surprised if .kv returned a flat list. 14:24
masak pmichaud: yes, and I'm not saying it should.
I'm saying my expectation is that reverse should be reversing the keys and values. 14:25
pmichaud I'm responding to...
14:10 <masak> tadzik: yes, you can always call flat. but my expectation is that .kv gives me a flat list already. and then I'm surprised when .reverse reverses things pairwise.
masak yes, that was hastily worded, sorry. 14:26
pmichaud okay, just checking
and obtw, good morning #perl6
masak .kv is free to do funny things with sublists if it wants.
pmichaud! \o/
pmichaud I'm only here for a couple of minutes, sadly
but as you can see, I do still follow things :)
masak pmichaud: my point is more, if I want nothing to do with sublists, .reverse should make them invisible to me.
timotimo hello butterfly friends 14:27
masak pmichaud: whether it does this by flattening the sublists, or recursively reversing them, I don't really care.
timotimo! \o/
pmichaud masak: I'd expect reverse to act similarly to .sort, .join, etc.
masak aye.
pmichaud so if those flatten, then .reverse should flatten too
if they don't, it shouldn't
moritz r: say (<b a>, <c d>).sort 14:28
p6eval rakudo 388c1b: OUTPUT«b a c d␤»
masak r: role Lolly { method foo { say "lol, I am a {self.^name}" } }; my $array = [1, 2, 3] but Lolly; say $array.foo
p6eval rakudo 388c1b: OUTPUT«lol, I am a Array+{Lolly}␤True␤»
moritz r: say (<b a>, <c d>).join('|')
p6eval rakudo 388c1b: OUTPUT«b|a|c|d␤»
masak [Coke]: ^^
moritz join flattens, .sort doesn't
masak :/
moritz r: say (<b a>, <c d>).map: *.chars
p6eval rakudo 388c1b: OUTPUT«1 1 1 1␤»
masak where's the logic in that?
moritz .map flattens
pmichaud .map explicitly flattens, yes
but it might be a special case 14:29
masak I think .sort should flatten, too.
pmichaud r: say (<b a>, <c d>).sort.perl
p6eval rakudo 388c1b: OUTPUT«(("b", "a"), ("c", "d"))␤»
pmichaud r: say (<e a>, <c d>).sort.perl
p6eval rakudo 388c1b: OUTPUT«(("c", "d"), ("e", "a"))␤»
pmichaud (just checking)
I'll let you folks hash it out from here, then :)
masak pmichaud: thanks! enjoy $elsewhere! :) 14:30
14:30 bluescreen10 left, bluescreen10 joined
[Coke] masak;my thing turns out to be a List, not an array. 14:35
14:37 kaare_ joined
masak [Coke]: well, I don't know what a List is in Perl 6. so cannot help you there ;) 14:37
I only know about Arrays, and I'm vaguely familiar with Parcels. 14:38
moritz an Array is simply a List where all elements are scalar containers 14:39
so you can do basically anything with a List that you can do with an array, except assigning to an element
(unless that element happens to be a container) 14:40
[Coke] bah. I will try to cut this down to a simple failing example after work. 14:43
masak oh, right.
Lists are part of the Big Container-based Type Duplication. now I remember.
[Coke] r: role c {}; my @a = 1,2,3,4; my $b = @a.pick(2) but c; say $b.WHAT; say $b; 14:45
p6eval rakudo 388c1b: OUTPUT«List+{c}()␤elements() not implemented in class 'Mu'␤ in method REIFY at src/gen/CORE.setting:6099␤ in method reify at src/gen/CORE.setting:5496␤ in method reify at src/gen/CORE.setting:5483␤ in method gimme at src/gen/CORE.setting:5873␤ in method eager at src/…
masak interestin'
[Coke] or I could get lucky.
masak r: my @a = 1,2,3,4; my $b = @a.pick(2); say $b.WHAT; say $b; 14:46
p6eval rakudo 388c1b: OUTPUT«List()␤2 1␤»
masak submits rakuodbug
[Coke] \o/
colomon n: my @a = 1,2,3,4; my $b = @a.pick(2); say $b.WHAT; say $b; 14:47
p6eval niecza v24-18-gaf64300: OUTPUT«List()␤2 3␤»
14:48 stopbit joined
moritz [Coke]++ # golfing the example 14:48
14:49 Timbus left 14:50 Timbus joined 14:52 skids joined
[Coke] r: role c {}; my @a = 1,2,3,4; my $b = @a but c; say $b.WHAT; say $b; 14:53
p6eval rakudo 388c1b: OUTPUT«Array+{c}()␤elements() not implemented in class 'Mu'␤ in method REIFY at src/gen/CORE.setting:6099␤ in method REIFY at src/gen/CORE.setting:6364␤ in method reify at src/gen/CORE.setting:5496␤ in method reify at src/gen/CORE.setting:5483␤ in method gimme at src…
arnsholt r: class A { }; say Array[A] ~~ Array[A]; 14:55
p6eval rakudo 388c1b: OUTPUT«False␤»
FROGGS uhh 14:56
arnsholt Yeah, it's wrong =)
FROGGS r: say Array[Int] ~~ Array[Int]; 14:57
p6eval rakudo 388c1b: OUTPUT«False␤»
arnsholt It's a long-standing issue. I was just wondering if anyone had fixed it while I wasn't paying attention
And it applies to all parametrized classes, AFAIK, not just arrays
FROGGS there is already a ticket for it? 14:58
moritz yes
from around 2012-04
FROGGS ohh, will be its first birthday soon 14:59
masak similarly, the oldest open ticket, rt.perl.org/rt3/Ticket/Display.html?id=61602 , turned 4 not long ago. 15:11
15:11 vividsnow left
moritz right. That one depends on a still-open specbug 15:16
masak well, it's a tricky corner case. Inf, as spec'd, is part Int, part Num, part Str, part (perhaps?) arbitrary object. we have no mechanism within our type system to make a type like that. 15:17
I don't suppose we could hand-hack Inf.ACCEPTS somehow?
15:17 Timbus left, ph1ur3 joined 15:18 Timbus joined
masak r: class MyInf { method ACCEPTS($o) { $o ~~ Int || $o ~~ Num || $o ~~ Str } }; say MyInf ~~ Int; say MyInf ~~ Str; say MyInf ~~ Num 15:18
p6eval rakudo 388c1b: OUTPUT«False␤False␤False␤»
masak hrm.
r: class MyInf { method ACCEPTS($o) { $o ~~ Int || $o ~~ Num || $o ~~ Str } }; say MyInf.new ~~ Int; say MyInf.new ~~ Str; say MyInf.new ~~ Num
p6eval rakudo 388c1b: OUTPUT«False␤False␤False␤» 15:19
masak it is a sad world where an honest guy like me isn't even allowed to cheat the type hierarchy a little... :P
moritz r: class MyInf is Int is Str is Num { method Str { 'Inf' } }; say MyInf ~~ Str; say MyInf ~~ Num; say MyInf.new.Str
p6eval rakudo 388c1b: OUTPUT«True␤True␤Inf␤»
[Coke] r: say Int ~~ Int
p6eval rakudo 388c1b: OUTPUT«True␤»
moritz masak: well, you're cheating the wrong method :-) 15:20
MyInf ~~ Int calls Int.ACCEPTS
masak d'oh! 15:21
moritz: I like your approach, though. it's direct. and a little MI never killed anyone, right? :) 15:22
(except I guess now Inf can't be stored in a pure Int container...) 15:23
15:24 bbkr left
[Coke] r: class MyInf is Int is Str; my Int $a = MyInf.new; 15:24
p6eval rakudo 388c1b: ( no output )
[Coke] r: class MyInf is Int is Str {}; my Int $a = MyInf.new;
p6eval rakudo 388c1b: ( no output )
[Coke] "seems legit."
masak hm, I guess. 15:25
because Int+Str <: Int
well, then, gentlemen. that's our solution, then.
15:27 autumn left 15:28 autumn joined
moritz but there's a certain cost attached to it 15:31
for every operation that could produce a Num, you have to check if it's Int/-Int/NaN, and if yes, typecast 15:32
oh, and you need a name for the type
15:34 SunilJoshi joined
moritz by the way we've closed several very old tickets during the last months 15:35
15:37 hash_table joined 15:39 kaleem left
FROGGS since when? october? :o) 15:45
was timotimo and me AFAIK 15:46
timotimo i did a few, yes 15:47
jumped onto a few "closable with test" tickets and looked at a few tickets that had already been fixed by someone else, but not closed
FROGGS thats what I did too
timotimo is a QAST::Want for putting a few possible alternatives into the AST and later checking which one is the most sensible? 15:53
later apparently still refering to compile-time 15:54
jnthn Yeah
15:54 vividsnow joined
jnthn It's when you don't know that kinda context you'll be in. 15:54
timotimo ah, like string/numeric/bool?
jnthn int, str, num, object, void 15:55
The primitive native types, object and void basically]
Sink context jsut cares for void and whatever
If you do 123 then we emit a QAST::Want so it can act as a native int or the appropraite boxed integer constant 15:56
15:56 fgomez left
jnthn my int $x = 123; # uses the int branch 15:56
timotimo the qast pretty printer doesn't seem to show what type it would be for what alternative of the want
jnthn my $x = 123; # uses the boxed branch
Then, patch the QAST pretty printer ;) 15:57
timotimo sounds like a plan
jnthn I almost never use it, tbh.
15:57 autumn left, FROGGS left
timotimo well, *you* already know all there is to know about QAST :) 15:58
before i try to patch the pretty printer, i'll write a short bit on QAST::Want in the document about qast, though
15:58 autumn joined
timotimo oh, the list of subnodes is prioritized, too! interesting 16:00
the compiler would be a tiny bit faster, if the want subnodes were iterated over in reverse order and upon finding the first match it would break - is that sensible? github.com/perl6/nqp/blob/master/s...r.nqp#L652 16:01
i should write a want-heavy benchmark and see if it makes any difference whatsoever. 16:03
16:03 vividsnow left
timotimo oh, compiling rakudo should do decently. it's sufficiently long-running to make a difference noticable, although most of the time is spent in parsing, not in compiling 16:03
16:04 autumn left 16:05 snearch joined
timotimo jnthn: how come 123 doesn't emit a node for bool or string context, for instance? 16:06
16:06 FROGGS[mobile] joined
jnthn there's no bool context 16:06
this is a very low level, code-gen centric view of context
timotimo ah
16:06 vividsnow joined
jnthn if you did the str then you'd make my str $x = 42; work. 16:07
16:07 autumn joined
jnthn Which it should not 16:07
timotimo oh, that makes sense
dalek p: 82c2a06 | timo++ | docs/qast.markdown:
wrote a bit of text about QAST::Want.
16:08
timotimo oh, i have a commit bit? 16:09
moritz nqp commit bits are handed out fairly liberally 16:10
FROGGS[mobile] btw, I fixed the $() thingy, so you can do m/{ make ... }/ now
moritz \o/
FROGGS[mobile] need to walk home and spectest though 16:11
damn cold
moritz or push to a branch, so that I can spectest it
moritz has a fairly speedy machine at $work
FROGGS[mobile] my laptop is turned of atm 16:12
timotimo what is the $() thing?
FROGGS[mobile] but will do in a minute 16:13
moritz timotimo: that's been explained in the backlog
timotimo i'll have a look
FROGGS[mobile] timotimo: it can give you the ast of a match if there is one 16:14
see the link to S05
timotimo ah, it's group match reference syntax thingie?? 16:15
kresike bye folks
16:15 kresike left
timotimo ah, not quite 16:16
masak today's mini-challenge: what's the diameter of the smallest circle that can contain 3 non-overlapping circles of diameter 1? if that is too easy, generalize from 3 to N. 16:17
16:18 am0c joined 16:19 thou joined
timotimo hm, reminds me of the "appolonian" xscreensaver :) 16:19
doesn't seem super hard. i'll draw something clever-looking on my whiteboard 16:20
moritz generalize to N is hard
because for large enough N, you need to go to hexagonal packing
jnthn hotel &
skids And 3 is too easy. 16:21
moritz whereas for N = 4, you need quadratic packing
timotimo right
yeah, the radius of such a containing circle would be (1/2 the height of an euqilateral triangle with side-length 2) + 1
nwc10 I'm not convinced about how you pack 4 16:22
skids + 0.5, side length 1
Anything other than a square packing increases the cross section along an axis. 16:23
timotimo oh, yes, the small circles have *diameter* 1, i missed that detail
i used unit circles, like i was taught over and over in school :P 16:24
16:28 FROGGS joined 16:29 FROGGS[mobile] left
masak you're free to use unit circles. then you can either s:g/diameter/radius/ in the problem, or divide your final result by 2 :) 16:30
dalek kudo/match_shorthand: 1ed6e51 | (Tobias Leich)++ | src/Perl6/Actions.pm:
allow the use of $()

  ... which is a shorthand for $($/.ast // ~$/).
16:32
FROGGS moritz: ^^
masak FROGGS++
GlitchMr How can I cast to integer in Perl 6? 16:35
I guess it's "Int($number)
"
timotimo r: say Int(99.234)
p6eval rakudo 388c1b: OUTPUT«99␤»
timotimo r: say Int(99.9999)
p6eval rakudo 388c1b: OUTPUT«99␤»
timotimo that seems to be it, yes 16:36
masak oh look, there's a Wikipedia article: en.wikipedia.org/wiki/Circle_packi...n_a_circle
r: say 9.9999.Int
p6eval rakudo 388c1b: OUTPUT«9␤»
FROGGS r: say Int(-5.5)
p6eval rakudo 388c1b: OUTPUT«-5␤»
skids r: say int(99.9)
p6eval rakudo 388c1b: OUTPUT«invoke() not implemented in class 'int'␤ in block at /tmp/8njAgjOgE0:1␤␤»
masak r: say 1 + 2/3 * sqrt 3 16:37
p6eval rakudo 388c1b: OUTPUT«2.15470053837925␤»
masak this seems to be the answer. (since the Wikipedia page uses 'radius' in both places)
16:37 snearch left
masak is dissapoint there isn't a diagram for the N=1 case ;) 16:37
16:38 vividsnow left, am0c left
FROGGS masak: that page is editable ;o) 16:38
masak o.O
:P
also, why is N=4 trivially optimal, but N=5 needed to be proven?
16:38 am0c joined
[Coke] ♥'s the "vack" bash function from the ack users list. (puts you into vim with matching files, priming the search criteria so you can quickly jump to the matches) 16:38
hoelzro [Coke]: link, please? 16:39
GlitchMr "if that is too easy, generalize from 3 to N"
masak [Coke]: ooh!
GlitchMr looks like this part is impossible
masak GlitchMr: oh, I wouldn't go that far.
skids Or at least, challenging enough that it requires mathemeticians.
masak just really, really, really, really, really, really hard.
16:39 PacoAir left
[Coke] groups.google.com/forum/?hl=en&...zsucbau1Z0 16:40
there's a sack and vack in that thread.
hoelzro ah 16:41
masak .oO( 'sack' opens up sed, right? )
geekosaur would settle for a generalized cscope :) 16:42
but, that's kinda a different thing
hoelzro it would be nice if vack put the entries in the error listing
FROGGS moritz: the TODO in S05-match/make.t and the skipped one in S05-substitution/subst.t passed 16:44
16:46 hoelzro is now known as hoelzro|away
moritz FROGGS: \o/ 16:47
dalek kudo/nom: 1ed6e51 | (Tobias Leich)++ | src/Perl6/Actions.pm:
allow the use of $()

  ... which is a shorthand for $($/.ast // ~$/).
16:49
ast: 9508fb8 | (Tobias Leich)++ | S05- (2 files):
$() support added
16:51
16:52 spider-mario joined, rindolf joined
skids gist.github.com/4609751 # my mini-challenge 16:54
Actually that's not very fair. Back when I solved that problem it took me days. But then, I don't have a full CS training so... 16:56
16:56 fgomez joined
masak "You have an unlimited supply of black and red checkers." -- \o/ 17:00
that's *awesome*! 17:01
skids Imagine the possibilities.
masak do I keep the red checkers apart from the black ones, in different storage rooms?
do I have a limited amount of one of the colors? :P
masak gets a feeling he should read on 17:02
skids You keep the black checkers in storage rooms made out of red checkers, and visa versa. Of course. :-)
masak skids: I have only thought about the problem for 30 seconds, but... is there a state machine involved in your solution? 17:03
skids It can be solved recursively.
masak oooh
so, let me get this straight, the algorithm finishes by outputting True (when two black checkers are side-by-side), or (having looked through both piles) outputting False? 17:04
skids You shouldn't have to look through the piles, but yes. 17:05
17:05 hds_w joined
masak oh wait! 17:06
skids And any number of black checkers side-by-side yields True. Not restricted to one pair.
masak I see now, there's really only those eight integers involved. they completely specify the problem.
skids Yes.
masak right. at least one pair.
yes, now I definitely see how we can do better than O(min(@stack_heights)). 17:07
I'd need to develop a few tests, but... this feels solvable now.
skids++ # challenge
skids Actually you should also be able to do in in less than O(min(M,P,M',P')). 17:09
17:11 hds_w left
masak can N or N' be 0? 17:11
(I am assuming all the other parameters need to be at least 1)
skids Well, those cases are all trivial. 17:12
masak takes that as a "no" :) 17:13
skids Take it as a yes. 17:16
17:18 Chillance joined
masak ok. 17:18
FROGGS r: "foo".match(/{ make "bar" }/); say $() 17:21
p6eval rakudo 1ed6e5: OUTPUT«bar␤»
FROGGS r: "foo".match(/( \w+ { make "bar" })/); say $/; say $() 17:22
p6eval rakudo 1ed6e5: OUTPUT«「foo」␤ 0 => 「foo」␤␤foo␤»
FROGGS r: "foo".match(/( \w+ { make "bar" })/); say $/.ast; say $()
p6eval rakudo 1ed6e5: OUTPUT«Any()␤foo␤»
FROGGS r: "foo".match(/{ make "bar" }/); say $/.ast; say $()
p6eval rakudo 1ed6e5: OUTPUT«bar␤bar␤»
FROGGS k
timotimo is that correct? 17:25
FROGGS yes 17:28
r: "foo".match(/\w+/); say $/; say $()
p6eval rakudo 1ed6e5: OUTPUT«「foo」␤␤foo␤»
FROGGS it is useful to create object out of matches within the regex 17:29
timotimo why didn't \w+ { make "bar } actually result in bar at all?
17:33 vividsnow joined
FROGGS because $() defaults to the ast, which is { ... } 17:34
timotimo i must have misread the spec then 17:35
FROGGS read perlcabal.org/syn/S05.html#line_2883
;o)
17:40 slayer101_ joined
timotimo oh, so in /( \w+ { make "bar" })/ the ast has the matching group as the topmost node and the "bar" is attached to it? 17:40
how come its AST stringifies to Any()? i thought a type object is "null value"? 17:41
17:45 PacoAir joined, fgomez left
skids "Any()" is a Nil (empty list) cast to the Any type. 17:46
17:46 donaldh joined, slayer101_ left
timotimo there seems something totally obvious that i'm missing 17:47
17:47 slayer101_ joined
masak r: "foo".match(/( \w+ { make "bar" })/); say $/[0].ast 17:49
p6eval rakudo 1ed6e5: OUTPUT«bar␤»
skids What, about undefined values, or about the .ast Match member?
timotimo the ast match member, yes 17:53
18:00 grondilu joined, donaldh left, dakkar left 18:03 SunilJoshi left 18:09 PABPV07 joined 18:12 blublue joined, blublue left 18:21 telex left 18:23 telex joined
dalek rl6-roast-data: d8eee6f | coke++ | / (4 files):
today (automated commit)
18:28
[Coke] rakudo still failing S12-methods/syntax.rakudo
18:33 GlitchMr left 18:34 GlitchMr joined
FROGGS [Coke]: rakudo passes on my box 18:56
[Coke]: but maybe due to the fact that I use nqp in NQP_REVISION, not HEAD 18:57
[Coke] seems to work when run from the command line in the same build that had the test failure. 18:58
I'm using whatever the recommended version is.
[Coke] leaves it alone for now.
18:59 orafu left, orafu joined 19:06 slayer101_ left
FROGGS weird 19:06
19:07 slayer101_ joined
TimToady GlitchMr: note that you might want .floor instead Int() if you don't wan truncation semantics 19:11
*want 19:12
GlitchMr Well, in that certain case I wanted to use it on value I already used abs() on.
But I guess that floor is better
19:19 fgomez joined 19:22 brrt joined 19:27 benabik left 19:38 brrt left 19:43 swarles joined, brrt joined
swarles r: sub foo { /bar/ }; "hello bar" ~~ /<foo>/ 19:47
p6eval rakudo 1ed6e5: OUTPUT«No such method 'foo' for invocant of type 'Cursor'␤ in regex at /tmp/waornf05RF:1␤ in method ACCEPTS at src/gen/CORE.setting:10731␤ in block at /tmp/waornf05RF:1␤␤»
19:49 sftp left
swarles Can anyone point me to a reference that better explains how to create something like <before foo>? 19:51
Or if someone could explain it to me, that would be nice as well
19:51 fgomez left
timotimo i broke QAST/Compiler.nqp and the qast test suite didn't explode. hum. 19:51
19:52 sftp joined
timotimo fortunately, the other "test suite" exploded whole-heartedly :) 19:52
TimToady nr: my token foo { bar }; say "hello bar" ~~ <&foo> 19:53
p6eval niecza v24-18-gaf64300: OUTPUT«Potential difficulties:␤ &foo is declared but not used at /tmp/0xL46LqN3Y line 1:␤------> my token foo ⏏{ bar }; say "hello bar" ~~ <&foo>␤␤False␤»
..rakudo 1ed6e5: OUTPUT«False␤»
19:53 brrt left
TimToady nr: my token foo { bar }; say "hello bar" ~~ /<&foo>/ 19:54
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(6) to(9) text(bar) pos([].list) named({}.hash)>␤»
..rakudo 1ed6e5: OUTPUT«「bar」␤␤»
TimToady swarles: ^^
to get rid of the & you'd have to put the token into a grammar
swarles oh, well how can I make it accept arguments? Are they passed in $_ like perl 5?
FROGGS nr: my token foo ($s) { $s }; say "hello bar" ~~ /<&foo: "bar">/ 19:55
TimToady nr: my token foo($arg) { $arg }; say "hello bar" ~~ /<&foo bar>/
p6eval rakudo 1ed6e5: OUTPUT«===SORRY!===␤regex assertion not terminated by angle bracket␤at /tmp/7BiSO5lSYW:1␤------> o ($s) { $s }; say "hello bar" ~~ /<&foo⏏: "bar">/␤»
..niecza v24-18-gaf64300: OUTPUT«Unhandled exception: WTF in ANON␤ at /home/p6eval/niecza/boot/lib/CORE.setting line 1443 (die @ 5) ␤ at /home/p6eval/niecza/src/NieczaPassSimplifier.pm6 line 161 (run_optree @ 6) ␤ at /home/p6eval/niecza/src/NieczaPassSimplifier.pm6 line 166 (run_optree…
niecza v24-18-gaf64300: OUTPUT«===SORRY!===␤␤Unable to parse metachar:sym<< >> at /tmp/AQZifbKOQ7 line 1:␤------> oo($arg) { $arg }; say "hello bar" ~~ /<⏏&foo bar>/␤Couldn't find final '>'; gave up at /tmp/AQZifbKOQ7 line 1:␤------> rg) { $arg …
..rakudo 1ed6e5: OUTPUT«===SORRY!===␤regex assertion not terminated by angle bracket␤at /tmp/rPLqKKmiUQ:1␤------> arg) { $arg }; say "hello bar" ~~ /<&foo⏏ bar>/␤»
FROGGS O.o
TimToady nr: my token foo($arg) { $arg }; say "hello bar" ~~ /<&foo('bar')>/
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(6) to(9) text(bar) pos([].list) named({}.hash)>␤»
..rakudo 1ed6e5: OUTPUT«===SORRY!===␤regex assertion not terminated by angle bracket␤at /tmp/TTrsWHW2Uq:1␤------> arg) { $arg }; say "hello bar" ~~ /<&foo⏏('bar')>/␤»
TimToady hmm 19:56
nr: grammar G { token foo($arg) { $arg }; token TOP { <foo('bar')> } }; say G.parse("hello bar") 19:57
p6eval niecza v24-18-gaf64300: OUTPUT«Match()␤»
..rakudo 1ed6e5: OUTPUT«#<failed match>␤»
TimToady nr: grammar G { token foo($arg) { $arg }; token TOP { .*? <foo('bar')> } }; say G.parse("hello bar") 19:58
19:58 SamuraiJack left
p6eval rakudo 1ed6e5: OUTPUT«「hello bar」␤ foo => 「bar」␤␤» 19:58
..niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(9) text(hello bar) pos([].list) named({"foo" => #<match from(6) to(9) text(bar) pos([].list) named({}.hash)>}.hash)>␤»
TimToady nr: grammar G { token foo($arg) { $arg }; token TOP { .*? <foo bar> } }; say G.parse("hello bar")
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(9) text(hello bar) pos([].list) named({"foo" => #<match from(6) to(9) text(bar) pos([].list) named({}.hash)>}.hash)>␤»
..rakudo 1ed6e5: OUTPUT«Unmarshallable foreign language value passed for parameter '$arg'␤ in regex foo at /tmp/kc2aIJqSuK:1␤ in regex TOP at /tmp/kc2aIJqSuK:1␤ in method parse at src/gen/CORE.setting:10718␤ in block at /tmp/kc2aIJqSuK:1␤␤»
swarles o-o
TimToady that's about as close as you can get to <before foo>
but before itself is kind of a primitive 19:59
swarles well, what I was trying to implement was this
masak before is three primitives, last I counted ;)
swarles token num_seq ($numbers) { $numbers+ [ $numbers | _ <!before _> ]* }
Because I have to repeat that patterns a lot. 20:00
timotimo hm. i tried optimising QAST/Compiler.nqp: &want, but it appears i've made no change at all. probably all want nodes are already eliminated by the optimiser before the compiler gets to see them
masak swarles: have you seen the % modifier?
swarles: it might be useful to you here.
TimToady that looks kind of like $numbers % '_' to me
swarles I thought it was just a separator 20:01
TimToady how are you defining "separator"?
masak r: say "123_45_67_8" ~~ / ^ (\d+)+ % '_' $ /
p6eval rakudo 1ed6e5: OUTPUT«「123_45_67_8」␤ 0 => 「123」␤ 0 => 「45」␤ 0 => 「67」␤ 0 => 「8」␤␤»
swarles r: "1__224" ~~ /[ <[ 1 .. 9 ]> % '_' ]/
p6eval rakudo 1ed6e5: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter % (must be quoted to match literally)␤at /tmp/jNibFrqMY9:1␤------> "1__224" ~~ /[ <[ 1 .. 9 ]> ⏏% '_' ]/␤Unrecognized regex metacharacter [ (must be quoted to match literally)␤at /tm…
masak swarles: see my example. 20:02
20:02 blublue joined, fgomez joined
masak swarles: % needs to modify a quantifier. 20:02
TimToady Yeah, I spelled it wrong
TimToady has an obsolescent brane
swarles so, the example you provided prevents multiple '_' from being together? 20:03
TimToady try it
swarles r: "1__2" ~~ / ^ (\d+)+ % '_' $ /
p6eval rakudo 1ed6e5: ( no output )
timotimo either the optimisation didn't do anything, or it shaved off 1 second of the 180 second build time
swarles r: say "1__2" ~~ / ^ (\d+)+ % '_' $ /
p6eval rakudo 1ed6e5: OUTPUT«#<failed match>␤»
20:04 brrt joined
swarles r: say "_1" ~~ / ^ (\d+)+ % '_' $ / 20:06
p6eval rakudo 1ed6e5: OUTPUT«#<failed match>␤»
swarles r: say "1_" ~~ / ^ (\d+)+ % '_' $ /
p6eval rakudo 1ed6e5: OUTPUT«#<failed match>␤»
skids r: say "1__2" ~~ / ^ (\d+)+ % '_'+ $ /; # unless you want that to be three values 20:07
p6eval rakudo 1ed6e5: OUTPUT«「1__2」␤ 0 => 「1」␤ 0 => 「2」␤␤»
masak r: say "123_45_67_8" ~~ / ^ [\d+]+ % '_' $ / # I guess [] is better 20:09
p6eval rakudo 1ed6e5: OUTPUT«「123_45_67_8」␤␤»
masak less submatch noise :)
skids Match needs a built-in .svg method :-) 20:10
timotimo maybe not built-in, but i totally see how you could build a module for that 20:12
maybe combine it with the intelligence of the grammar debugger and you could be able to do some pretty cool visualisations
FROGGS thinks of visualisations of /(.)(.)/ 20:13
skids I was just joking that Match.perl tends to be rather ugly when you get into big nests. But yeah, especially if you could make it look like the notes you'd make explaining what matched what on a whiteboard. 20:17
swarles r: say "14e55" ~~ /[<digit> <digit>]<2> % 'e'/
p6eval rakudo 1ed6e5: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter < (must be quoted to match literally)␤at /tmp/LSHcYfdVtQ:1␤------> say "14e55" ~~ /[<digit> <digit>]<⏏2> % 'e'/␤Unable to parse regex; couldn't find final '/'␤at /tmp/LSHcYfdVtQ:1␤--…
TimToady thinks that .perl should probably prettify large utterances by default 20:18
IRC one-liners are not the interface we should be optimizing for here
swarles r: say "14e55" ~~ /[<digit> <digit>] ** 2 % 'e'/
p6eval rakudo 1ed6e5: OUTPUT«「14e55」␤ digit => 「1」␤ digit => 「4」␤ digit => 「5」␤ digit => 「5」␤␤»
swarles r: say "14e55" ~~ /[\d \d] ** 2 % 'e'/
p6eval rakudo 1ed6e5: OUTPUT«「14e55」␤␤»
swarles r: say "14e55" ~~ /[ [\d \d] ** 2 ] % 'e'/ 20:19
p6eval rakudo 1ed6e5: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter % (must be quoted to match literally)␤at /tmp/OkHGCM2LAj:1␤------> say "14e55" ~~ /[ [\d \d] ** 2 ] ⏏% 'e'/␤Unable to parse regex; couldn't find final '/'␤at /tmp/OkHGCM2LAj:1␤------…
masak r: say "14e55" ~~ /[<.digit> <.digit>] ** 2 % 'e'/
p6eval rakudo 1ed6e5: OUTPUT«「14e55」␤␤»
20:20 blublue left
masak how come Rakudo reports four 'digit' keys, instead of one key and an array of four? 20:20
swarles prehaps this should be removed
search.cpan.org/~dconway/Perl6-Rule...3/Rules.pm
r: say /"foo"<3>/ 20:21
p6eval rakudo 1ed6e5: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter < (must be quoted to match literally)␤at /tmp/bgtmPPZAO1:1␤------> say /"foo"<⏏3>/␤Unable to parse regex; couldn't find final '/'␤at /tmp/bgtmPPZAO1:1␤------> say /"foo"<⏏…
swarles r: say /foo<3>/
p6eval rakudo 1ed6e5: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter < (must be quoted to match literally)␤at /tmp/nOyPz2fioC:1␤------> say /foo<⏏3>/␤Unable to parse regex; couldn't find final '/'␤at /tmp/nOyPz2fioC:1␤------> say /foo<⏏…
20:21 benabik joined
TimToady that does seem like a buglet to return four digit pairs 20:21
jnthn good evening o/ 20:22
TimToady n: say "14e55" ~~ /[<digit> <digit>] ** 2 % 'e'/
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(5) text(14e55) pos([].list) named({"digit" => (#<match from(0) to(1) text(1) pos([].list) named({}.hash)>, #<match from(1) to(2) text(4) pos([].list) named({}.hash)>, #<match from(3) to(4) text(5) pos([].list) named({}.hash)>, #<match fr…
moritz \o jnthn
FROGGS r: say "14e55" ~~ /[ $<thing>= [<.digit> <.digit>] ] ** 2 % 'e'/;
p6eval rakudo 1ed6e5: OUTPUT«「14e55」␤ thing => 「14」␤ thing => 「55」␤␤»
TimToady niecza seems to return a list of four
masak: so I think you've got a bug 20:23
converting niecza to the 「14e55」 notation would be a great service to humanity, and probably LHF as well 20:24
FROGGS true
timotimo is there any low hanging fruit that would accelerate parsing in perl6? (especially the parsing stage of compiling the core setting...) 20:25
swarles Is there something like #region from C#, I suppose it's more of an editor thing, but I don't know if there is maybe a comment convention or something to separate sections of code
jnthn timotimo: Not that I'm aware of, or I'd have done it already...
timotimo heh, ok
TimToady timotimo: the problem is that you don
timotimo i seem to have improved build time by about 0.5 seconds, but the code got less pretty in the process 20:26
20:26 fhelmberger left
TimToady don't know whether you're reparsing because the setting changed or the compiler changed 20:26
if it's just the setting changed, you could do incremental recompiles
timotimo oh, i wasn't suggesting to only do parts of the parsing, i was actually thinking of making the parsing itself faster in some way
FROGGS swarles: what is #region?
timotimo getting incremental recompiles doesn't seem like a low hanging fruit at all 20:27
TimToady "the next 582 characters are a class definition, and they didn't change, so just reuse from last time"
jnthn We lost some speed when I put in highexpect handling.
swarles It's like setting up a section of the source file, for things like jumping to that section in particular or code folding
jnthn Not a *lol* but some.
er, not a *lot*
FROGGS swarles: I can't answer that question 20:28
jnthn TimToady: Just in case you missed it, I highlighted you yesterday with a spec tweak proposal.
swarles alrighty
TimToady jnthn: was driving to the pacific northwet yesterday...
jnthn TimToady: Not blocking on it Right Now, but I do want to look at compact arrays at some point in the not too distant future :)
20:28 brrt left
jnthn TimToady: Yeah, just wanted to make sure it didn't fall between the cracks. :) 20:29
swarles r: "'hello \' \n\\ world'" ~~ /\' [ <!['\\]> | \\. ]* \'/
p6eval rakudo 1ed6e5: ( no output )
swarles r: say "'hello \' \n\\ world'" ~~ /\' [ <!['\\]> | \\. ]* \'/
p6eval rakudo 1ed6e5: OUTPUT«#<failed match>␤»
skids swarles: could be a sidechannel use for pod. 20:30
20:30 wk joined
swarles r: "'hello \' \n\\ world'" ~~ /\' [ <!['\\]> | '\\' . ]* \'/ 20:30
p6eval rakudo 1ed6e5: ( no output )
swarles r: say "'hello \' \n\\ world'" ~~ /\' [ <!['\\]> | '\\' . ]* \'/ 20:31
p6eval rakudo 1ed6e5: OUTPUT«#<failed match>␤»
swarles gah
r: say "'hello \' \n\\ world'" ~~ /^\' [ <!['\\]> | '\\' . ]* \'$/
p6eval rakudo 1ed6e5: OUTPUT«#<failed match>␤»
swarles r: say "'hello \' \n\\ world'" ~~ /^ "'" [ <!['\\]> | '\\' . ]* "'" $/ 20:32
p6eval rakudo 1ed6e5: OUTPUT«#<failed match>␤»
swarles god, I thought I've used this regular expression before
TimToady shouldn't that ! be a - instead? 20:36
swarles r: say "'hello \' \n\\ world'" ~~ /^ "'" [ <-['\\]> | '\\' . ]* "'" $/
p6eval rakudo 1ed6e5: OUTPUT«#<failed match>␤»
swarles r: say "'hello \' \n\\ world'" ~~ /\' [ <-['\\]> | \\. ]* \'/
p6eval rakudo 1ed6e5: OUTPUT«「'hello '」␤␤»
swarles r: say "'hello \' \n\\ world'" ~~ /\' [ <-[\'\\]> | \\. ]* \'/ 20:37
p6eval rakudo 1ed6e5: OUTPUT«「'hello '」␤␤»
timotimo S05 doesn't talk much about the actions object that you can pass to Grammar.parse. where do i need to look?
swarles r: say "a" ~~ /<-[a]>/
p6eval rakudo 1ed6e5: OUTPUT«#<failed match>␤»
swarles r: say "A" ~~ /<-[a]>/
p6eval rakudo 1ed6e5: OUTPUT«「A」␤␤»
TimToady n: say "'hello \' \n\\ world'" ~~ /\' [ <-[\'\\]> | \\. ]* \'/ 20:38
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(8) text('hello ') pos([].list) named({}.hash)>␤»
TimToady n: say "'hello \' \n\\ world'" ~~ /\' [ . | \\. ]* \'/ 20:39
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(18) text('hello ' ␤\ world') pos([].list) named({}.hash)>␤»
TimToady LTM for the win :)
well, but maybe not for correctness...
n: say "'hello \' \n\\ world'" ~~ /\' [ . | \\. ]*? \'/ 20:40
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(8) text('hello ') pos([].list) named({}.hash)>␤»
TimToady right
swarles r: say "'hello \' \n\\ world'" ~~ /\' [ <-[\'\\]> | \\. ]*+ \'/
p6eval rakudo 1ed6e5: OUTPUT«===SORRY!===␤Quantifier quantifies nothing␤at /tmp/3Y7QWpf625:1␤------> n\\ world'" ~~ /\' [ <-[\'\\]> | \\. ]*+⏏ \'/␤ expecting any of:␤ postfix␤ infix or meta-infix␤ infix stopper␤ prefix or term…
swarles r: say "'hello \' \n\\ world'" ~~ /\' [[ <-[\'\\]> | \\. ]+]* \'/ 20:41
p6eval rakudo 1ed6e5: OUTPUT«「'hello '」␤␤»
swarles gah. I wish I knew where I was going wrong
TimToady too
n: say "'hello \' \n\\ world'" ~~ /\' [ \\. || . ]*? \'/ 20:42
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(8) text('hello ') pos([].list) named({}.hash)>␤»
swarles r: say "'hello \' \n\\ world'" ~~ /\' <-['\\]>
p6eval rakudo 1ed6e5: OUTPUT«===SORRY!===␤Regex not terminated␤at /tmp/tMijC0ZGfx:1␤------> "'hello \' \n\\ world'" ~~ /\' <-['\\]>⏏<EOL>␤ expecting any of:␤ postfix␤ infix or meta-infix␤ infix stopper␤ prefix or term␤ …
swarles err
TimToady n: say "'hello \' \n\\ world'" ~~ /\' [ \\. || . ]:*? \'/
swarles r: say "'hello \' \n\\ world'" ~~ /\' <-['\\]>* [ \\. <-[
p6eval rakudo 1ed6e5: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter < (must be quoted to match literally)␤at /tmp/HAh7dd1ixS:1␤------> ' \n\\ world'" ~~ /\' <-['\\]>* [ \\. <-⏏[␤Unrecognized regex metacharacter [ (must be quoted to match literally)␤a…
niecza v24-18-gaf64300: OUTPUT«===SORRY!===␤␤Unrecognized regex metacharacter : (must be quoted to match literally) at /tmp/Gak5722sdM line 1:␤------> llo \' \n\\ world'" ~~ /\' [ \\. || . ]:⏏*? \'/␤␤Unable to parse regex; couldn't find final '/' at …
swarles ... Curse the return key 20:43
TimToady n: say "'hello \\' \\n\\\\ world'" ~~ /\' [ \\. || . ]*? \'/ 20:44
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(21) text('hello \' \n\\ world') pos([].list) named({}.hash)>␤»
TimToady " is eating your \s
n: say "'hello \\' \\n\\\\ world'"
p6eval niecza v24-18-gaf64300: OUTPUT«'hello \' \n\\ world'␤»
swarles r: say "'hello \' \n\\ world'" ~~ /\' <-['\\]>* [ \\. <-['\\]>* ]* \'/ 20:45
p6eval rakudo 1ed6e5: OUTPUT«「'hello '」␤␤»
TimToady so the problem is not in the //, but in the ""
r: say "'hello \' \n\\ world'" # see
p6eval rakudo 1ed6e5: OUTPUT«'hello ' ␤\ world'␤»
swarles r: say 'hello \' \n\\ world'
p6eval rakudo 1ed6e5: OUTPUT«hello ' \n\ world␤» 20:46
TimToady r: say Q/hello \' \n\\ world'/
p6eval rakudo 1ed6e5: OUTPUT«hello \' \n\\ world'␤»
TimToady nr: say 「hello \' \n\\ world」 20:47
p6eval rakudo 1ed6e5: OUTPUT«===SORRY!===␤Two terms in a row␤at /tmp/a91ObsL9Pm:1␤------> say ⏏「hello \' \n\\ world」␤ expecting any of:␤ argument list␤ prefix or term␤ prefix or meta-prefix␤ postfix␤ infix or meta-infix…
..niecza v24-18-gaf64300: OUTPUT«===SORRY!===␤␤Unsupported use of bare 'say'; in Perl 6 please use .say if you meant $_, or use an explicit invocant or argument at /tmp/EWgyvAXLcb line 1:␤------> say⏏ 「hello \' \n\\ world」␤␤Confused at /tmp/EWgyvAXLcb …
swarles r: say Q/'hello \' \n\\ world'/ ~~ /\' [ <!['\\]> | \\. ]* \'/
p6eval rakudo 1ed6e5: OUTPUT«#<failed match>␤»
TimToady that's NYI
20:47 brrt joined, am0c is now known as am0cd
TimToady still want - instead of ! 20:47
20:47 am0cd is now known as am0c
swarles r: say Q/'hello \' \n\\ world'/ ~~ /\' [ <-['\\]> | \\. ]* \'/ 20:47
p6eval rakudo 1ed6e5: OUTPUT«「'hello \' \n\\ world'」␤␤»
jnthn Is that meant to be a zerowidth?
swarles Whoops, I pasted the earlier regular expression without changing that part 20:48
TimToady ! is a short way to write <before>
er, !befor
swarles ah. I thought it was a negation.
jnthn Thought so.
TimToady - is negation :)
swarles r: say "\\245" ~~ /\\[ <[ 0 .. 7 ]> ** 3 ]/ 20:51
p6eval rakudo 1ed6e5: OUTPUT«「\245」␤␤»
TimToady jnthn: I'm fine with your postcircumfix proposal; I was a little bit surprised when they got implemented as methods in the first place, but wasn't smart enough to spot the performance issue
20:51 kivutar joined
dalek kudo/nom: 7707e42 | (Tobias Leich)++ | src/Perl6/Actions.pm:
fix, so that $(0) isnt treated like $()
20:52
TimToady (unless I'm revising history again...)
jnthn TimToady: Do my suggested changes to Positional and Associative make sense also?
The other bit I'm really not sure what to do with is postcircumfix:<( )> 20:53
20:54 fgomez left
TimToady invocation is pretty fundamental too... 20:54
naming it as a postcircumfix is probably wrongish as well 20:55
jnthn Also, some want at_pos to be AT_POS ;)
TimToady it's more like FETCH and STORE
I'm fine with uppercase for primitives 20:56
jnthn OK
FROGGS .oO( FINE )
FROGGS .oO( am I a primitive? ) 20:57
20:57 dduncan joined
TimToady btw, a while ago you asked about Junction.Str, which is actually prohibited in S32/Containers:1215 20:58
20:58 swarles left
skids r: perl6 -e 'grammar f { token ohai { o \/ };}; class Actions { method ohai ($/) { make "OHAI!" }}; f.parse("o/", :actions(Actions), :rule<ohai>).ast.say; # working example for timotimo. 20:58
p6eval rakudo 1ed6e5: OUTPUT«===SORRY!===␤Two terms in a row␤at /tmp/2KXOFESUWT:1␤------> perl6 -e ⏏'grammar f { token ohai { o \/ };}; clas␤ expecting any of:␤ postfix␤ infix or meta-infix␤ infix stopper␤ statement end␤ …
TimToady I've speculated before that print should have a more primitive stringifier
skids oh dear not so working heh 20:59
jnthn It does compared to say ;)
skids r: grammar f { token ohai { o \/ };}; class Actions { method ohai ($/) { make "OHAI!" }}; f.parse("o/", :actions(Actions), :rule<ohai>).ast.say; # working example for timotimo.
p6eval rakudo 1ed6e5: OUTPUT«OHAI!␤»
20:59 dduncan left
skids timotimo: note also you can curry your actions into the grammar's parse method by defining your own w/ callwith. 21:00
masak I found the bit about DateTime::Duration on CPAN adding things "in the wrong order". it's not as clear-cut as I thought: metacpan.org/module/DateTime#Addin...a-Datetime 21:02
it says it does days, then months, then minutes, seconds, and nanoseconds. 21:03
that feels like a very weird order to me. it's neither biggest-to-smallest nor vice versa.
21:03 hash_table left
masak but the documentation also contains a warning that this is the behavior. it doesn't say "oh well, it is the way it is and I can't break backwards compatibility". 21:04
timotimo skids: do i really need callwith? shouldn't .given (or is it called .supposing?) be enough?
masak ISTR autarch saying that, but I don't find it on the page, nor in my email archives.
timotimo: .assuming?
timotimo that's the one! :)
TimToady I can see why it's that way; days are a fixed-width, compared to the others
it's like counting codepoints before graphemes... 21:05
FROGGS TimToady: a day can have 23 to 25 hours here
.oO( and 26 hours on Bajor )
21:06
TimToady yes, but if you ask for the same time 3 days from now, that's what you get
FROGGS thats the same when adding one month
TimToady how long is one month?
FROGGS I will get the first of march when adding 1 month to the 1st of feb
28-31 days
masak TimToady: yes, but wouldn't biggest-to-smallest make as much sense? 21:07
TimToady wonders what Dec 31 + 2 months comes out to...
masak I'll try it with CPAN's DateTime. 21:08
21:08 kaare_ left, kaare_ joined
FROGGS masak: a good test case would be to add two months to dec 31, then two days, and then vice versa as the second test 21:09
maybe the result is the same
and that is what I believe
skids timotimo: .assuming might work. I haven't taken that tool out of the dust cover yet :-)
FROGGS because a month has no fixed width, it matters to what date you add it 21:10
masak honestly I'd rather copy someone else's sane-ish date-adding semantics here than try to come up with my own.
but I'm also interested in fixing known mistakes CPAN's DateTime made.
FROGGS true, there is so much magic going on...
TimToady well, to the extent that dates are insane, fixing one mistake will unfix a different mistake 21:11
21:11 zby_home_ joined
FROGGS I guess you will need a few thousand test cases to be on a fairly safe side 21:12
masak $ perl -MDateTime -E 'my $dt = DateTime->new( year => 2012, month => 12, day => 31 ); $dt->add( months => 2 ); say $dt'
2013-03-03T00:00:00
21:12 japhb_ joined
FROGGS uhhh 21:12
21:13 benabik_ joined, benabik left, benabik_ is now known as benabik
skids
.oO(adding months is a slightly insane thing to do anyway. Or at least, subject to expressional ambiguity.)
21:13
FROGGS perl -MDateTime -E 'my $dt = DateTime->new( year => 2013, month => 02, day => 28 ); $dt->add( months => 2 ); say $dt' 21:14
2013-04-28T00:00:00
so it adds 2 to the month, and then tries to set the day
if the month has less, add these days 21:15
geekosaur what happens if you add 1 month on 30 Jan? :)
FROGGS so the first of a month will always be the first
depends on how many days the feb has
can be march the first or the second 21:16
masak geekosaur: see my output above; very similar case.
21:16 vividsnow left
masak I appreciate your enthusiasm over the "impossible" situations. that's not what interests me right now, however. what interests me is finding sane semantics for a .delta(:months(2), :days(1), :minutes(40)) method for Perl 6's DateTime. 21:17
in other words, please assume the "one month after 30 Jan" problem is solved. 21:18
(because it is)
FROGGS it is
21:18 zby_home_ left
TimToady sees dead unicorns 21:18
21:19 brrt left
FROGGS masak: whats wrong with Perl 5's DateTime semantic? 21:19
I like the ->add and ->subtract methods
skids How about just not allowing :months in deltas?
FROGGS the same goes for years, days, minutes and so on... you cant disallow all ;o) 21:21
masak skids: months aren't really a problem. forget about months.
skids I suppose with leap seconds, yes
TimToady do it all in seconds, with snap-to-grid semantics optional
masak TimToady: yeah, but people like to say "a year later". 21:22
TimToady: that's part of the reason we're introducing the method.
of course, we could mandate only one named argument at a time... :)
TimToady
.oO(ordered named arguments...)
masak so you'd have to write .delta(:months(2)).delta(:days(1)).delta(:minutes(40))
kind of a weird requirement, though. 21:23
jnthn yes, but an escape hatch if people find the default order unsuitable... :) 21:24
masak I guess my question is whether there is an order that is somehow least unsuitable. 21:26
FROGGS you could add a param that overrides the default order 21:27
masak bzzt. wrong answer! :P 21:28
FROGGS meh
masak focus! we want simplicity, not complicatedness.
:P
FROGGS it is simple if one doesnt care
he will get what Perl 5's DateTime did
masak all I'm saying is "add a parameter" is the refuge of cowards. 21:29
be bold, and spec it right from the start!
skids does "man at" to see how it is handled there
masak in other news, I don't like the :by parameter. :)
dalek p-jvm-prep: 39a9db0 | jonathan++ | src/org/perl6/nqp/ (5 files):
Add a REPR for context references.

We don't make contexts have to be GCable, 6model objects. But if we want to talk about them first class, they need objectifying. This will provide that wrapping.
p-jvm-prep: eb06569 | jonathan++ | / (2 files):
Implement nqp::ctx, nqp::ctxouter, nqp::ctxcaller.
p-jvm-prep: aadb6da | jonathan++ | / (2 files):
Implement nqp::curcode() and nqp::callercode().
p-jvm-prep: 6228338 | jonathan++ | docs/ROADMAP:
Update ROADMAP.
FROGGS r: say (a => 2, c => 4, B => 7) 21:30
p6eval rakudo 7707e4: OUTPUT«"a" => 2 "c" => 4 "B" => 7␤»
FROGGS is the order guaranteed to be the way I declared it?
jnthn Yes, because you just wrote a list of paris.
Once you turn it into a hash, it's not guaranteed. 21:31
FROGGS hmmm
but you can slurp it as a list of pairs?
21:31 slayer101_ left
masak sure. 21:31
jnthn uh, not if you pass it as foo(a => 2, ...)
masak no, of course not.
jnthn Then they get passed as named, and the order is not preserved. 21:32
FROGGS damn
skids hah. at dodged the question by only allowing one e.g. "+5 hours" field.
masak but you *can* slurp it as a list of pairs :P
I kinda like "only allow one".
ooh!
.delta(5, "days")
always two positional parameters. 21:33
I think we have a winner.
FROGGS what about .delta(5, "days", 2, "months") ?
jnthn urgh...strings?
diakopter <gurgle> 21:34
FROGGS calling .delta($$) plenty of times is weird
skids Well, except then people are wondering why you won't eat your own dog food.
jnthn .delta(5, "monkeys")
skids .delta(5, "siestas")
jnthn .delta(5, "lightyears")
masak .oO( U Y no like the winner, huh? ) :P
FROGGS bah, lightyears -.-
jnthn wait, that's a distance :P
masak s/U Y/Y U/ 21:35
FROGGS *g*
jnthn <-- failed physics :P
TimToady + 2months + 5days
jnthn postfixes? :)
TimToady yep
masak decides to killfile #perl6 for a while for his blood pressure's sake
TimToady just like 2i
jnthn Will have to be $a\months though 21:36
skids Actually that gives merit to the idea of DateTime literals.
jnthn Which is a little...icky. :)
I like it for the literal form, though.
FROGGS I like the named params, if you specify more that one param to .delta, there is a default order, if you dont like it do it in sequences 21:37
TimToady it's really verbose compared to the postfixes 21:38
FROGGS the problem I see about +2months is that it looks ugly when using variables, and, this looks like a fixed-width duration when it isnt
21:39 benabik left
FROGGS or maybe it even is a fixed with duration 21:39
since +1months is always 31 days 21:40
no, wait
1months is the same day-of-the-month from today to the same day of the month 21:41
1months is the same day-of-the-month from today to the same day of the next* month
skids +1months is .delta(+1months) :-) 21:42
FROGGS thats the reason why DateTime::Span begins at a concrete timestamp and ends at a concrete one (or inf) 21:43
skids: right
21:44 kivutar left
FROGGS has somebody knowledge of DateTime modules in other languages? 21:44
I just know php's date and strftime, but that is crap ;o) 21:45
dalek p-jvm-prep: ebc30a8 | jonathan++ | / (3 files):
Implement compiler registry (getcomp/bindcomp).
21:46
jnthn Time for some rest...'night
skids o/
FROGGS gnight
21:48 rindolf left, am0c left 21:56 fgomez joined 21:59 kaare_ left
skids hopes his car warms up fast. it is cohwlduh. 22:01
oh and I have to pump gas. gah. 22:02
22:07 skids left
lue TimToady: I thought as well of postfixes (e.g. s for seconds, min for minutes, etc.) 22:07
22:19 PacoAir left, stevan_ left 22:20 stevan_ joined
lue How is the "one month after 30 Jan" solved? And what other issues are there? 22:20
22:25 spider-mario left
FROGGS lue: same math as Perl 5's DateTime. add one month, and if 30 > days-of-feb, then add 30 - days-of-feb to the date 22:25
dont know what other issues are there 22:26
22:30 stevan_ left
lue
.oO(Why can't our timekeeping systems behave‽)
22:31
22:39 kivutar joined, kivutar left
masak 'night, #perl6 22:46
tadzik weekend! 22:47
22:50 benabik joined 22:53 Rix left
lue g'night o/ 22:57
23:02 bluescreen10 left 23:05 atrodo_ joined 23:07 atrodo left, atrodo_ is now known as atrodo 23:09 Rix joined 23:10 MayDaniel left 23:22 b1rkh0ff left 23:24 stopbit left 23:27 Chillance left 23:38 b1rkh0ff joined 23:42 skids joined 23:47 b1rkh0ff left 23:52 jrockway joined