»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
00:00 BrassLantern joined 00:01 dainis joined
P6fr m: say Q§5+9+6+3+5+1+4+7§.split("+") 00:02
camelia rakudo-moar a37cd2: OUTPUT«(5 9 6 3 5 1 4 7)␤»
P6fr m: say :a[5+9+6+3+5+1+4+7].split("+") 00:03
camelia rakudo-moar a37cd2: OUTPUT«Use of uninitialized value of type Any in string context␤Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block <unit> at <tmp> line 1␤Cannot resolve caller split(Pair, Str); none of these signatures match:␤ in blo…»
P6fr ok variable 00:04
skids say (:a[5+9+6+3+5+1+4+7]).perl
m: say (:a[5+9+6+3+5+1+4+7]).perl
camelia rakudo-moar a37cd2: OUTPUT«:a([40])␤»
00:05 dainis left
P6fr m: my @a =[5+9+6+3+5+1+4+7];say :a@a.split("+"); 00:06
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3my @a =[5+9+6+3+5+1+4+7];say :a7⏏5@a.split("+");␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ …»
skids What are you trying to do? 00:07
00:07 BrassLantern left
parabolize P6fr: split and trans work on strings not arrays or lists 00:07
00:09 BrassLantern joined, BrassLantern left, BrassLantern joined 00:18 cpage_ joined 00:19 cpage_ left 00:21 cpage_ joined
P6fr "5+9+6+3+5+1+4+7".trans("+" =>" ") 00:21
m: "5+9+6+3+5+1+4+7".trans("+" =>" ")
camelia ( no output )
00:21 dainis joined
P6fr m: say "5+9+6+3+5+1+4+7".trans("+" =>" ") 00:21
camelia rakudo-moar a37cd2: OUTPUT«5 9 6 3 5 1 4 7␤»
P6fr m: say [+] "5+9+6+3+5+1+4+7".trans("+" =>" ") 00:22
camelia rakudo-moar a37cd2: OUTPUT«Cannot convert string to number: trailing characters after number in '035⏏5 9 6 3 5 1 4 7' (indicated by ⏏)␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
P6fr lol
AlexDaniel P6fr: so, what are you trying to do? 00:23
parabolize m: say [+] [5, 9, 6, 3, 5, 1, 4, 7] 00:24
camelia rakudo-moar a37cd2: OUTPUT«40␤»
P6fr i rien de particulier je fais quelque test pour bien comprendre le fonctionnement du langage, regarder quels sont les routines, methods a utilisé.
nothing special I do some testing to understand the functioning of language, look at what are the routines, methods used.
yes parabolize numeric
00:25 dainis left
P6fr m: say so 1 S& 2 S& 4; 00:36
camelia rakudo-moar a37cd2: OUTPUT«True␤»
P6fr m: say so 1 S& 2 S& 3;
camelia rakudo-moar a37cd2: OUTPUT«True␤»
P6fr m: say so 1 S& 2 S& 1;
camelia rakudo-moar a37cd2: OUTPUT«True␤»
P6fr m: substr('abc': 1).say 00:46
camelia rakudo-moar a37cd2: OUTPUT«bc␤»
P6fr m:my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet:delete 00:52
m: my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet:delete
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '%alphabet:delete' is not declared␤at <tmp>:1␤------> 3my %alphabet = 'A'..'Z' Z=> 1..26;say 7⏏5%alphabet:delete␤»
P6fr m: my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet[]:delete
camelia rakudo-moar a37cd2: OUTPUT«Can not remove elements from a Hash␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
skids m: my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet{}:delete 00:53
camelia rakudo-moar a37cd2: OUTPUT«(26 22 24 6 2 1 23 11 9 25 21 8 20 19 14 12 7 5 4 17 16 15 13 3 18 10)␤»
P6fr ha oui c'est vrai
thx
{} array ok 00:54
my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet{}:delete;say now - INIT now; 00:56
m: my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet{}:delete;say now - INIT now;
camelia rakudo-moar a37cd2: OUTPUT«(26 22 24 6 2 1 23 11 9 25 21 8 20 19 14 12 7 5 4 17 16 15 13 3 18 10)␤0.0076812␤»
00:59 leokitten joined
leokitten Hi to all 00:59
skids o/
gfldex m: say 'ohai leokitten!' 01:00
camelia rakudo-moar a37cd2: OUTPUT«ohai leokitten!␤»
gfldex i'm tempted to walk over the whole docs and change any say to a dd that isn't actually meant to do what say does.
leokitten I mentioned the other night that when you search on Google the term "rakudo" the first search result is from rakudo.org and the result snippet is out of date 01:01
It reads "An implementation of the Perl 6 specification that runs on the Parrot virtual machine."
gfldex leokitten: your first hit may not be my first hit
P6fr m: my %alphabet = 'A'..'Z' Z=> 1..26; say %alphabet{}.trans("A".."Z" =>"");say now - INIT now; 01:02
camelia rakudo-moar a37cd2: OUTPUT« 1␤ 2␤ 3␤ 4␤ 5␤ 6␤ 7␤ 8␤ 9␤ 10␤ 11␤ 12␤ 13␤ 14␤ 15␤ 16␤ 17␤ 18␤ 19␤ 20␤ 21␤ 22␤ 23␤ 24␤ 25␤ 26␤0.00914672␤»
leokitten I think they said pmichaud is the site owner
gfldex also, we have very little influence about the summary on google.*
leokitten Oh I thought you can control what the Google result snippet shows with <meta> tags 01:03
And other ways
P6fr m: my %alphabet = 'A'..'Z' Z=> 1..26; say trans(%alphabet.keys =>"");say now - INIT now;
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ trans used at line 1. Did you mean 'rand', 'tanh', 'srand'?␤␤»
P6fr m: my %alphabet = 'A'..'Z' Z=> 1..26; say trans(%alphabet{}.keys =>"");say now - INIT now;
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ trans used at line 1. Did you mean 'rand', 'tanh', 'srand'?␤␤»
gfldex leokitten: you can ask it to re-crawl the site what it may or not may do 01:04
leokitten Well hope it could be update to say more like "An implementation of Perl 6 on MoarVM and JVM..." Parrot is bye bye 01:05
P6fr JVM ? bad idea. JVM is better on the langage compilated
no script
leokitten gfldex can you reproduce what I see? Please type "rakudo" into google 01:06
skids leokitten: yes that's what google has cached as a summary
01:07 leokitten left
gfldex leokitten: i can 01:07
01:07 leokitten_ joined
leokitten_ pmichaud++ please if you can update the Google result snippet here is their page on how to change it developers.google.com/custom-searc...s/snippets 01:11
skids leokitten: use .tell to leave a message for later 01:12
leokitten_ How do i? Like pmichaud.tell ?
AlexDaniel P6fr: actualy, it works very well
l*
skids ".tell pmichaud"
01:12 dvinciguerra_ joined
leokitten_ .tell pmichaud please if you can update the Google result snippet here is their page on how to change it developers.google.com/custom-searc...s/snippets 01:13
yoleaux leokitten_: I'll pass your message to pmichaud.
leokitten_ Yoleaux++
P6fr he downside of a jvm for scripting languages is that it will take more time to start. Good after in length is time is caught up with all the optimizations they can make 01:14
gfldex P6fr: so does moarvm 01:15
leokitten_ Perl 6 is really awesome, gosh all the features I feel like I'm still just scratching the surface
P6fr I somewhat exaggerated by saying that it is a bad idea
gfldex moarvm is make on perl6 01:16
01:17 leokitten_ left
P6fr If I am not mistaken 01:17
gfldex m: sub term:<♥>() { say 'I ♥ Perl6;' }; ♥; 01:18
camelia rakudo-moar a37cd2: OUTPUT«I ♥ Perl6;␤»
skids P6fr: moarvm is written in C mostly. 01:20
AlexDaniel mostly?
P6fr no perl mostly
AlexDaniel what parts of moarvm are not in C?
P6fr ha ?
01:21 dainis joined
gfldex there are some Perl 5 scripts that generate a bunch of stuff 01:21
P6fr OK I confused with rakudo sorry
skids I think there's some dsl and scripting to build the instruction tiler IIRC.
P6fr in the memory
my
skids And maybe some asm. 01:22
01:28 adu joined, molaf joined
P6fr m: my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet{} 01:31
camelia rakudo-moar a37cd2: OUTPUT«{A => 1, B => 2, C => 3, D => 4, E => 5, F => 6, G => 7, H => 8, I => 9, J => 10, K => 11, L => 12, M => 13, N => 14, O => 15, P => 16, Q => 17, R => 18, S => 19, T => 20, U => 21, V => 22, W => 23, X => 24, Y => 25, Z => 26}␤»
01:31 Xliff joined
Xliff \o 01:31
P6fr m: my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet{%keys}
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '%keys' is not declared. Did you mean '&keys'?␤at <tmp>:1␤------> 3abet = 'A'..'Z' Z=> 1..26;say %alphabet{7⏏5%keys}␤»
P6fr m: my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet.values
camelia rakudo-moar a37cd2: OUTPUT«(26 22 24 6 2 1 23 11 9 25 21 8 20 19 14 12 7 5 4 17 16 15 13 3 18 10)␤»
P6fr hello Xliff 01:32
m: my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet.values.sort
camelia rakudo-moar a37cd2: OUTPUT«(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26)␤»
japhb .sort.values works as well (.sort on a hash produces an ordered list of pairs)
I guess .sort>>.value 01:33
P6fr m: my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet.values.sort;say now - INIT now;m: my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet.sort.values;say now - INIT now; 01:34
camelia rakudo-moar a37cd2: OUTPUT«Potential difficulties:␤ Redeclaration of symbol %alphabet␤ at <tmp>:1␤ ------> 3.sort;say now - INIT now;m: my %alphabet7⏏5 = 'A'..'Z' Z=> 1..26;say %alphabet.sort␤(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2…»
P6fr m: my %alphabet = 'A'..'Z' Z=> 1..26;say %alphabet.values.sort;say now - INIT now;say %alphabet.sort.values;say now - INIT now;
camelia rakudo-moar a37cd2: OUTPUT«(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26)␤0.0079270␤(A => 1 B => 2 C => 3 D => 4 E => 5 F => 6 G => 7 H => 8 I => 9 J => 10 K => 11 L => 12 M => 13 N => 14 O => 15 P => 16 Q => 17 R => 18 S => 19 T => 20 U => 21 V => 22 W =…»
P6fr ok 01:35
01:36 jack_rabbit joined 01:37 dainis left
Xliff m: my $a = Any; say $a.defined 01:42
camelia rakudo-moar a37cd2: OUTPUT«False␤»
Xliff m: my $a = Any; say $a ~~ Any; say 1 ~~ Any; 01:43
camelia rakudo-moar a37cd2: OUTPUT«True␤True␤»
Xliff Grrr....
BenGoldberg Does anyone know if the ff operator could have been implemented as a macro?
Xliff How can I test if a scalar holds the "Any" type?
BenGoldberg is aware that macros are experimental, but still...
P6fr m: my $a = Any; say $a.WHAT 01:44
camelia rakudo-moar a37cd2: OUTPUT«(Any)␤»
Xliff Somehow my C lib is returning a value that gets thrown into a scalar as "Any" but it still passes a .defined check.
P6fr POUR ONCE THAT IT IS ME WHO HELP ^^
01:46 colomon joined
Xliff LOL P6fr! 01:46
Hey, it's a bit more high level than I want, but if it works... ;)
Ohe thing though.
BenGoldberg m: my $a; say so $a.WHAT; 01:47
camelia rakudo-moar a37cd2: OUTPUT«False␤»
Xliff m: my $a = 1; say $a.WHAT ~~ Any
camelia rakudo-moar a37cd2: OUTPUT«True␤»
BenGoldberg Note that $a.WHAT is returning an undefined value...
P6fr you want which result ? 01:50
01:51 adu left
P6fr m: my $a = Any; say $a.does(Any) 01:54
camelia rakudo-moar a37cd2: OUTPUT«True␤»
P6fr Xliff ?
:D
skids m: my Any:D $i = Nil; $i.WHAT.say; $i.DEFINITE.say; $i.defined.say;
camelia rakudo-moar a37cd2: OUTPUT«(Any:D)␤False␤False␤»
skids Hrm so it isn't that... 01:55
m: my Any:D $a = Any.new; say $a.WHAT; say $a.defined 01:57
camelia rakudo-moar a37cd2: OUTPUT«(Any)␤True␤»
skids m: Any.new.perl.say
camelia rakudo-moar a37cd2: OUTPUT«Any.new␤»
skids :/
01:57 colomon left
P6fr m: my $var = 1;say $var.does(any) 01:57
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Function "any" may not be called without arguments (please use () or whitespace to denote arguments, or &any to refer to the function as a noun)␤at <tmp>:1␤------> 3my $var = 1;say $var.does(any7⏏5)…»
P6fr m: my $var = 1;say $var.does(Any)
camelia rakudo-moar a37cd2: OUTPUT«True␤»
P6fr ... 01:58
Xliff OK. That's freaking weird.
skids I suppose it should be fine to instantiate Any. I guess... someone with more type calculus foo might chime in.
Xliff I must be seeing things. I will circle back to the weirdness, tomorrow.
gfldex .oO( Nil statement considered harmful )
P6fr m: my $var = 1;say $var.WHAT
camelia rakudo-moar a37cd2: OUTPUT«(Int)␤»
Xliff skids: I think there is a problem in rakudo
P6fr int = Any ? 01:59
Xliff skids: If you have some spare cycles, could you check out my code and verify some behavior for me?
If not, it can wait until a more reasonable hour.
01:59 colomon joined
skids Xliff: where at? 01:59
BenGoldberg m: my $i = Any but Int { 42 }; say $i + 3; 02:01
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Unexpected block in infix position (missing statement control word before the expression?)␤at <tmp>:1␤------> 3my $i = Any but Int7⏏5 { 42 }; say $i + 3;␤ expecting any of:␤ infix␤ …»
Xliff skids: github.com/Xliff/p6-XML-LibXML.git 02:02
skids m: Any.WHICH.say; Any.WHICH.say; Any.new.WHICH.say; Any.new.WHICH.say # OK, not a singleton.
camelia rakudo-moar a37cd2: OUTPUT«Any␤Any␤Any|67319616␤Any|67319648␤»
Xliff Once you clone, switch to the 07dtd branch. 02:03
P6fr m: my $i = Any but Int 42 ; say $i + 3;
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3my $i = Any but Int7⏏5 42 ; say $i + 3;␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ st…»
Xliff skids: Then run "perl6 --stagestats -Ilib t/07dtd.t" -- test should complete.
P6fr bon moi je ne peut définitvement pas t’aider lol 02:04
well me I cannot definitely help lol
one day perahps
Xliff skids: Then go into lib/XML/LibXML/Dtd.pm and look in the parse-string method. Check out the comments. Comment the line that starts with say "P:"
Then rerun test and watch it fail one test that passed, earlier. 02:05
02:05 bob777 joined
Xliff Imma go get some water. 02:05
BenGoldberg m: my $i = Any but role { method Int { 42 } }; say $i + 3; 02:06
camelia rakudo-moar a37cd2: OUTPUT«Use of uninitialized value of type Any+{<anon|56665968>} in numeric context in block <unit> at <tmp> line 1␤3␤»
BenGoldberg m: my $i = Any but role { method Int { 42 } }; say $i;
camelia rakudo-moar a37cd2: OUTPUT«(Any+{<anon|73045840>})␤»
BenGoldberg m: my $i = Any but role { method Int { 42 } }; $i.= new; say $i;
camelia rakudo-moar a37cd2: OUTPUT«Any+{<anon|61339584>}.new␤»
BenGoldberg m: my $i = Any but role { method Int { 42 } }; $i.= new; say $i + 3;
camelia rakudo-moar a37cd2: OUTPUT«Cannot resolve caller Numeric(Any+{<anon|55289824>}: ); none of these signatures match:␤ (Mu:U \v: *%_)␤ in block <unit> at <tmp> line 1␤␤»
BenGoldberg m: my $i = Any but role Numeric { method Int { 42 } }; $i.= new; say $i + 3; 02:07
camelia rakudo-moar a37cd2: OUTPUT«Cannot resolve caller Numeric(Any+{Numeric}: ); none of these signatures match:␤ (Mu:U \v: *%_)␤ in block <unit> at <tmp> line 1␤␤»
skids Xliff: The tests only run 38/57 in both cases. I commented out an "R:" line there was no "P:" 02:09
Xliff One sec.
skids: Sorry. I gave you the wrong file.... 02:10
skids: Then go into lib/XML/LibXML/Parser.pm and look in the parse-string method. Check out the comments. Comment the line that starts with say "P:"
skids What kind of monster have you created that takes 26 seconds to compile :-)
Xliff LOL!
I know, right?!?!
02:11 AndyBotwin joined
Xliff My guess it is all the stuff in CStructs.pm that's giving rakudo hives. 02:11
Either that or just NativeCall issues in general... but.... donno...
skids Yeah test 37 fails. 02:12
Xliff skids: After a new rakudo build it takes over 50 seconds.
skids: Soo... you see what's driving me O_o ?
skids Well, the test is that an exception gets thrown so maybe that nativecast is throwing an exception? 02:13
Xliff It should get caught at the fail.
skids No if it throws it would only get caught by an actual catch. 02:14
Xliff If you uncomment the A: line, you will see that the .defined test is False
fail XML::LibXML::Error.get-last(self, :orig($str)) unless $ret.defined;
^^ That should fire. 02:15
It doesn't.
But if you leave the P: line it, it does.
No way a "say" should affect the code like that.
skids { say "P: {+(nativecast(Pointer, $ret))}"; 02:18
CATCH { $_.message.say } }
Invocant requires an instance of type NativeCall::Types::Pointer, but a type object was passed. Did you forget a .new?
02:21 P6fr left
Xliff Huh! 02:21
Well that's embarrassing! 02:22
02:22 Guest66 joined
Xliff So the P: line throws an exception. 02:22
That causes the test to pass. OK.
02:22 Guest66 is now known as P6fr 02:23 colomon left
Xliff But why doesn't the fail get thrown?!? 02:23
skids Also in 07dtd.t, I think the Failure is protected from throwing by assigning to $doc.
Xliff Seriously?
skids Failures only throw when sunk.
(Or other things, but basically interacted with)
They are meant not to blow up unless it becomes obvious someone forgot to write error handling code. 02:24
Xliff Should that be replaced with a die()?
Or better question.... how can you check for a fail? 02:25
skids It's a matter of taste. Do you want users to have to use a CATCH if they want to handle the error, or not.
Xliff What's the perl6 way to go?
skids Unfortunately, recently Failures have gotten tricky to work with due to the "useless use of" compiler work. 02:26
Xliff I have no problems with try/catch if the user wants error handling.
skids It used to be if you just did $a = could_fail(); $a; # that would throw.
skids tries to remember what the best trick was. 02:27
Xliff I just need something that will trigger the dies-ok() routine
But not be a complete pain in general use if someone does want to write error handling code for that situation. 02:28
I need to talk to FROGGS about that.
02:29 dvinciguerra_ left
skids I'd go with a die or throw for now, Failure really needs work... for example there is no option to prevent an unhandled one from not spewing noise when it gets GCd 02:29
Xliff Yeah. I just used a die and it workedf. 02:31
So much for being fancy...
Thanks, skids++!!
skids np
P6fr m: my %alphabet = 'A'..'Z' Z=> 1..26;my %voyelle = ('A' => 1,'E' => 5,'I' => 9,'O' => 15,'U' => 21,'Y' => 25 );say "name".trans([%alphabet.keys] => [%alphabet.values]).trans([%alphabet.keys] => [%alphabet.values])' 02:33
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3([%alphabet.keys] => [%alphabet.values])7⏏5'␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ …»
P6fr m: my %alphabet = 'A'..'Z' Z=> 1..26;my %voyelle = ('A' => 1,'E' => 5,'I' => 9,'O' => 15,'U' => 21,'Y' => 25 );say "name".trans([%alphabet.keys] => [%alphabet.values])
camelia rakudo-moar a37cd2: OUTPUT«name␤»
P6fr hum.. 02:34
m: my %alphabet = 'A'..'Z' Z=> 1..26;my %voyelle = ('A' => 1,'E' => 5,'I' => 9,'O' => 15,'U' => 21,'Y' => 25 );say "NAME".trans([%alphabet.keys] => [%alphabet.values]) 02:35
camelia rakudo-moar a37cd2: OUTPUT«141135␤»
P6fr haaaaaa
In other languages, should have been automatically through a loop 02:36
now, what is the best and fastest. method or loop? 02:37
02:38 hwcomcn joined 02:40 bob777 left 02:41 labster left
gfldex P6fr: at some point (when the optimiser is actually optimising stuff) .trans will be the fastest 02:42
P6fr yeah
skids m: my %alphabet = "A".."Z" Z=> ("z"..."a"); say %alphabet.perl; say "ABCDEFGHIJ".trans(%alphabet.pairs) 02:43
camelia rakudo-moar a37cd2: OUTPUT«{:A("z"), :B("y"), :C("x"), :D("w"), :E("v"), :F("u"), :G("t"), :H("s"), :I("r"), :J("q"), :K("p"), :L("o"), :M("n"), :N("m"), :O("l"), :P("k"), :Q("j"), :R("i"), :S("h"), :T("g"), :U("f"), :V("e"), :W("d"), :X("c"), :Y("b"), :Z("a")}␤zyxwvutsrq␤»
P6fr in some language, native functions/methods most commonly used are the most optimized. Perl will do the same thing?
skids Maybe. It depends how smart the automatic optimization gets. 02:44
02:44 kid51 joined, noganex joined
P6fr ok 02:44
geekosaur it tries to; optimization is an ongoing thing currently 02:45
P6fr Yes I have seen ca on the site of moarvm 02:46
02:46 hwcomcn left
P6fr why .perl ?? 02:47
02:47 hwcomcn joined
P6fr what is it 02:47
02:47 hwcomcn left
skids It usually produces perl6 code to replicate the object. 02:47
02:48 hwcomcn joined
P6fr hum 02:48
skids Sometmes it also helps you tell the difference between different things that look the same under say/gist
So it reveals more structure.
P6fr m: my %alphabet = "A".."Z" Z=> ("z"..."a"); say %alphabet; say "ABCDEFGHIJ".trans(%alphabet.pairs) 02:49
camelia rakudo-moar a37cd2: OUTPUT«{A => z, B => y, C => x, D => w, E => v, F => u, G => t, H => s, I => r, J => q, K => p, L => o, M => n, N => m, O => l, P => k, Q => j, R => i, S => h, T => g, U => f, V => e, W => d, X => c, Y => b, Z => a}␤zyxwvutsrq␤»
P6fr haaaa the dump ?
var_dump in php
skids Mostly... there is also .dd 02:50
P6fr m: my %alphabet = "A".."Z" Z=> ("z"..."a"); say %alphabet.dd; say "ABCDEFGHIJ".trans(%alphabet.pairs)
camelia rakudo-moar a37cd2: OUTPUT«Method 'dd' not found for invocant of class 'Hash'␤ in block <unit> at <tmp> line 1␤␤»
02:50 bob777 joined
skids m: my @a := List.new(1); @a.perl.say; @a.say; # .perl tells you how to write a 1-element list literal. 02:51
camelia rakudo-moar a37cd2: OUTPUT«(1,)␤(1)␤»
skids Hrm I thought we had a dd.
geekosaur it's a sub, not a method 02:52
P6fr ok thx for the explain
skids Ah. 02:53
geekosaur m: my $x; dd $x
camelia rakudo-moar a37cd2: OUTPUT«Any $x = Any␤»
P6fr m: my %alphabet = "A".."Z" Z=> ("z"..."a"); say dd %alphabet.; say "ABCDEFGHIJ".trans(%alphabet.pairs)
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed postfix call␤at <tmp>:1␤------> 3.."Z" Z=> ("z"..."a"); say dd %alphabet.7⏏5; say "ABCDEFGHIJ".trans(%alphabet.pairs␤»
gfldex m: my %alphabet = "A".."Z" Z=> ("z"..."a"); say %alphabet.&dd;
camelia rakudo-moar a37cd2: OUTPUT«Hash %alphabet = {:A("z"), :B("y"), :C("x"), :D("w"), :E("v"), :F("u"), :G("t"), :H("s"), :I("r"), :J("q"), :K("p"), :L("o"), :M("n"), :N("m"), :O("l"), :P("k"), :Q("j"), :R("i"), :S("h"), :T("g"), :U("f"), :V("e"), :W("d"), :X("c"), :Y("b"), :Z("a")}␤Ni…»
gfldex if you really want to you can call it like a method :)
P6fr fine 02:54
well, im bored. i 'll sleep 02:55
It is what time in your home?
02:58 cyphase joined
skids 11pm here 03:00
03:05 skrshn joined
skrshn newbie question 03:05
is this possible: 03:06
while prompt("Enter number: ") -> $h { $h++; say $h; } 03:07
basically, I want $h to be read/write
skids m: for 1..2 -> $h is copy { $h++; say $h } 03:08
camelia rakudo-moar a37cd2: OUTPUT«2␤3␤»
03:08 wamba joined
skids (There is "is rw" as well but in this case you only want it writeable internally) 03:09
skrshn got it. Thanks
"is rw" does not seem to work
gfldex m: my @a = 1,2,3; for @a <-> $h { $h++ }; dd @a 03:10
camelia rakudo-moar a37cd2: OUTPUT«Array @a = [2, 3, 4]␤»
gfldex <-> is a shortcut for writeable containers
skids "is rw" expects what you pass in to be a writeable container 03:11
03:11 hwcomcn left
skids m: my $a = 1; my $b = 2; for ($a,$b) -> $h is rw { $h++; say $h }; "$a $b".say 03:11
camelia rakudo-moar a37cd2: OUTPUT«2␤3␤2 3␤»
skrshn wonderful. thanks for the example with rw 03:12
dalek c: fc6c2d5 | (Wenzel P. P. Peppmeyer)++ | doc/Type/Block.pod6:
add <-> to index
03:14
03:16 hwcomcn joined 03:17 canopus joined 03:18 hwcomcn left 03:19 hwcomcn joined 03:24 hwcomcn left
skrshn follow up question: when we do "is rw", is binding at work here? Is that why we need a container? 03:26
03:26 hwcomcn joined 03:28 kid51 left, hwcomcn left
skids It's a form of binding, yes. 03:29
IIRC the ::= form.
03:29 hwcomcn joined
skrshn ok. I need to look that one up. thanks. 03:29
skids Oh I guess ::= is read-only binding. 03:30
Which protects the first layer, I think.
03:30 hwcomcn left
skids So rw would be := binding 03:31
03:31 hwcomcn joined
skrshn thats the only one I am aware of. 03:32
03:38 hwcomcn left 03:39 hwcomcn joined 03:40 hwcomcn left 03:44 hwcomcn joined
skrshn This works 03:48
my %count; for "ofile.txt".IO.lines -> $line { %count{$_}++ for $line.split(' '); } say "%count{}";
But this does not work
my %count; for "ofile.txt".IO.lines -> $line { $line.split(' ').map(-> $w {%count{$w}++}); } say "%count{}";
03:49 hwcomcn left 03:50 P6fr left
skids map is probably producing a lazy seq. 03:58
skrshn but this is counter-intuitive (to a newbie) 03:59
skids m: my %count; for $*IN.lines -> $line { $line.split(' ').map(-> $w {%count{$w}++}); } say "%count{}";
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Strange text after block (missing semicolon or comma?)␤at <tmp>:1␤------> 3split(' ').map(-> $w {%count{$w}++}); }7⏏5 say "%count{}";␤»
skids m: my %count; for $*IN.lines -> $line { $line.split(' ').map(-> $w {%count{$w}++}); }; say "%count{}";
camelia rakudo-moar a37cd2: OUTPUT«␤»
skids m: my %count; for $*IN.lines -> $line { $line.split(' ').map(-> $w {%count{$w}++}).elems; }; say "%count{}"; 04:00
camelia rakudo-moar a37cd2: OUTPUT« 4␤'S 1␤'s 1␤Ach 1␤Ag 1␤Agus 1␤Atá 1␤B'é 1␤Chontae 1␤Céad 1␤Dhún 3␤Dobhair, 1␤Dobhair. 3␤Domhain 1␤Dún 1␤D’fhág 1␤Eireagal 1␤Gall, 1␤Ghall; 1␤Ghaoth 4␤Ghlas' 1␤Ghleann 1␤Ghleanntáin
..1␤Go 1␤I 1␤Is 1…»
skids Yeah, general rule is that "for" is procedural paradigm, .map is functional paradigm. Working in a multi-paradigm environment takes a little getting used to. 04:01
04:01 samb1 joined
skids m: my %count; for $*IN.lines -> $line { sink $line.split(' ').map(-> $w {%count{$w}++}) }; say "%count{}"; # A little less circumlocuative 04:01
camelia rakudo-moar a37cd2: OUTPUT« 4␤'S 1␤'s 1␤Ach 1␤Ag 1␤Agus 1␤Atá 1␤B'é 1␤Chontae 1␤Céad 1␤Dhún 3␤Dobhair, 1␤Dobhair. 3␤Domhain 1␤Dún 1␤D’fhág 1␤Eireagal 1␤Gall, 1␤Ghall; 1␤Ghaoth 4␤Ghlas' 1␤Ghleann 1␤Ghleanntáin
..1␤Go 1␤I 1␤Is 1…»
skids When in doubt, introspect. 04:02
m: (1,2,3).map(-> $w { $w++ }).WHAT.say 04:03
camelia rakudo-moar a37cd2: OUTPUT«(Seq)␤»
04:03 adu joined
skids m: (1,2,3).map(-> $w { $w++ }).perl.say 04:03
camelia rakudo-moar a37cd2: OUTPUT«Cannot resolve caller postfix:<++>(Int); none of these signatures match:␤ (Mu:D $a is rw)␤ (Mu:U $a is rw)␤ (Int:D $a is rw)␤ (int $a is rw)␤ (Bool:U $a is rw)␤ (Bool:D $a is rw)␤ (Num:D $a is rw)␤ (Num:U $a is rw)…»
04:03 adu left
skids m: (1,2,3).map(-> $w is copy { $w++ }).perl.say 04:04
camelia rakudo-moar a37cd2: OUTPUT«(1, 2, 3).Seq␤»
skids m: (for (1,2,3) { $w++ }).perl.say
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$w' is not declared␤at <tmp>:1␤------> 3(for (1,2,3) { 7⏏5$w++ }).perl.say␤»
skids m: (for (1,2,3) { $w + 1 }).perl.say
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$w' is not declared␤at <tmp>:1␤------> 3(for (1,2,3) { 7⏏5$w + 1 }).perl.say␤»
skids I suck tonight
m: (for (1,2,3) -> $w { $w + 1 }).perl.say 04:05
camelia rakudo-moar a37cd2: OUTPUT«(2, 3, 4)␤»
skrshn thanks skids.. a lot of food for thought for me
skids m: (for (1,2,3) -> $w { $w + 1 }).WHAT.say
camelia rakudo-moar a37cd2: OUTPUT«(List)␤»
04:17 pochi_ joined 04:20 dainis joined 04:28 dainis left 04:29 kaare_ joined
skrshn m: sub func(@arr is copy) { @arr[0] = "First";}; my @arr = ^10; func(@arr); say @arr; 04:33
camelia rakudo-moar a37cd2: OUTPUT«[0 1 2 3 4 5 6 7 8 9]␤»
skrshn in the argument "@arr is copy", is @arr deep coy?
*copy
m: sub func(@arr is copy) { @arr[0][0] = "First";}; my @arr = ^10; @arr[0] = ^10; func(@arr); say @arr; 04:35
camelia rakudo-moar a37cd2: OUTPUT«Cannot modify an immutable Int␤ in sub func at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
skrshn m: sub func(@arr is copy) { @arr[0][0] = "First";}; my @arr = ^10; @arr[0] = [0,1,2]; func(@arr); say @arr; 04:37
camelia rakudo-moar a37cd2: OUTPUT«[[First 1 2] 1 2 3 4 5 6 7 8 9]␤»
BenGoldberg m: my @a; @a[0] = 42; @a[0][0] = 'wut'; say @a; 04:38
camelia rakudo-moar a37cd2: OUTPUT«Cannot modify an immutable Int␤ in block <unit> at <tmp> line 1␤␤»
skrshn so it is not deep copy
BenGoldberg To the best of my knowledge, 'is copy' just means that you can assign to the variable name without the original being wiped out. 04:39
m: sub func(@arr is copy) { @arr = () }; my @a = ^10; func(@a); say @a; 04:40
camelia rakudo-moar a37cd2: OUTPUT«[0 1 2 3 4 5 6 7 8 9]␤»
BenGoldberg m: sub func(@arr is rw) { @arr = () }; my @a = ^10; func(@a); say @a;
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Can only use 'is rw' on a scalar ('$' sigil) parameter␤at <tmp>:1␤»
BenGoldberg m: sub func(@arr is raw) { @arr = () }; my @a = ^10; func(@a); say @a;
camelia rakudo-moar a37cd2: OUTPUT«[]␤»
BenGoldberg m: sub func(@arr is copy) { push @a, 42 }; my @a = ^10; func(@a); say @a; 04:41
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '@a' is not declared␤at <tmp>:1␤------> 3sub func(@arr is copy) { push 7⏏5@a, 42 }; my @a = ^10; func(@a); say @a;␤»
BenGoldberg m: sub func(@arr is copy) { push @arr, 42 }; my @a = ^10; func(@a); say @a;
camelia rakudo-moar a37cd2: OUTPUT«[0 1 2 3 4 5 6 7 8 9]␤»
BenGoldberg m: sub func(@arr) { push @arr, 42 }; my @a = ^10; func(@a); say @a;
camelia rakudo-moar a37cd2: OUTPUT«[0 1 2 3 4 5 6 7 8 9 42]␤»
BenGoldberg shrugs
04:41 Xliff left
skrshn the default for arrays is a binding I think 04:41
equivalent to @arr := @a 04:43
parabolize m: dd $_ for [ (1..3)».succ, ++«(@ = 1..3), 1 «+« (1..3), 1 »+« 1..3 »+« 1, (for (1..3) -> $a {$a+1}), (*+1 for (1..3)), (1..3).map({$^a + 1}) ]
camelia rakudo-moar a37cd2: OUTPUT«List <element> = $(2, 3, 4)␤Array <element> = $[2, 3, 4]␤List <element> = $(2, 3, 4)␤Range <element> = 2..4␤List <element> = $(2, 3, 4)␤List <element> = $(2, 3, 4)␤Seq <element> = (2, 3, 4).Seq␤»
skrshn whoa.. that is way over my head :-) 04:44
04:45 AlexDaniel left 04:54 Cabanossi joined 04:59 wamba left
skrshn Is this the only way to adverb? 05:02
m: sub truncate($text, :$limit = 100, :$trailer = '...') { $text.chars > $limit ?? "$text.substr(0,$limit)$trailer" !! $text }; truncate $text,:limit(20) 05:03
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$text' is not declared. Did you mean '&next'?␤at <tmp>:1␤------> 3imit)$trailer" !! $text }; truncate 7⏏5$text,:limit(20)␤»
05:03 dj_goku joined
skrshn m: sub truncate($text, :$limit = 100, :$trailer = '...') { $text.chars > $limit ?? "$text.substr(0,$limit)$trailer" !! $text }; my $text = (^1000).join(''); truncate $text,:limit(20) 05:03
camelia ( no output )
05:04 cibs left
skrshn m: sub truncate($text, :$limit = 100, :$trailer = '...') { $text.chars > $limit ?? "$text.substr(0,$limit)$trailer" !! $text }; my $text = (^1000).join(''); say truncate $text,:limit(20) 05:04
camelia rakudo-moar a37cd2: OUTPUT«01234567891011121314...␤»
parabolize lots of syntax to play with adverbs let alone named parameters in captures
skrshn Is this the only way to adverb the function?
ok.. I am going through Jnthn's intro. Need to look them up 05:05
05:05 Xliff joined 05:06 cibs joined, dainis joined
parabolize :( I'm always mixing Signatures and Captures 05:08
skrshn: docs.perl6.org/type/Signature
skrshn parabolize: thanks 05:10
this is from the jnthn tutorial. it does not work: 05:15
m: sub check-array-lengths(*@arrays) { for @arrays -> @arr { die "oh no it's too long!" if @arr.elems > 5; } } my @a = 1..4; my @b = 1..3; check-array-lengths(@a, @b);
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Strange text after block (missing semicolon or comma?)␤at <tmp>:1␤------> 3it's too long!" if @arr.elems > 5; } }7⏏5 my @a = 1..4; my @b = 1..3; check-array␤ expecting any of:␤ infi…»
skrshn m: sub check-array-lengths(*@arrays) { for @arrays -> @arr { die "oh no it's too long!" if @arr.elems > 5; } }; my @a = 1..4; my @b = 1..3; check-array-lengths(@a, @b);
camelia rakudo-moar a37cd2: OUTPUT«Type check failed in binding @arr; expected Positional but got Int (1)␤ in sub check-array-lengths at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
skrshn spoke too soon :-) 05:17
05:18 holyghost joined
holyghost gm 05:18
05:20 Xliff left 05:23 cyphase left 05:24 BrassLantern left
parabolize skrshn: change the sig to +@arrays. gist.github.com/parabolize/f40df4f...28b934a4b3 05:25
skrshn: do you have a link to the tutorial?
skrshn: docs.perl6.org/type/Signature#Sing...ule_Slurpy 05:26
skrshn It is called 2015-spw-perl6-course.pdf and it is part of the rakudo Star page in the Docs directory 05:28
05:28 cyphase joined
skrshn www.jnthn.net/papers/2015-spw-perl6-course.pdf 05:29
In the course, we have **@arrays instead of your +@arrays. Don't know the difference yet
parabolize there is a snippet here: docs.perl6.org/language/functions#...onventions 05:36
05:36 cibs left 05:38 cibs joined
skrshn what is the easiest way to achieve the "in" operator in Python: 05:43
m: my @seq = 1..6; say 1 ~~ @seq;
camelia rakudo-moar a37cd2: OUTPUT«False␤»
skrshn m: my @seq = 1..6; say 1 in @seq; 05:44
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3my @seq = 1..6; say 17⏏5 in @seq;␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ statemen…»
parabolize skrshn: (1..6).contains(1) 05:47
ShimmerFairy m: my @a = 1..6; say 1 (in) @a 05:48
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3my @a = 1..6; say 17⏏5 (in) @a␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ statement m…»
ShimmerFairy m: my @a = 1..6; say 1 (elem) @a
camelia rakudo-moar a37cd2: OUTPUT«True␤»
ShimmerFairy ^^^ there's also that, but it does involve Sets
skrshn (elem) is not very intuitive
what is (elem) really? is it an operator? 05:49
ShimmerFairy skrshn: it's a texas version of the appropriate set theory operator, which I haven't fixed my compose key to type yet :P
skrshn got it.. in latex, you would write as \in ? 05:50
ShimmerFairy Maybe, I wouldn't know off-hand :) 05:51
parabolize 3 ∈ ^6
skrshn 05:52
m: say 1 ∈ ^6
camelia rakudo-moar a37cd2: OUTPUT«True␤»
skrshn cool
is 1 ∈ ^6 a O(n) operation? 05:53
or O(log(n)) ? 05:54
05:54 dainis left
ShimmerFairy skrshn: not sure, but know that set theory operators will implicitly convert things to Set objects as needed, which are implemented as a kind of hash internally. 05:55
skrshn more simply, is it faster to do 1 ∈ ^6 or "my %hash; %hash{$_}++ for ^6; say ?%hash{1};" 05:57
BenGoldberg Converting a list to a hash takes at least O(n) time, regardless of whether you do it manually or use, for example, the .set method on the list. 05:58
05:58 wamba joined
skrshn also, if I am going to do the set operation repeatedly, is the created set object smartly cached? 05:59
BenGoldberg m: my %set := (^6).set; say 1 ∈ %set;
camelia rakudo-moar a37cd2: OUTPUT«Method 'set' not found for invocant of class 'Range'␤ in block <unit> at <tmp> line 1␤␤»
BenGoldberg m: my %set := (^6).Set; say 1 ∈ %set;
camelia rakudo-moar a37cd2: OUTPUT«True␤»
BenGoldberg I don't think that created sets are automatically cached (yet), but you can do it yourself. 06:00
skrshn BenGoldberg: True. That was an oversight. But my following question is actually the one I am more interested.
06:01 cibs left
skrshn so doing my %set = (^6).Set is more efficient than "my %hash; %hash{$_}++ for ^6;" ? or is it the same thing? 06:01
Probably does not matter. As you said, both are probably O(n) 06:02
sorry O(nlog(n))
BenGoldberg I'd expect the .Set method to be a fraction faster, as it's not storing a bunch of ints that the ++ version does. 06:03
06:03 cibs joined
skrshn BenGoldberg: makes sense 06:04
BenGoldberg Also, if you're going to use assignment = instead of binding := then you should use a $scalar variable, not a %hash variable... 06:05
my $set = (^6).Set; #(ok), my %set := (^6).Set; #(ok), my %set = (^6).Set; # not ok, will not dwym 06:06
06:08 cibs left
skrshn what is happening here: my %set := (^6).Set; #(ok) 06:08
06:09 cibs joined
skrshn Hash and Set both have % sigil? 06:11
BenGoldberg I'm not really good at explaining... have you ever programmed in say, perl5 or c++? 06:12
skrshn I have programmed in both. pretty decent in perl5
BenGoldberg In perl5, what's the difference between doing: our %hash = %foo, and doing *hash = \%foo; 06:13
skrshn I have never used the second construct. 06:14
Are you hinting at binding?
BenGoldberg Assignment in perl6 is like assignment in perl5... but doing binding in perl6 (using the := operator) is like assigning a ref to a glob.
yes
skrshn I understand that part
my question is.. 06:15
m: my %hash := (^6).Set; say %hash.WHAT; say %hash.perl;
camelia rakudo-moar a37cd2: OUTPUT«(Set)␤set(5,4,3,0,1,2)␤»
skrshn m: my %hash = (^6).Set; say %hash.WHAT; say %hash.perl;
camelia rakudo-moar a37cd2: OUTPUT«(Hash)␤{"0" => Bool::True, "1" => Bool::True, "2" => Bool::True, "3" => Bool::True, "4" => Bool::True, "5" => Bool::True}␤»
BenGoldberg :)
skrshn So I thought Hash and Set are somehow connected.. one is a subclass of the other 06:16
06:16 aries_liuxueyang joined
BenGoldberg m: Hash.^parents.say; 06:18
camelia rakudo-moar a37cd2: OUTPUT«((Map))␤»
BenGoldberg m: Set.^parents.say;
camelia rakudo-moar a37cd2: OUTPUT«()␤»
BenGoldberg m: Map.^parents.say;
camelia rakudo-moar a37cd2: OUTPUT«()␤»
skrshn ok
m: Set.^parents.say;
camelia rakudo-moar a37cd2: OUTPUT«()␤»
06:20 adu joined
BenGoldberg m: say Hash.can('AT-KEY'); 06:24
camelia rakudo-moar a37cd2: OUTPUT«(Method+{<anon|53710736>}.new Method+{<anon|53710736>}.new Method+{<anon|53710736>}.new)␤»
BenGoldberg m: say Set.can('AT-KEY');
camelia rakudo-moar a37cd2: OUTPUT«(Method+{<anon|53710736>}.new Method+{<anon|53710736>}.new)␤»
BenGoldberg m: say Array.can('AT-KEY');
camelia rakudo-moar a37cd2: OUTPUT«(Method+{<anon|53710736>}.new)␤»
BenGoldberg m: my @foo; @foo{0} = 2;
camelia rakudo-moar a37cd2: OUTPUT«Type Array does not support associative indexing.␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
BenGoldberg m: my @foo; @foo.AT-KEY(0) = 2; 06:25
camelia rakudo-moar a37cd2: OUTPUT«Type Array does not support associative indexing.␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
BenGoldberg m: Mu{0} = 1;
camelia rakudo-moar a37cd2: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Autovivifying object closures not yet implemented. Sorry. ␤at <tmp>:1␤------> 3Mu{0}7⏏5 = 1;␤»
06:25 nine left
BenGoldberg Oops? 06:26
06:27 domidumont joined
BenGoldberg It is getting late (early), so good night. 06:28
06:28 BenGoldberg left 06:31 domidumont left 06:32 domidumont joined 06:33 Tonik joined
skrshn m: class DaySchedule { has $!opening; has $!closing; has %!schedule; submethod BUILD(:$opening!, :$closing!) { } } 06:39
How do I initialize the object properly if the names are the same? 06:40
06:40 hwcomcn joined
skrshn Also, how do I delete a class definition in a running session of perl6 REPL? 06:43
figured it out: $!opening = $opening. (obviously) 06:47
06:52 hwcomcn left 06:55 wamba left, RabidGravy joined 06:56 cibs left 06:57 adu left 06:58 cibs joined
skrshn is it possible to delete a class definition (or change) a class defined in the REPL? I don't want to keep quitting and restarting the perl6 REPL every time I change the class 07:02
psch skrshn: you can mess with the class via its meta object, but you can redeclare a new class with the same name
skrshn m: class A {}; class A {} 07:03
psch skrshn: you could probably assign an anonymous class into a sigilless variable instead of using the normal 'class ... { }' syntax and overwrite the content of that variable, but that doesn't change already instantiated objects
skrshn bad example 07:04
psch something like 'my \Foo = class :: { ... }; ...; Foo := class :: { ... }'
skrshn This is what I am getting: ===SORRY!=== Error while compiling: Redeclaration of symbol DaySchedule at line 2 ------> class DaySchedule⏏ expecting any of: generic role
psch err, you *cant* redeclare with the same name
sorry, just got my first cup of coffee :)
skrshn So in an ongoing session of the REPL, I have to keep updating the class name for every change? 07:05
psch or you use one of the two other ways i suggested
skrshn I don't really understand what you said.. sorry.. 07:06
can you give more details?
07:08 vendethiel- joined, vendethiel left
skrshn How would I use your example if I want to improvise a class definition and examine it in a running REPL session? 07:09
psch skrshn: gist.github.com/peschwa/22815eefdf...ddd31d4952
the sigilless one is probably closer to what you want, as you can keep using the same name 07:10
you just slightly change how you define the class
note though that in the example $x and $y are *not* the same class
and $x doesn't get the method foo 07:11
if you need changes to propagate back to older instances you have to use the MOP
07:12 domidumont left
skrshn awesome! the sigilless one is what I want. I don't want to propogate anything 07:12
psch: what does "Foo = $;" do? 07:16
sorry.. "my \Foo = $;"
psch skrshn: well, normally sigilless variables don't get a container, so you can reassign
skrshn: the $ is an anonymous state variable, which gets us the wanted container so we can assign things to Foo 07:17
skrshn: docs.perl6.org/language/containers might be of interest
skrshn right now, this is beyond me.. thanks for the link. I will read it later. 07:18
07:24 jack_rabbit left
skrshn psch: for "Foo = class :: { }", how would roles work? 07:26
how do I specify "does XXX" in the above ? 07:28
psch skrshn: just after the ::, it's a standin for a name if you don't have one
skrshn ok 07:29
07:32 CIAvash joined 07:33 kurahaupo joined
skrshn psch: This does not work: gist.github.com/skrisna/883d74e784...9d72d483ec 07:33
It complains: "No compile-time value for Rolex" 07:34
psch well, yeah
that's because it's true :)
as in, the assignment happens at runtime, but mixins happen at compile time 07:35
so Rolex doesn't have a meaningful value when the class that you assign to Classx wants to compose it
if you want to move the mixin to runtime you have to do it via the MOP
as in, 'Classx = ...; Classx.^mixin(Rolex);' 07:36
you might have to .^compose after that, not sure
skrshn let me try..
psch you could, of course, just do all the editing in a file and run that file directly 07:38
which, by now, probably would have saved you a lot of typing :)
and you wouldn't need all those weird workarounds for runtime stuff vOv
psch doesn't really get the appeal of REPLs
skrshn but I am also learning a lot thanks to you :-) 07:39
Actually, if I remove "does Rolex" then I get "No such private method 'zero-scores'" .. is there a workaround? 07:41
07:41 domidumont joined, labster joined
psch skrshn: well, you can reference a method that doesn't exist 07:41
timotimo but not private methods, as they are already looked up at compile time 07:42
skrshn psch: ??
timotimo when the closing curly brace of the class definition is first encountered
psch ...
timotimo no way to make it work afterwards with MOP and .^compose
psch that's the second time i' missing a "'t"
so, "can't reference a method that doesn't exist"
timotimo you can reference public methods that don't exist, though
psch well, i'd say the workaround kludge has reached it's limits 07:43
but as timotimo says, you could probably make it public and keep going like that
skrshn timotimo: example?
psch ...just replace the ! with a .
in the invocation and declaration both 07:44
skrshn I mean, referencing method that does not exist
the public/private part I get
psch: I will take your advice for now and not digress to much from what I am learning at the moment. Just source files wo/ using REPL 07:46
07:49 girafe joined, thomas joined 07:51 Tonik left 07:54 darutoko joined 08:00 holyghost left 08:01 spider-mario joined 08:06 darutoko left 08:10 domidumont left
stmuk hmm I'm used to online forum perl 6 discussion being a bit rubbish but I did find it worrying one of the more interesting posters on the R* reddit the saying " The language is still in beta (official beta circa last December)" 08:19
s/the/thread
08:23 kurahaupo left, kurahaupo joined, firstdayonthejob joined
dalek href="https://perl6.org:">perl6.org: d3e1a1d | (Steve Mynott)++ | source/index.html:
try to explain better perl 6 no long in beta
08:31
href="https://perl6.org:">perl6.org: b87f768 | (Steve Mynott)++ | source/downloads/index.html:
missed space
08:39 rindolf joined
dalek line-Perl5: de1dfb6 | niner++ | / (2 files):
Expose Perl 5 global variables as %*PERL5

Fixes GH #69
08:48
stmuk hmmm is there a .tell $zoffix-last-nick ? 08:51
08:53 RabidGravy left 09:12 cibs left 09:14 cibs joined 09:17 holyghost joined 09:20 cibs left 09:21 cibs joined 09:32 iH2O joined 09:36 Actualeyes joined 09:39 AndyBotwin left 09:41 skrshn left 09:44 FROGGS joined, domidumont joined 09:47 ufobat joined
ufobat hoi :) 09:48
timotimo yo!
hahainternet o/ 09:50
09:52 cosimo left
iH2O grrr 09:57
oops that nick is already reserved, srry
10:08 holyghost left 10:31 setty1 joined 10:39 colomon joined 10:42 labster left 10:51 esh_ joined, pierrot_ joined 10:52 darutoko joined 10:53 Bucciarati joined, colomon left 10:55 kurahaupo left, colomon joined 11:05 kid51 joined 11:10 colomon left
timotimo we may need a module that builds a whole bunch of nice emoji operators 11:15
like "FAX MACHINE" for what C++ uses << for
and maybe "TELEPHONE" for what C++ uses >> for
11:16 kid51 left 11:34 sena_kun joined
Roamer` hmm, is try supposed to not catch everything? 11:34
m: sub a() { my @arr = 1; my %hash = @arr; %hash; }; my %res = try a; dd %res;
timotimo BBL
Roamer` oh, camelia is not here...
11:37 domidumont left
Roamer` still, can anybody explain why this dies instead of saying "whee"? 11:37
use v6.c; sub a() { my @arr = 1; my %hash = @arr; %hash; }; my %res = try a; say "whee";
lizmat fwiw, the #perl6 channel on irc.perl.org seems to have "p6eval" 11:38
which seems up to date 11:39
Roamer` ahh, I got it actually 11:40
try does catch the thing
but then returns a Failure object, an X::AdHoc 11:41
and I try to assign a single Failure object to a hash
and that's what dies
my $res = try a works
but thanks for the p6eval pointer
11:41 MasterDuke joined
MasterDuke Roamer`: committable is still here also 11:42
committable: help 11:43
committable MasterDuke: Like this: committable: f583f22,HEAD say 'hello'; say 'world'
11:43 iH2O left
MasterDuke committable: HEAD use v6.c; sub a() { my @arr = 1; my %hash = @arr; %hash; }; my %res = try a; say "whee"; 11:43
committable MasterDuke: |«HEAD»: Odd number of elements found where hash initializer expected:␤Only saw 1 element␤ in block <unit> at /tmp/OGVPURWOcT line 1␤ exit code = 1
11:46 rindolf left
Roamer` MasterDuke, thanks 11:46
11:49 cognominal joined 12:02 Guest66 joined 12:03 pmqs joined 12:04 vendethiel- left 12:08 pmqs left, darutoko left 12:15 domidumont joined, domidumont left 12:16 domidumont joined 12:17 rindolf joined 12:20 pmqs joined 12:26 pmqs left 12:38 Xliff joined 12:39 kaare_ left 12:42 pmqs joined 12:43 colomon joined 12:53 perlawhirl joined 13:06 domidumont left 13:14 Tonik joined, darutoko joined 13:18 colomon left 13:20 darutoko left, colomon joined 13:22 kaare_ joined, colomon left 13:23 colomon joined, vcv joined 13:26 kurahaupo joined 13:32 kaare_ left 13:35 skrhn joined 13:40 kaare_ joined 13:42 geekosaur joined, geekosaur left 13:43 geekosaur joined 13:46 dainis joined, skids joined 13:50 darutoko joined 13:51 rindolf left
Guest66 hello 13:52
How to change a variable str to list
?
13:52 Guest66 is now known as P6fr 13:53 ccube joined
ccube p6: say [1, <2 3 4>, 5].flat 13:55
P6fr m: say [1, <2 3 4>, 5].flat
hum
m: say "hello"
gfldex camelia: you there honey? 13:56
vcv p6eval: say [1, <2 3 4>, 5].flat
13:56 skids left
P6fr camelia sleep 13:56
:-)
13:56 colomon left
MasterDuke committable: help 13:56
committable MasterDuke: Like this: committable: f583f22,HEAD say 'hello'; say 'world'
ccube in any case turns it into a list but doesn't flatten in my recently downloaded p6 13:57
MasterDuke committable: f583f22,HEAD say 'hello'; say 'world'
committable MasterDuke: |«f583f22,HEAD»: hello␤world
MasterDuke committable: HEAD say [1, <2 3 4>, 5].flat
committable MasterDuke: |«HEAD»: (1 (2 3 4) 5)
P6fr you want the result (1 2 3 4 5) ? 13:58
13:58 wamba joined
ccube i'm trying to learn p6, p6doc say .flat will interpret invocant as list and flatten - here's an example where it doesn't 13:59
bug or am i confused
13:59 colomon joined 14:00 darutoko left
P6fr f583f22,HEAD my $nums = [1, <2 3 4>, 5]; say |$nums.flat 14:00
psch commitable: f583f22,HEAD my $nums = [1, <2 3 4>, 5]; say |$nums.flat
gfldex ccube: it does remove the first level, what is []
psch +t >_>
P6fr committable:f583f22,HEAD my $nums = [1, <2 3 4>, 5]; say |$nums.flat 14:01
psch committable: f583f22,HEAD my $nums = [1, <2 3 4>, 5]; say ($nums.flat).elems
committable psch: |«f583f22,HEAD»: 3
psch committable: f583f22,HEAD my $nums = [1, <2 3 4>, 5]; say ($nums>>.flat).elems
committable psch: |«f583f22,HEAD»: 3
psch committable: f583f22,HEAD my $nums = [1, <2 3 4>, 5]; say ($nums.flat).WHAT
committable psch: |«f583f22,HEAD»: (Seq)
psch that's somewhat informative
gfldex ccube: if you want to flatten recursively, use .deepmap
psch committable: f583f22,HEAD my $nums = [1, <2 3 4>, 5]; say $nums.flat.flat
committable psch: |«f583f22,HEAD»: (1 (2 3 4) 5)
psch gfldex++
vcv commitable: HEAD say flat [1, <2 3 4>, 5].List 14:03
ccube gfldex: example?
vcv commitable f583f22,HEAD say flat [1, <2 3 4>, 5].List
gfldex `my @a = [1,2,3]` and `my @a = 1,2,3` are not the very same thing
psch committable: HEAD say [1, <2 3 4>, 5].deepmap(*.flat)
committable psch: |«HEAD»: [(1) ((2) (3) (4)) (5)]
psch heh
vcv committable: HEAD say flat [1, <2 3 4>, 5].List
committable vcv: |«HEAD»: (1 2 3 4 5)
14:03 colomon left
ccube vcv: okay but p6doc say "interprets invocant as List" 14:04
commitable: HEAD say [1, <2 3 4>,5].List.flat 14:05
P6fr committable HEAD my $nums = [1, <2 3 4>, 5]; $nums.isa(Any) 14:06
committable P6fr: |«HEAD»:
P6fr committable HEAD my $nums = [1, <2 3 4>, 5]; say $nums.isa(Any)
committable P6fr: |«HEAD»: True
MasterDuke committable: HEAD say [1, <2 3 4>,5].List.flat 14:07
committable MasterDuke: |«HEAD»: (1 2 3 4 5)
MasterDuke ccube: ^^^, you were missing a 't'
P6fr committable HEAD say (1, <2 3 4>, 5).flat 14:08
committable P6fr: |«HEAD»: (1 2 3 4 5)
P6fr committable HEAD say (1, <2 3 4>, 5).flat.elems
committable P6fr: |«HEAD»: 5
ccube committable: HEAD say [1, <2 3 4>,5].List.flat
committable ccube: |«HEAD»: (1 2 3 4 5)
P6fr it's ok ?
ccube ok, but seems flat method does NOT coerce invocant to List 14:09
MasterDuke committable: HEAD say [1, <2 3 4>,5].WHAT;say (1, <2 3 4>,5).WHAT
committable MasterDuke: |«HEAD»: (Array)␤(List)
vcv ccube: which doc says that?
ccube p6doc List
P6fr Interprets the invocant as a list, flattens it, and returns that list. 14:10
vcv [ ] is an Array, not a List, right?
ccube committable: HEAD say [1,<2 3 4>,5].flat
committable ccube: |«HEAD»: (1 (2 3 4) 5)
MasterDuke committable: HEAD say [1, <2 3 4>,5].list.flat 14:11
committable MasterDuke: |«HEAD»: (1 (2 3 4) 5)
ccube an array that doesn't get interpreted as a List
MasterDuke there's a difference between a List and a list
vcv i have so much to learn
P6fr HEAD say [1, <2 3 4>,5].List.flat
MasterDuke so it 'Interprets the invocant as a list, flattens it, and returns that list.' instead of 'Interprets the invocant as a List, flattens it, and returns that List.'
P6fr committable HEAD say [1, <2 3 4>,5].List.flat
committable P6fr: |«HEAD»: (1 2 3 4 5)
P6fr yes 14:12
MasterDuke which i agree is confusing and arguably non-intuitive
ccube so .flat flattens List but not list
humm
P6fr well found 14:13
ccube or maybe vice versa
vcv committable: HEAD say [1, (2, (3, 4)), 5].flat 14:14
P6fr the method works with low & haigh cass normally
committable vcv: |«HEAD»: (1 (2 (3 4)) 5)
14:14 Sgeo left, rindolf joined
vcv well that wasnt what i expected 14:14
P6fr committable HEAD say list([1, <2 3 4>,5])
committable P6fr: |«HEAD»: (1 (2 3 4) 5)
P6fr committable HEAD say List([1, <2 3 4>,5])
committable P6fr: |«HEAD»: ([1 (2 3 4) 5])
vcv I thought Array's flat method constructs a new List from the elements in the Array, after calling .flat on each element 14:15
calling .flat on a List like (2, (3, 4)) should flatten it to (2, 3, 4) 14:16
psch committable: HEAD say (2, (3,4)).flat
committable psch: |«HEAD»: (2 3 4)
psch vcv: okay
ccube side issue - I ran p6doc-index, but p6doc -f ... takes an absurdly long time to respond
14:16 Sgeo joined
tbrowder lizmat: how do you get the fine-grained timings for showing speed-ups for various functions? 14:17
yoleaux 22 Jul 2016 02:47Z <unmatched}> tbrowder: Not sure if it has any relevance to your table Pod work, but just thought I'd mention this old ticket I came across about =paras in tables: rt.perl.org/Ticket/Display.html?id...et-history
14:17 andrzejku joined
P6fr tbrowder say now - INIT now; 14:18
ccube anybody else seeing very slow p6doc -f ... ?
P6fr committable HEAD my @a = ("A".."Z" Z=> 1..26).perl;now - INIT now; 14:19
committable P6fr: |«HEAD»: WARNINGS for /tmp/gMUVpwvbaP:␤Useless use of "-" in expression "now - INIT now" in sink context (line 1)
P6fr committable HEAD my @a = ("A".."Z" Z=> 1..26).perl;say now - INIT now;
committable P6fr: |«HEAD»: 0.01123732
14:20 kalkin-_ joined
kalkin-_ hi 14:20
P6fr hi
14:20 colomon joined
MasterDuke btw, it's still pretty rough, but we do have benchable 14:20
benchable: help
benchable MasterDuke: Like this: benchable: f583f22,110704d my $a = "a" x 2**16;for ^1000 {my $b = $a.chop($_)}
kalkin-_ m: use 🙈;
MasterDuke benchable: 2016.01,HEAD my @a = ("A".."Z" Z=> 1..26) 14:21
benchable MasterDuke: |«2016.01»:No build for this commit␤|«HEAD»:0.1010
kalkin-_ m: unit class 🙈 {};
m: unit class 🙈 {}; say "foo"; 14:22
14:22 kalkin-_ is now known as kalkin-
MasterDuke kalkin-_: camelia is unavailable right now, but you can use committable 14:22
P6fr committable HEAD unit class 🙈 {}; say "foo";
committable P6fr: |«HEAD»: ===SORRY!=== Error while compiling /tmp/kCkhzuoEEe␤Unable to parse class definition␤at /tmp/kCkhzuoEEe:1␤------> unit class⏏ 🙈 {}; say "foo";␤ expecting any of:␤ generic role exit code = 1 14:23
kalkin- yeah this is what I'm trying to show. I can't use Unicode(or just the monkey see no evile?) as any unit name 14:24
tbrowder yoleaux: I'm aware of the problem, and I hope to work on it after I get the basic table working and accepted first. At the moment I don't know if that will require grammar work or not. I don't have the knowledge or experience enough yet to dig into the grammar and actions, but ShimmerFairy does. I will try an experiment later today which I hope will show
me whether or not it requires grammar work.
kalkin- (Actually I just wanted for lulz alias MONKEY-SEE-NO-EVAL to 🙈)
14:25 colomon left, kaare_ left, ccube left 14:26 AlexDaniel joined
vcv committable: HEAD my $💩 = 42; say $💩 14:27
committable vcv: gist.github.com/33eab609cc8af73d38...e3945ca7c3
vcv committable: my $a💩 = 42; say $a💩
committable vcv: |«my»: Cannot find this revision
vcv committable: HEAD my $a💩 = 42; say $a💩 14:28
committable vcv: gist.github.com/050661bfee2c4fea78...2e20cd9299
kalkin- vcv: Ohh TIL, that the name must be an alphabetic character. It's a pity, but makes kind of sense 14:30
14:30 vcv left, vcv joined 14:31 kaare_ joined
AlexDaniel commit HEAD my \term:<💩> = 42; say 💩 14:32
committable AlexDaniel: |«HEAD»: 42
sena_kun tbrowder, I'm not sure if I'm right, but I doubt your message will be delivered this way. Yoleaux's message delivery command works like this: ".tell $nickname message".
AlexDaniel kalkin-: ↑
kalkin- ok 14:33
AlexDaniel: thanks
AlexDaniel kalkin-: it's not a very good idea because it affects startup time, but it is still possible
gfldex AlexDaniel: that doesn't work because 'use MONKEY-SEE-NO-EVAL' is a term in itself. If you `use 🙈;` rakudo thinks you call the use sub. 14:34
and there is no sub called use 14:35
also, you can't do `my \term:<use 🙈> = 'use MONKEY-SEE-NO-EVAL';` because terms are separated by space 14:37
P6fr committable HEAD my $a = (123).list;say [+] $a; 14:38
committable P6fr: |«HEAD»: 123
P6fr committable HEAD my $a = (123).list;say [+]$a;
committable P6fr: gist.github.com/71c1da00b1ce173255...cbfbb2beed
14:38 wamba left
MasterDuke commit: HEAD my $a = "123".comb;say [+] $a;say $a.sum 14:41
committable MasterDuke: |«HEAD»: 6␤This Seq has already been iterated, and its values consumed␤(you might solve this by adding .cache on usages of the Seq, or␤by assigning the Seq into an array)␤ in block <unit> at /tmp/RDw8UPu82h line 1␤ exit code = 1
MasterDuke commit: HEAD my $a = "123".comb;say $a.sum
committable MasterDuke: |«HEAD»: 6
kalkin- I'm reading the documentation of Cool.EVAL() but I can't find a way to provide a context to the EVAL (i.e. already defined vars and so on...)
the only way I see to encapsulate it in it's own module and let the EVAL executed code assign values inside this dummy module 14:42
right?
arnsholt IIRC it's evaluated in the lexical scope where EVAL is called
P6fr commit: HEAD my $a = "123".comb.say 14:43
committable P6fr: |«HEAD»: (1 2 3)
P6fr commit: HEAD my $a = "123".say
committable P6fr: |«HEAD»: 123
P6fr commit: HEAD my $a = "123".list.say
committable P6fr: |«HEAD»: (123)
kalkin- arnsholt,: docs are saying → Furthermore, the EVAL is evaluated in the current package:
P6fr hum
arnsholt Pretty sure there's no way to supply additional bindings like Python's eval (most likely because Python's naming and binding model makes that really easy, unlike the Perl 6 model)
14:44 perlawhirl left
arnsholt m: my $foo = "foo"; 'say $foo'.EVAL # Let's see 14:44
P6fr which is difference between comb & list MasterDuke pls ?
arnsholt Bah, no evalbot!
P6fr what is*
MasterDuke P6fr: comb splits a string based on the given delimiter 14:45
DrForr She's on a recently-banned server.
arnsholt kalkin-: It's in the scope where EVAL is called, as far as I can make out from a quick REPL test
AlexDaniel why was it banned?
MasterDuke which defaults to the empty string
DrForr No idea.
P6fr as split() ?
moritz how can one get it to be unbanned?
14:46 dainis left
psch moritz: nine already mailed freenode support earlier today 14:46
14:46 bob777 left
kalkin- committable: HEAD my $foo; module Bar { say EVAL("say \$foo"); } 14:46
committable kalkin-: |«HEAD»: (Any)␤True
kalkin- committable: HEAD my $foo; say EVAL("say \$foo"); 14:47
committable kalkin-: |«HEAD»: (Any)␤True
MasterDuke i wasn't entirely accurate. split() splits, comb() return matches
kalkin- committable: HEAD my $foo="fii"; say EVAL("say \$foo");
committable kalkin-: |«HEAD»: fii␤True
kalkin- committable: HEAD my $foo="fii"; module Bar { say EVAL("say \$foo"); }
committable kalkin-: |«HEAD»: fii␤True
kalkin- interesting 14:48
P6fr haaa
MasterDuke but the default pattern that comb() matches on is essentially /./, i.e., return a list of all characters
moritz fwiw I'e just stopped the [email@hidden.address] service
P6fr commit: HEAD my $a = "123".comb.say.WHAT 14:49
committable P6fr: |«HEAD»: (1 2 3)
P6fr commit: HEAD my $a = "123".comb.WHAT.say
committable P6fr: |«HEAD»: (Seq)
14:49 bob777 joined
P6fr commit: HEAD my $a = "123".list.WHAT.say 14:49
committable P6fr: |«HEAD»: (List)
MasterDuke P6fr: my $a = "123".list just creates a one-element list 14:50
P6fr yes 14:51
14:51 dainis joined
MasterDuke commit: HEAD my $a = "123".comb.list;say $a;say $a.WHAT 14:51
committable MasterDuke: |«HEAD»: (1 2 3)␤(List)
MasterDuke commit: HEAD my $a = "123".list;say $a;say $a.WHAT
committable MasterDuke: |«HEAD»: (123)␤(List)
P6fr thx i understand 14:52
14:53 evalable joined
AlexDaniel m: say ‘hello’ 14:53
evalable AlexDaniel: |«HEAD»: hello
AlexDaniel that's gonna be a bit easier now ;) 14:54
P6fr :D
hi AlexDaniel
AlexDaniel kick evalable from the channel when camelia comes back
15:00 colomon joined
dalek sectbot: e17c571 | (Aleks-Daniel Jakimenko-Aleksejev)++ | Perl6IRCBotable.pm:
Disable colors in error messages

We can replace terminal colors with something sensible, but the problem is that it is not going to work so well for gists. At the time we execute something, there is no way to know if we are going to gist it or not. It seems like there's no easy way to have a cake and eat it.
15:00
c: b1e3270 | (Wenzel P. P. Peppmeyer)++ | doc/Type/Any.pod6:
make it clear that flat doesn't recurse and show how to do that
15:01 RabidGravy joined
P6fr what is difference between List and Seq ? 15:01
sena_kun P6fr, docs? docs.perl6.org/language/list.html - there is a good description. 15:03
15:04 colomon left
AlexDaniel wow, indeed 15:04
great page
15:05 kaare_ left 15:11 holyghost joined, kaare_ joined 15:12 canopus left 15:15 espadrine joined 15:17 canopus joined 15:20 mns` joined 15:21 kaare__ joined, mns` left 15:23 kaare_ left 15:29 pmurias joined
pmurias hi 15:29
holyghost hello 15:30
gfldex m: my $s = "I \x[2665] Perl 6!"; 15:31
evalable gfldex: |«HEAD»:
gfldex m: my $s = "I \x[2665] Perl 6!"; dd $s;
evalable gfldex: |«HEAD»: Str $s = "I ♥ Perl 6!"
15:31 sjoshi joined 15:32 skrhn left
gfldex m: my $s = "I really \x[2661,2665,2764,1f495] Perl 6!"; dd $s; 15:34
evalable gfldex: |«HEAD»: Str $s = "I really ♡♥❤💕 Perl 6!"
15:34 sjoshi left 15:35 rx joined, P6fr left
rx hi guyd 15:35
guys*
tbrowder sena_kun: duh, thanks! is that from the .tell comments i see? 15:38
sena_kun: duh, thanks! is that from the .tell comments i see? [Read The Fine Msg!!] 15:39
TimToady home again from Rome
yoleaux 22 Jul 2016 14:48Z <gfldex> TimToady: your judgment on `my Int:D $i = Nil` and `sub f(-->Int:D){Nil}` is required
sena_kun tbrowder, yes. One of the yoleaux purposes is to deliver messages to people who are not online *right now*, but will be here in the future. dpk.io/yoleaux - here is a link to common commands. 15:40
15:41 dainis left
gfldex what is the syntax for having \-interpolation of unicode names? 15:42
AlexDaniel m: say “hello \c[PILE OF POO]” 15:43
evalable AlexDaniel: |«HEAD»: hello 💩
gfldex thanks
m: my $s = "Camelia \u[BROKEN HEART] my \u[HEAVY BLACK HEART]!"; dd $s; 15:44
evalable gfldex: gist.github.com/1ba2142a4cf370f37b...be165fc897
tbrowder sena_kun: so any way to tell who to reply to? or how does one properly answer something from yoleaux when the sender is unknown? 15:45
gfldex m: my $s = "Camelia \c[BROKEN HEART] my \c[HEAVY BLACK HEART]!"; dd $s;
evalable gfldex: |«HEAD»: Str $s = "Camelia 💔 my ❤!"
15:45 rx left
sena_kun sena_kun, yoleaux writes sender of message, just like above: time <$nickname-of-sender> $receiver: $message(maybe my formatting is bad, but I hope it's easy to understand). So you can see who is sender and use it in your own query. 15:46
dalek c: af84958 | (Wenzel P. P. Peppmeyer)++ | doc/Language/quoting.pod6:
show how to interpolate with unicode
15:47
sena_kun Ah.
tbrowder, my message before last~ 15:48
tbrowder okay, it looked like it was "<unmatched>" but it seems to be zoffix up to his old alias trick to confuse old people <unmatched}> 15:50
.tell $unmatched} is that you, Zoffix? 15:51
yoleaux tbrowder: What kind of a name is "$unmatched}"?!
AlexDaniel without $
tbrowder .tell unmatched} is that you, Zoffix?
yoleaux tbrowder: I'll pass your message to unmatched}.
AlexDaniel yeah, it's pretty hard to .tell him something because of his constant nick changes 15:52
15:52 harmil joined
AlexDaniel 💔 is a very cool symbol by the way 15:52
sena_kun Ah, sorry. I meant "$" symbol just as a sigil to show it's a "variable", for actual command it doesn't needed. 15:53
15:54 darutoko joined
harmil This code segfaults my older star release, would someone mind testing it on a newer one? Prints about 1100 lines then segvs. $ perl6 -e 'for 0..0xffff -> $i { say $i; my $c = try { :16(uniprop($i.chr, "Bidi_Mirroring_Glyph")).chr }; say "{$i.fmt("%04x")}: {$i.chr} ~ $c" if $c.defined}' 15:55
15:55 pierrot_ is now known as pierrot
harmil Didn't want to crash the IRC bot... 15:55
or is a fresh interpreter run for each bot command? 15:56
15:56 dainis joined
AlexDaniel yes 15:56
harmil oh, cool
AlexDaniel m: for 0..0xffff -> $i { say $i; my $c = try { :16(uniprop($i.chr, "Bidi_Mirroring_Glyph")).chr }; say "{$i.fmt("%04x")}: {$i.chr} ~ $c" if $c.defined}
evalable AlexDaniel: gist.github.com/9f52f2a53e11a4d951...f203e3b714
tbrowder .tell unmatched} I'm aware of the problem, and I hope to work on it after I get the basic table working and accepted first. At the moment I don't know if that will require grammar work or not. I don't have the knowledge or experience enough yet to dig into the grammar and actions, but ShimmerFairy does. I will try an experiment later today which I hope will
show me whether or not it requires grammar work.
yoleaux tbrowder: I'll pass your message to unmatched}.
AlexDaniel m: for 0..0xffff -> $i { say $i; my $c = try { :16(uniprop($i.chr, "Bidi_Mirroring_Glyph")).chr }; say "{$i.fmt("%04x")}: {$i.chr} ~ $c" if $c.defined} 15:57
evalable AlexDaniel: gist.github.com/feaab41c4c66bf8933...f3f820754f
harmil m: for 0..0xffff -> $i { my $c = try { :16(uniprop($i.chr, "Bidi_Mirroring_Glyph")).chr }; say "{$i.fmt("%04x")}: {$i.chr} ~ $c" if $c.defined}
evalable harmil: |«HEAD»:
15:57 cyphase left
AlexDaniel ok, so it does segfault 15:57
harmil It's failing in a strange way. I would have expected that say to have output a few matches. 15:58
tbrowder thnx for the yoleaux lessons, sena_kun and AlexDaniel!
16:00 iH2O joined
harmil BTW: I have to say I discovered accidentally and absolutely LOVE that "" works inside of {} inside of ""! 16:00
16:01 cyphase joined
harmil I'll bug the above 16:01
sena_kun tbrowder, no problem.
16:03 pmurias left
TimToady harmil: that's due to our strict one-pass policy; we never look for the closing delim and rescan 16:04
gfldex TimToady++ # for www.youtube.com/watch?v=BJIfPFpaMRI 16:05
16:06 holyghost left, cdg joined
harmil TimToady: When I wote "{$i.fmt("%04x")}" I didn't even think about whether or not it would work, it just did. I think that really speaks to Perl 6's MO. 16:06
kalkin- Hmm i can't figure out how to make use of EVAL so that i keep some kind of context 16:07
TimToady another way to state it is that we always know exactly which language we're parsing at each point
16:07 Gothmog_ joined 16:08 jmiven joined, dainis left
kalkin- I looked at the repl implementation in rakudo, but it uses a lot of nqp and it somehow works differently (or I don't understand it fully) 16:09
TimToady afaik, it's still uses nested lexical scopes to emulate progress through a single lexical scope, which is a bit problematic in some ways 16:10
kalkin- I'm not sure if I fully understand what I need to do, but I try to sum up: I need to find a way to merge the lexical scope of an EVAL execution with the outside lexical scope. (Right?)
TimToady sounds about right 16:11
if the transactional support was there for it, we could even undo multiple statements 16:12
mst TimToady: if you want to see something really funny, look at my Eval::WithLexicals ;)
AlexDaniel m: say “\c[SHRUG]”
evalable AlexDaniel: |«HEAD»: ===SORRY!=== Error while compiling /tmp/_RngWLbH53␤Unrecognized character name SHRUG␤at /tmp/_RngWLbH53:1␤------> say “\c[SHRUG<HERE>]” exit code = 1
TimToady mst: I'm not sure my jet-lagged brane would survive that 16:13
mst TimToady: oh, it's easy, just a coderef in @INC, a source filter, and B.pm ;) 16:14
(what it lacks in sanity it makes up for by providing a persistent lexical env while not requiring non-core XS ;)
kalkin- How do I get all variables of the current lexical scope?
moritz kalkin-: MY:: or so 16:16
TimToady m: say MY::.keys
evalable TimToady: |«HEAD»: ($=pod !UNIT_MARKER EXPORT $_ $! ::?PACKAGE GLOBALish $¢ $=finish $/ $?PACKAGE)
kalkin- moritz & TimToady: awesome thanks 16:17
16:18 AndyBotwin joined 16:19 iH2O left 16:26 Tonik left 16:28 holyghost joined, holyghost left 16:30 holyghost joined 16:32 holyghost left
timotimo where are my goddarned kexs!? 16:33
keys, duh
16:36 Guest66 joined 16:40 bob777 left 16:41 bob777 joined
moritz timotimo: check your keyboard :-) 16:42
harmil moritz: or under the cat 16:48
Which, in many cases is isomorphic to checking the keyboard.
16:51 kurahaupo left, kaare_ joined 16:54 adu joined 16:55 kaare__ left 16:56 kid51 joined, aindilis joined 16:57 kid51 left 16:58 adu left 17:00 domidumont joined 17:03 holyghost joined
kalkin- I try to read only one character from $*IN, but it always waits for me pressing enter or CTRL+D. I tried `$*IN.getc` and `$*IN.readchars(1)` but both waits for me pressing enter 17:07
17:09 sena_kun left 17:10 holyghost left 17:12 holyghost joined
kalkin- How do I get one char from the STDIN in real time without waiting for user pressing enter 17:15
holyghost while (<STDIN>) last; 17:17
etc
moritz m: say $*IN.readchars(1) 17:18
evalable moritz: |«HEAD»:
moritz no, still waits for enter 17:19
17:19 zacts joined, adu joined
moritz even getc waits :( 17:20
AlexDaniel moritz: nothing in stdin on evalable :) 17:21
kalkin- holyghost: I'm not sure what is happening there.
Also it says i should use $*IN.lines or add whitespace to sppress warning 17:24
but where should i add whitespace?
AlexDaniel kalkin-: what's in your code exactly? 17:26
kalkin- ok i figured this at least doesn't throw errors while (< STDIN>) { last }; 17:27
i think i figured it out 17:28
17:29 wamba joined
kalkin- ok so I have my while (< STDIN>) loop but $_ is Any instead of being a Str and is called the whole time over and over 17:31
how do i access the characters?
or bytes
something :)
holyghost <STDIN> can get your file `cat`ted as input, 17:33
arnsholt To read character by character, you need to twiddle the buffering of the filehandle you're reading from 17:34
Not sure if (and if so how) that's exposed in Perl 6 17:35
By default, stdin is line-buffered
holyghost just do a string match on $_
$_[0] should be right
so while (<STDIN>) { print $_[0]; last; }; 1; 17:36
AFAIK :-)
if you want to know, $_ is a metasyntactic variable 17:37
search on it in google or something
17:37 Guest66 left
kalkin- holyghost: no this doesn't work. because $_[0] is Any even before i have a change to enter anything 17:37
s/change/chance/g 17:38
holyghost try print Str $_[0] ?
or $_.Str or something 17:39
kalkin- $_ uninitialized value in string context
I think i can't create a Str from Any
17:39 Guest66 joined
holyghost WAM 17:40
kalkin- ? 17:41
mst warren abstract machine? 17:42
no, this is #perl6, not ##prolog
kalkin- hmm i figured how i can do this in zsh while read -sk 1 a; do printf %s "$a"; done 17:44
holyghost you can do it in awk also if you like
WAM == wait a minute 17:45
ugexe next unless $_.?chars;
holyghost <STDIN> in unsupported, sorry my mistake it seems
kalkin- i figured you can just do < STDIN> to supress it :) 17:46
holyghost I am still learning 6 :-)
s/6/perl 6/ 17:48
17:50 GNUYawk joined
GNUYawk i had they’re making a ruby6 to compete with perl6 17:51
17:51 domidumont left
ugexe that pretty much exists already under the name perl6 17:52
geekosaur I thought it existed under the name smalltalk >.> 17:53
17:53 skrhn joined
skrhn How would I do this? 17:54
m: my Int @a := 1..50;
evalable skrhn: |«HEAD»: Type check failed in binding; expected Positional[Int] but got Range (1..50)␤ in block <unit> at /tmp/I3dyumCPSK line 1␤ exit code = 1
GNUYawk ugexe: but is it true
skrhn m: my Int @a = 1..50 # works 18:00
evalable skrhn: |«HEAD»:
18:00 zacts left 18:03 cosimo joined 18:06 skrhn left 18:15 kid51 joined, khw joined
cognominal jnthn++ # gut-blog 18:15
yoleaux 22 Jul 2016 14:11Z <Ven> cognominal: medium.com/@octskyward/graal-truff...4d8f28fb69 thought about you :)
18:17 espadrine left 18:21 Guest66 left
harmil m: [**] lazy 3,3,3 18:25
evalable harmil: |«HEAD»: Cannot reverse a lazy list␤ in block <unit> at /tmp/sAUhGbog8P line 1␤␤Actually thrown at:␤ in block <unit> at /tmp/sAUhGbog8P line 1␤ exit code = 1
harmil That seems somewhat hostile...
TimToady lazy is a proxy for probably infinite
m: [**] eager lazy 3,3,3
evalable TimToady: |«HEAD»:
TimToady m: say [**] eager lazy 3,3,3
evalable TimToady: |«HEAD»: 7625597484987 18:26
18:26 colomon joined
TimToady and arguably, there aren't that many right-associative operators you want to reduce with anyway 18:27
but maybe we could throw an eager in there somewhere 18:28
18:29 girafe left
TimToady maybe the error message is LTA, though, it could at least suggest eager 18:29
harmil Well, I suppose it's the only operator you're likely to do that with. I'm still questioning the hilarity of [=]... 18:31
18:31 adu left, girafe joined 18:34 colomon left 18:40 awwaiid joined
timotimo i liked your keynote alot, TimToady 18:43
jdv79 is it easy to find? 18:44
timotimo in order to appreciate p6 you sometimes need to look at its features and realize how few languages have 'em
18:44 parabolize joined
timotimo curry on larry wall in youtube search ought to do it 18:45
jdv79 that requires that you know a lot of different langs decently well
53:58?
18:46 adu joined
harmil Is there a better way to say "\\c[{$i.fmt("%x")}]".EVAL 18:49
I can't find a uni* function for going from the name to the character or codepoint. 18:50
er, I just mixed two very different bits of code, sorry. I meant "\\c[$name]".EVAL 18:51
timotimo i wished for that function before
AlexDaniel what a good question
timotimo i exposed the nqp op for the lookup i think
but i didnt want to decide on the p6 function name
AlexDaniel harmil: rakudobug it 18:52
harmil okay 18:53
AlexDaniel m: say “\c[PILE OF POO]”.uniname
evalable AlexDaniel: |«HEAD»: PILE OF POO
18:54 autarch joined
timotimo codepointffromname 18:55
is the name of tge nqp op
one less f
harmil bugged 18:57
timotimo hm?
harmil I sent it to the bug address
m: my $name = "COMMA"; say "char: qq\{\\c[$name]}".EVAL
evalable harmil: |«HEAD»: ,
timotimo ah 18:58
harmil m: my $name = "COMMA"; say "qq\{\\c[$name]}".EVAL
evalable harmil: |«HEAD»: ,
timotimo we usually write "rakudobugged" for that
harmil Yeah, that's it.
rakudobugged :)
AlexDaniel m: use MONKEY-GUTS; say nqp::codepointfromname(“\c[PILE OF POO]”.uniname).chr
evalable AlexDaniel: |«HEAD»: 💩
timotimo bugged sounds like its short for "that's bugged"
ad, without the \c 18:59
18:59 domidumont joined
timotimo i dont habe a proper keyboard here 19:00
AlexDaniel: ∆
19:02 lucastheisen joined
lucastheisen has anyone been able to compile for cygwin since 2.5 when they implemented pthread_barrier? 19:03
19:08 GNUYawk left 19:12 GNUYawk joined 19:19 trnh joined 19:22 adu left, kaare__ joined 19:25 adu joined, kaare_ left 19:30 holyghost left 19:34 BenGoldberg joined
BenGoldberg m: my \c = $(42); say c++; 19:35
evalable BenGoldberg: gist.github.com/304125b6f174398781...6d2e3e8723
BenGoldberg m: my \c = $(42); say c; 19:36
evalable BenGoldberg: |«HEAD»: 42
BenGoldberg m: my \c = $(42); say c = 7;
evalable BenGoldberg: |«HEAD»: Cannot modify an immutable Int␤ in block <unit> at /tmp/wEHD3cvnNM line 1␤ exit code = 1
BenGoldberg m: my \c = $ = 42; say c = 7; 19:37
evalable BenGoldberg: |«HEAD»: 7
BenGoldberg m: my \c = $ = 42; say c++;
evalable BenGoldberg: |«HEAD»: 42
BenGoldberg m: my \c = $ = 42; say ++c;
19:37 BenGoldberg left
evalable BenGoldberg: |«HEAD»: 43 19:37
19:40 trnh left 19:42 domidumont left 19:43 pmqs left, trnh joined
timotimo wtf? 19:43
19:43 labster joined 19:44 kaare__ left 19:46 kaare__ joined
geekosaur has anyone actually gone to #freenode and asked why sigyn is killing both legitimate bots and legitimate users thereof? 19:47
harmil Freenode doesn
doesn''t parse Perl6 :)
TimToady maybe it's a python bot waging war :) 19:48
mst geekosaur: no, nobody bothered telling me, your freenode staff contact, either
fortunately, I just noticed it in backlog
camelia and nine are un-k-lined
harmil mst++ 19:49
mst as now is bengoldberg
and that's the antispam bot out until we can reconfigure it 19:51
19:52 Tonik joined 19:54 pmqs joined 19:56 darutoko left 20:04 colomon joined 20:06 Tonik left 20:08 RabidGravy left 20:09 colomon left 20:12 jersni joined 20:15 jersni left 20:16 trnh left 20:20 Sgeo_ joined 20:21 lucastheisen left 20:23 adu left 20:24 Sgeo left 20:25 Sgeo_ left, Sgeo joined 20:26 camelia joined
moritz m: say 42 20:27
evalable moritz: |«HEAD»: 42
20:27 ChanServ sets mode: +v camelia
camelia rakudo-moar 78915a: OUTPUT«42␤» 20:27
AlexDaniel \o/ 20:28
lizmat moritz++
20:28 evalable left
moritz mst++ 20:28
AlexDaniel bye-bye evalable
mst see how much quicker these thing go when you actually bother telling your IRC contact? :)
lizmat :-) 20:29
mst sorry. this is my "damnit, I hate it when people don't report bugs" sarcasm coming out :P
moritz: thanks for bringing 'er back up
next time, gimme a shout if you have to turn 'er off :) 20:30
lizmat mst: we know how to find you for these things now :-)
mst I'm group contact. when I first became group contact, I explained in here at length that that meant I was the person to come to for IRC stuff. 20:31
lizmat mst: fwiw, I must have missed that :-(
mst I /msg-ed the various ops of here as well 20:32
moritz was notified to report any problems to me on Feb 27, and thanked me for telling him
20:32 trnh joined, trnh left, trnh joined
mst apparently everybody forgot :( 20:32
lizmat mst: it's just one of those things when everything is always running smoothly 20:33
TimToady mst: you're so unmemorable :P
lizmat you forget what you had to do to fix things
20:33 BenGoldberg joined
lizmat unused skills disappear 20:33
mst TimToady: maybe I should try growing an insane moustache
AlexDaniel mst: you sound like something tragic happened :) 20:34
lizmat
.oO( would be cool for Movember )
AlexDaniel camelia was on her little vacation
harmil Relevant to a reddit discussion, will reduction ops (e.g. [*]) be auto-concurrencied once that's in or just listish hyperops?
AlexDaniel and evalable did OK job while she was offline
mst AlexDaniel: which meant nine was K-lined
and then because it wasn't reported, BenGoldberg also got K-lined
AlexDaniel well… 20:35
mst how many regulars/contributors need to get screwed over before you start caring?
I prefer fixing things at zero :P
harmil BTW: I sent BenGoldberg some mail letting him know the situation.
AlexDaniel ok good point
BenGoldberg goes off to check his email ... :)
harmil Ha!
BenGoldberg: I missed that you'd come back
BenGoldberg :) 20:36
mst and it only got fixed now because I spotted somebody saying 'antispam' in #perl6-dev and went "wait, hang on"
I would prefer to not have to rely on my "this is an unreported bug" spidey sense to fix things with minimum collateral damage
AlexDaniel spidey sense :D 20:37
mst I've been doing this somewhere over ten years. things ... smell wrong ... sometimes 20:38
lizmat
.oO( a disturbance in the force )
mst if I could write down the decision making algorith, I'd've uploaded it to cpan already ;) 20:39
AlexDaniel by the way, jnthn++ for fixing this nasty string bug
mst: by the way, is there somebody else we can contact if you are offline? 20:40
mst well, for a k-line, you email [email@hidden.address]
if the weather has turned cloudly with showers of fuckwittery, poke #freenode for an active staffer if there's no chanops around 20:41
20:41 zacts joined 20:42 labster left
geekosaur I had missed the announcement in here as well, but also I'm not a channel operator or etc. (otoh I was also being a bit snarky when I asked if anyone had thought to say something...) 20:42
20:43 kaare__ left 20:44 skrhn joined
mst geekosaur: yeah, well, apparently you were right :P 20:44
and as the only person who apparently even thought about it, I'm hereby making you responsible as well
20:45 CIAvash left
mst also, now you totally are a channel operator 20:45
geekosaur++ # well volunteered
zacts wait, so is much of Perl6 implemented in Perl6?
skrhn Newbie Channels question: gist.github.com/skrisna/8c8dd49595...1442898331 hangs
geekosaur zacts, large chunks of it, yes
zacts ok cool
cool 20:46
yeah, this Perl6 seems pretty sweet
20:47 espadrine joined
zacts I still wonder if I should brush up on my Perl5 skills before teaching myself Perl6 20:47
or if I can just dive in, coming from Ruby
geekosaur enough is different from perl5 that you'd just have to unlearn a bunch of it :) 20:48
skrhn zacts: suggest you forget perl5 .. it will just confuse you more
zacts I don't have any professional Perl5 I have to do now, and it's just a hobby currently
gfldex zacts: you will likely confuse yourself when dealing with Perl 5 and Perl 6 at the same time
zacts ok
I think I might just dive-in and see how far I get
skrhn zacts: I am a perl5 programmer just starting out with perl6. I would suggest www.jnthn.net/papers/2015-spw-perl6-course.pdf 20:49
zacts cool thanks skrhn 20:50
skrhn then perl6intro
zacts ok
skrhn but the course does not teach concurrency, etc 20:51
zacts ok 20:52
cool
AlexDaniel zacts: have you seen this? docs.perl6.org/language/rb-nutshell 20:54
lizmat hmmm.... jnthn blogged: 6guts.wordpress.com/2016/07/23/assorted-fixes/ 20:58
zacts AlexDaniel: indeed I have, but I still have yet to fully read it 21:13
21:13 labster joined
zacts it looks cool 21:13
21:15 paraboli` joined, wamba left, parabolize left 21:16 setty2 joined, rindolf left, tinita left, tinita joined 21:17 dvinciguerra_ joined, cyphase left, TimToady left, TimToady joined, setty1 left, setty2 is now known as setty1 21:19 zacts left 21:20 cyphase joined 21:25 rindolf joined 21:27 RabidGravy joined 21:29 solarbunny left, rindolf left 21:32 GNUYawk left 21:34 trnh left 21:35 solarbunny joined 21:37 ufobat left 21:41 woolfy joined
woolfy What a nice surprise. :-) www.wendy.org/O'Reilly%20Publishers...atient.png 21:43
lizmat :-) 21:46
woolfy (yeah, I know, a bit lame) 21:48
21:52 skrhn left
gfldex m: my Int:D @a; @a[0,1] = 1,1; @a[1] = Nil; @a[0]:delete; dd @a; 21:54
camelia rakudo-moar 1724f8: OUTPUT«Array[Int:D] @a = Array[Int:D].new(Int:D, Int:D)␤»
gfldex i'm not as happy as those Ints
m: my Int:D @a; @a[0,1] = 1,1; @a[1] = Nil; @a[0]:delete; dd @a, @a.WHAT;
camelia rakudo-moar 1724f8: OUTPUT«Array[Int:D] @a = Array[Int:D].new(Int:D, Int:D)␤Cannot look up attributes in a type object␤ in block <unit> at <tmp> line 1␤␤»
lizmat gfldex: the error is a dd artefact, no ? 21:56
gfldex m: my Int:D @a; dd @a.WHAT;
camelia rakudo-moar 1724f8: OUTPUT«Cannot look up attributes in a type object␤ in block <unit> at <tmp> line 1␤␤»
gfldex m: my Int:D @a; dd @a[0].WHAT ~~ Int:D;
camelia rakudo-moar 1724f8: OUTPUT«Bool::False␤»
gfldex m: my Int:D @a; dd @a[0] ~~ Int:D; 21:57
camelia rakudo-moar 1724f8: OUTPUT«Bool::False␤»
gfldex m: my Int:D @a; dd @a[0].WHAT =:= Int:D;
camelia rakudo-moar 1724f8: OUTPUT«Bool::True␤»
21:59 dvinciguerra_ left 22:00 froobar joined, TEttinger left 22:01 trnh joined 22:03 kurahaupo joined, kurahaupo left 22:04 kurahaupo joined, setty1 left 22:05 TEttinger joined 22:08 s34n joined
s34n hello 22:08
22:08 kurahaupo left
lizmat hello s34n 22:09
s34n I'm browsing perl6, trying to learn a little at a time. Today, I was looking at grammars and specifically reading stackoverflow.com/questions/1856117...ence-rules
I was hoping that somebody would be kind enough to answer very newbie questions about perl6 syntax 22:10
22:10 espadrine left 22:11 kurahaupo joined
s34n for instance, what does <expr=.add> mean? 22:11
ah. <> means a named subrule? 22:12
22:15 pmurias joined
s34n so <expr=add> will match a subrule named 'expr' into a capture called 'add', right? 22:16
so what does the '.' do?
and where is expr defined? 22:17
22:19 spider-mario left, GNUYawk joined
s34n oh. I got it backwards. 'expr' is the name of the capture. '.add' is the subrule 22:21
pmurias lizmat: I implemented nqp::readcharfh on the JVM (and JS) as requested by that old nqp ticket (found that while going through the nqp for things to close). I'm not touching Parrot ;) 22:22
lizmat pmurias++
s34n the '.' just means that the subrule is a 'sibling method' on the same grammar? 22:23
22:25 spider-mario joined
s34n did I read that right? 22:25
lizmat draws a blank 22:27
22:27 skrshn joined, pmurias_ joined
s34n lizmat: from me? 22:27
22:27 pmurias left
lizmat the period means something really simple, but I guess I'm too tired to remember what it was 22:28
too deep in optimizing perl 6 settings :-( 22:29
geekosaur iirc it means don't also assign the result of parsing the add subrule to a capture named add 22:31
s34n I'm guessing it means that the rule is defined as a rule in the current 'class'
geekosaur: oh.hmmm 22:32
<.name> means don't capture, so maybe so. but that seems to contradict renaming the capture... 22:33
22:34 pmurias_ is now known as pmurias
s34n geekosaur: what do you mean by 'also'? also, in addition to what? 22:34
geekosaur it means don't put it in *both* captures, which it would otherwise do
hence the "also"
s34n ah
oh. without the plus, the capture is stored under both keys? 22:35
s/plus/'.'/
22:35 GNUYawk left
s34n next question regards -> token mult-op:sym<times> { <sym>|'*' } 22:37
what does :sym<times> mean?
geekosaur that breaks up as token class mult-op, token type sym (symbol), token name "times" 22:38
s34n sym is a type? 22:39
geekosaur um, no, these are grammatical categories, not types as in the type system 22:40
s34n geekosaur: I'm still lost 22:42
<times> looks like the named subrule idea again 22:43
geekosaur insofar as these definitions are concerned, I think it's just a way to group related tokens together. so any token that acts as a mult-op gets the prefix `mult-op:`; `sym` is any token that is a symbol (vs. a term or various other things), and the thing in the brackets is the actual name
(I assume from context that mult-op means a multiplication operator)
design.perl6.org/S02.html#Grammatical_Categories is the relevant part of the design documents 22:44
s34n geekosaur: here's a restatement that works in my brain: this declares a regex (token) named 'times' that is of 'type' mult-op. 22:48
is that close?
geekosaur not really, since the category isn't actually used for anything. it's just a way to structure names that are used in similar ways
s34n so anywhere we say <mult-op> it will do [<times> | <divided>] ? kinda? 22:49
geekosaur in particular I don't think the grammar stuff is smart enough to automatically define a rule `term` that tries any token named `term:<whatever>`
s34n geekosaur: I see in the lines above, rule multiply { <digit> +% [ <mult-op> ] } where <mult-op> is wrapped in [] for grouping 22:52
why does it need to be grouped?
TimToady I believe as currently implemented you must define a proto token mult-op to get the ability to call the alternation as <mult-op> 22:53
s34n TimToady: they have a proto token mult-op 22:54
TimToady then it's just an extensible alternation 22:55
22:55 andrzejku left
s34n do mult-op is an alternation, right? that's why it needs [ ] ? 22:56
s/do/so/
22:56 pmqs left
TimToady you can have normal alternations inside a proto alternation 22:56
s34n is sym a reseved word in perl6?
TimToady if they're at the top level, it's as if you defined two multis
all the LTM is transitive on the prefix, anyway 22:57
s34n TimToady: sorry. I didn't understand 'LTM', 'transitive', or 'prefix'
TimToady sym is specially recognized, if that's what you mean
mostly it defines <sym> inside so you don't have to repeat yourself 22:58
s34n yes. that's what I meant.
TimToady but also makes the symbol available for operator construction, say
s34n so sym<times> turns 'times' into a symbol? 22:59
TimToady only if the action does something with it, which infix et all do
but sym is automatically available in the AST, so it's pretty handy 23:00
s34n so it's a symbol just within the {} that follows?
dalek sectbot: 1182968 | (Daniel Green)++ | / (4 files):
Add support for timing out the bots
TimToady if you match it with <sym> it persists in the resulting match object, which the action method may turn into something else 23:01
though more typically the action method is also differentiated with :sym<foo> 23:02
grep '\<sym\>' src/Perl6/Actions.nqp to see it all in action (pun intented) 23:03
23:03 pmurias left
s34n could -> token mult-op:sym<times> { <sym>|'*' } <- be rewritten -> token mult-op { [times || '*']} ? 23:04
TimToady not really, in the latter case, the '*' would not participate in LTM 23:05
you could use | there though instead
s34n TimToady: what does 'LTM' mean? 23:06
TimToady but also you wouldn't have $<sym> available to the action routine, so you'd have to do another string comparison against the whole match
longest token matching
s34n hmm. so <sym> is just a regular named subrule 23:08
?
TimToady transitive means that if a token calls another token it bubbles up into the whole list of tokens that it does LTM over
yes, but automatically defined specially within the {}
dalek c: caa99e1 | (Wenzel P. P. Peppmeyer)++ | doc/Type/Range.pod6:
Range and $-sigiled containers are slightly trappy
23:09
s34n right. defined by the sym<times> thing preceding the {}, right?
TimToady right
s34n ok. so I get everything inside the {} 23:10
TimToady it's just a convenience, since we want to use the identity of the operator anyway, might as well use the operator itself as a distinguishing part of the name
and then why repeat ourselves to match it?
23:11 pmqs joined
s34n but how does sym<times> define sym? that's because 'sym' means something in perl? it lexically defines a symbol? 23:11
TimToady basically, the built-in sym rule knows to look up the name of the current routine and pull out the symbol
and since it's known at compile time, it could be treated as a literal match 23:12
certainly it's treated sufficiently as a literal that we can let it participate in the lexer we automatically write for you 23:13
23:15 spider-mario left
s34n ok. I think the concept I'm missing here is prefixes 23:15
mult-op can be used as a prefix
23:15 spider-mario joined
s34n ? 23:15
TimToady different meaning of prefix here, sorry
23:15 trnh left
TimToady I mean the set of all the longest tokens that could match at the current point in the puarse 23:16
*parse
every rule that participates in in the overall alternation at this point has a "prefix" that is declarational, and maybe the rest of the rule that does matching by more operational means 23:17
23:17 labster left
s34n I'm reading geekosaur's link and I see things like infix:<cmp> 23:17
TimToady to the first approximation, the "prefix" I'm talking about is the front that can be matched by real regular expressions (in the technical sense) 23:18
s34n so I need to understand something:else syntax
TimToady you can extend any identifier using the pair notation if it follows without space 23:19
m: my $foo:bar = 42; say $foo:bar
camelia rakudo-moar 32c08b: OUTPUT«42␤»
23:20 labster joined
TimToady m: my $foo:bar<baz> = 42; say $foo:bar<baz> 23:20
camelia rakudo-moar 32c08b: OUTPUT«42␤»
TimToady but since that's a quoting form, you can sneak non-wordy characters in
(as part of the identity of the, er, "identifier")
we can use this for various things, depending on the key of the pair 23:22
so there are things like infix:sym<cmp> that name a rule that will eventually result in an operator named infix:<cmp>
but that's just convention
other places we use the form: use Foo::Bar:from<Perl5> 23:23
gfldex m: sub foo:bar(){};
camelia rakudo-moar 32c08b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Null operator is not allowed␤at <tmp>:1␤------> 3sub foo:bar()7⏏5{};␤»
gfldex m: my &foo:bar = sub (){}; foo:bar; 23:24
camelia ( no output )
TimToady m: sub foo:bar (){};
camelia ( no output )
TimToady the pair will eat the () if it can
gfldex TimToady: you just made a pretty big hole in docs.perl6.org visible 23:25
23:25 spider-mario left
TimToady yes, I'm not interested in culturally ruling out that space 23:25
I don't really believe in necessarily making the call syntax look like the definition syntax
similar things that are different should look a little different sometimes :) 23:26
gfldex the space is not the hole part. We missed the whole foo:bar ordeal
TimToady ah, yes, well, that's why we're doing documentation this year, among other things :)
s34n I'm trying to catch up here. : with no spaces around it creates a 'pair'? 23:27
jdv79 i thought it was the year of perf
TimToady that too
this is just "doc perf" :)
gfldex we also making the docs faster :)
TimToady s34n: not exactly 23:28
s34n ?
TimToady we reuse colon followed by an identifier plus brackets as a pair notation 23:29
geekosaur s34n, :name{expr} defines a colonpair; it's the same as (name => expr). but the {} can be replaced by various other things to quote the expr, so :name<x y> is :name{'x', 'y'} is (name => ['x', 'y'])
gfldex m: my $foo:bar = 1; my $foo:bar<2> = 2; dd MY::.keys
camelia rakudo-moar 32c08b: OUTPUT«("\$=pod", "!UNIT_MARKER", "EXPORT", "\$_", "\$!", "\$foo:bar", "::?PACKAGE", "GLOBALish", "\$¢", "\$=finish", "\$/", "\$foo:bar<2>", "\$?PACKAGE").Seq␤»
TimToady and you can leave out either the identifier or the brackets for specialized uses
gfldex m: my $foo:bar<1> = 1; my $foo:bar<2> = 2; dd MY::.keys
camelia rakudo-moar 32c08b: OUTPUT«("\$=pod", "!UNIT_MARKER", "EXPORT", "\$_", "\$!", "::?PACKAGE", "GLOBALish", "\$¢", "\$=finish", "\$/", "\$foo:bar<1>", "\$foo:bar<2>", "\$?PACKAGE").Seq␤»
TimToady the fact that in foo:bar there's a foo in front of the :bar is kind of accidental
that's just one of the spots that p6 tries to make sense of "adverbial pair" notation 23:30
you can use :foo(42) anywhere you might use foo => 42 to generate a pair, but you can't always use foo => 42 anywhere you can use :foo(42) 23:31
so you can use either form for named args to a function, but lots of more specialized syntaxes require the colon form for disambiguation 23:32
it's just a convenient syntax we can reuse in many different ways
even the radix form :16<deadbeef> is a variant of it 23:33
hmm, I wonder
m: my $foo:16<deadbeef> = 42; say $foo:16<deadbeef> 23:34
camelia rakudo-moar 32c08b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Confused␤at <tmp>:1␤------> 3my $foo:7⏏0516<deadbeef> = 42; say $foo:16<deadbeef>␤ expecting any of:␤ colon pair␤»
TimToady nah :)
23:34 dvinciguerra_ joined
TimToady that one has to be alpha 23:34
BenGoldberg .seen huggable 23:35
yoleaux I saw huggable 22 Jul 2016 14:09 EDT in #perl6: <huggable> unmatched}, Added speed is as Some speed stats: tux.nl/Talks/CSV6/speed4.html
s34n I don't get the part about extending any identifier using pair notation 23:38
gfldex s34n: have a look at docs.perl6.org/language/typesystem...Authorship to see what it's good for 23:39
s34n $foo:bar<baz> <- so :bar<baz> gets turned into a pair? How does a pair be part of an identifier? 23:40
gfldex if we would have proper macros one coud play more cards with this
s34n: it's just part of the name but the compiler/a future macro could do fancy stuff with it
TimToady in a name, we simply canonicalize it to a string, but logically it still has structure that can contain arbitrary data 23:41
if you work at it, you can see the canonicalization 23:42
m: my $foo:bar<\<\>> = 42; say MY::.keys
camelia rakudo-moar 32c08b: OUTPUT«($=pod !UNIT_MARKER EXPORT $_ $! ::?PACKAGE GLOBALish $¢ $foo:bar«<>» $=finish $/ $?PACKAGE)␤»
TimToady notice that it canonicalized to $foo:bar«<>» 23:43
BenGoldberg m: my $foo:bar<x y>; dd grep /foo/, MY::.keys;
camelia rakudo-moar 32c08b: OUTPUT«("\$foo:bar<x y>",).Seq␤»
dalek sectbot: 4fc97b7 | (Daniel Green)++ | Perl6IRCBotable.pm:
Change how exit status is handled so if the given code segfaults, the exit status is 11
BenGoldberg m: dd Mu;
camelia rakudo-moar 32c08b: OUTPUT«Mu␤»
BenGoldberg m: dd Mu<x y>;
camelia rakudo-moar 32c08b: OUTPUT«Cannot resolve caller postcircumfix:<{ }>(Mu, ("x", "y")); none of these signatures match:␤ (\SELF, \key)␤ (\SELF, \key, Mu \ASSIGN)␤ (\SELF, \key, Mu :$BIND! is raw)␤ (\SELF, \key, :$SINK!, *%other)␤ (\SELF, \key, :$delete!, *%oth…»
gfldex m: my $i = 42; my $foo:bar«$i»; dd MY::.keys; 23:45
camelia rakudo-moar 32c08b: OUTPUT«===SORRY!===␤QAST::Var with scope '' NYI␤»
gfldex o.0
m: my $i = 42; my $foo:bar«$i»;
camelia rakudo-moar 32c08b: OUTPUT«===SORRY!===␤QAST::Var with scope '' NYI␤»
gfldex do I spot a lack of $?LINE ? 23:46
s34n m: my $i = 2; my $foo:bar«$i»;
camelia rakudo-moar 32c08b: OUTPUT«===SORRY!===␤QAST::Var with scope '' NYI␤»
geekosaur it's mentioning QAST, it's internal low level stuff that oughn't be leaking through... 23:47
s34n m: my $i = 2; my $foo:bar«2» = 42; say $foo:bar«$i»; 23:48
camelia rakudo-moar 32c08b: OUTPUT«Use of uninitialized value $i of type Any in string context␤Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in code at <tmp> line 1␤5===SORRY!5=== Error while compiling <tmp>␤Variable '$foo:bar<>' is not declared…»
s34n I still don't get inserting a pair into an identifier 23:53
geekosaur guesses that $i needs to be known at compile time
m: my $i ::= 2; my $foo:bar«2» = 42; say $foo:bar«$i»;
camelia rakudo-moar 32c08b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤"::=" not yet implemented. Sorry. ␤at <tmp>:1␤------> 3my $i ::= 27⏏5; my $foo:bar«2» = 42; say $foo:bar«$i»;␤»
geekosaur beh
gfldex LTA filed as #128712 23:56
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=128712
23:57 RabidGravy left
s34n but back to that grammar, wouldn't mult-op and mult-op:sym<times> be two different identifiers? 23:58
TimToady sure, but when you call mult-op, it knows all its candidates begin with mult-op 23:59
with all multiple dispatch in P6, you really call the proto, and the proto calls which multi candidates it decides to
in the case of rules, LTM is involved in the decision