Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-07-16

Perl 6 | Reference Documentation | Rakudo

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

All times shown according to UTC.

Time Nick Message
00:02 kurahaupo_ joined #perl6
00:04 cpage__ joined #perl6
00:08 zengargoyle hrm.  Supply.tap acts on each line as it arrives.  Channel waits until the file is read in full.  not sure i grok yet. :|
00:19 Cabanossi joined #perl6
00:28 mr-foobar joined #perl6
00:30 zacts joined #perl6
00:38 TreyHarris joined #perl6
00:54 Morfent joined #perl6
00:56 kybr joined #perl6
00:59 mr-foobar joined #perl6
01:04 Morfent joined #perl6
01:08 Mrofnet joined #perl6
01:11 itaylor57 joined #perl6
01:18 Cabanossi joined #perl6
01:21 entonian joined #perl6
01:28 entonian joined #perl6
01:28 mr-foobar joined #perl6
01:29 entonian left #perl6
01:29 entonian joined #perl6
01:47 ohmyfish joined #perl6
01:48 ilbot3 joined #perl6
01:48 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
01:54 avalokite joined #perl6
02:03 noganex_ joined #perl6
02:16 Morfent joined #perl6
02:19 aborazmeh joined #perl6
02:19 aborazmeh joined #perl6
02:28 mr-foobar joined #perl6
02:39 aborazmeh joined #perl6
02:39 aborazmeh joined #perl6
02:54 Mrofnet joined #perl6
02:56 skids joined #perl6
02:58 cyphase joined #perl6
03:07 cyphase joined #perl6
03:13 SmokeMachine Is there anything equivalente to Java’s hashCode for perl6?
03:24 araraloren m: say 1.WHICH
03:24 camelia rakudo-moar d37be2: OUTPUT: «Int|1␤»
03:25 araraloren m: say 1.WHICH; my $a; say $a.WHICH;
03:25 camelia rakudo-moar d37be2: OUTPUT: «Int|1␤Any|U16722968␤»
03:25 araraloren SmokeMachine, do you mean this ?
03:26 SmokeMachine araraloren: a method that returns a Int depending of the content of the object
03:27 SmokeMachine I mean a hash function...
03:28 araraloren I think hash has many kinds of implementation
03:28 mr-foobar joined #perl6
03:28 SmokeMachine Yes, but default classes haven’t default hash functions?
03:29 araraloren What does that hash function for ?
03:30 araraloren I don't know well Java
03:31 araraloren Or SmokeMachine , what are you trying to do
03:33 SmokeMachine I wrote a a A/B test classifier in kotlin that I’m translating to perl6... part that uses the hashCode is something like this: val testGroup = groups[userIdentifier.hashCode % groups.size] // simplified version
03:34 pilne joined #perl6
03:35 araraloren It's like a group factory ?
03:35 SmokeMachine Sorry, I dodnt get what means “group factory”...
03:36 araraloren Oh
03:37 araraloren You want get a group of a particular user?
03:37 SmokeMachine The hashCode, for the same object will always return the same Int...
03:38 araraloren Identify by that `userIdentifier.hashCode`
03:38 SmokeMachine Yes
03:38 araraloren you wan store them in Hash
03:38 SmokeMachine The true conde used a test Id as a salt:
03:39 araraloren my %hash = userIdentifier => $group;  and somewhere my $testGroup = %hash{userIdentifier};
03:39 araraloren s/wan/can/
03:40 SmokeMachine val testGroup = groups[“$userIdentifier $testIdentifier”.hashCode % groups.size]
03:40 araraloren m: my %hash = 'A' => "Group A", B => "Group B"; say %hash{'A'}; say %hash<A>;
03:40 camelia rakudo-moar d37be2: OUTPUT: «Group A␤Group A␤»
03:41 araraloren m: class AG {}; class BG {}; my %hash = 'A' => AG.new, B => B.new; dd %hash{'A'}; dd %hash<B>;
03:41 camelia rakudo-moar d37be2: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Undeclared name:␤    B used at line 1␤␤»
03:41 araraloren m: class AG {}; class BG {}; my %hash = 'A' => AG.new, B => BG.new; dd %hash{'A'}; dd %hash<B>;
03:41 camelia rakudo-moar d37be2: OUTPUT: «AG %hash = AG.new␤BG %hash = BG.new␤»
03:43 araraloren SmokeMachine, Is ^ help?
03:43 SmokeMachine No, that’s not what I want... I need to answer to the user what group it is participating on a specified a/b test and always give the same answer...
03:44 araraloren yeah, that Hash always given you same value when you given them same key
03:44 SmokeMachine I don’t what to record any data...
03:45 SmokeMachine I just want a hash function...
03:45 araraloren Oh, But I recommend you do that in Perl 6 way
03:46 araraloren A hash function is no need
03:46 SmokeMachine This is what I want: https://en.m.wikipedia.org/wiki/Java_hashCode()
03:46 SmokeMachine Yes, I need...
03:47 entonian joined #perl6
03:47 Cabanossi joined #perl6
03:48 araraloren If you want a hash function, I think you have to write it yourself SmokeMachine
03:49 SmokeMachine We probably have a hash function for Str... it must be used on the Hash class...
03:49 timotimo m: set(1, 2, "foo", "bar").WHICH.say
03:49 camelia rakudo-moar d37be2: OUTPUT: «Set|F5FB15BD0FAD0FEA9366E0DF58948C292A378E77␤»
03:49 timotimo :P
03:49 timotimo well, it's not an integer
03:50 araraloren As I say, Hash has a lot of implementation
03:52 cyphase joined #perl6
03:52 SmokeMachine m: say 42.WHERE
03:52 camelia rakudo-moar d37be2: OUTPUT: «140366095598312␤»
03:53 araraloren This is a memory address, I think
03:53 SmokeMachine But it changes... :(
03:53 SmokeMachine I know...
03:53 ugexe m: use nqp; say nqp::sha1("xxx")
03:53 camelia rakudo-moar d37be2: OUTPUT: «B60D121B438A380C343D5EC3C2037564B82FFEF3␤»
03:54 SmokeMachine Getting better!
03:55 SmokeMachine m: use nqp; say :16(nqp::sha1("xxx"))
03:55 camelia rakudo-moar d37be2: OUTPUT: «1039327807276066319526960639699341474749786095347␤»
03:55 SmokeMachine :)
03:55 AlexDaniel joined #perl6
03:55 SmokeMachine Any way to not use nqp?
03:56 timotimo there's modules that give you hash functions
03:57 SmokeMachine m: use nqp; say :16(nqp::sha1(class :: {}.new.WHICH))
03:57 camelia rakudo-moar d37be2: OUTPUT: «1148741742642494095844578821678109723607158773451␤»
03:58 SmokeMachine m: use nqp; say :16(nqp::sha1(class :: {}.new.perl))
03:58 camelia rakudo-moar d37be2: OUTPUT: «36243988929059578703623939259804296396100285399␤»
03:59 mr-foobar joined #perl6
03:59 SmokeMachine WHICH in some classes uses the memory position, right?!
03:59 timotimo for mutable things it'll do something like that
04:00 timotimo i'm not sure if which uses objectid under the hood, i.e. whether the which changes when the gc moves the object
04:00 ugexe m: use nqp; sub ser($obj is copy) { my Mu $sh := nqp::list_s(); my $n = nqp::time_n(); my Mu $sc := nqp::createsc(nqp::unbox_s("$n")); nqp::setobjsc($obj,$sc); nqp::scsetobj($sc, 0, $obj); my $s = nqp::serialize($sc, $sh); my Mu $i := nqp::iterator($sh); while ($i) {my $s := nqp::shift($i)}; nqp::scdisclaim($sc); nqp::shift_s($sh); $n ~"\n"~nqp::p6box_s(nqp::join("\n", $sh))~"\n"~$s }; ser("foo".IO);
04:00 camelia rakudo-moar d37be2: ( no output )
04:00 ugexe m: use nqp; sub ser($obj is copy) { my Mu $sh := nqp::list_s(); my $n = nqp::time_n(); my Mu $sc := nqp::createsc(nqp::unbox_s("$n")); nqp::setobjsc($obj,$sc); nqp::scsetobj($sc, 0, $obj); my $s = nqp::serialize($sc, $sh); my Mu $i := nqp::iterator($sh); while ($i) {my $s := nqp::shift($i)}; nqp::scdisclaim($sc); nqp::shift_s($sh); $n ~"\n"~nqp::p6box_s(nqp::join("\n", $sh))~"\n"~$s }; ser("foo".IO).say;
04:00 camelia rakudo-moar d37be2: OUTPUT: «1500177622.01373␤531476C94944C40F030060AEB60539343668769B␤gen/moar/CORE.setting␤5E1B038AD8D0FE925C90549EA867F661F6FAAB44␤<tmp>␤/home/camelia␤FAAAAEgAAAACAAAAWAAAAAAAAABYAAAAWAAAAAYAAACIAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAQAAA…»
04:01 timotimo ugh, that's terrible :D :D
04:02 ugexe you used to be able to do a type of base64 encoding of objects like that
04:02 ugexe i wasnt expecting that output
04:05 araraloren SmokeMachine, can you show us some code kotlin
04:05 araraloren your code
04:05 entonian_ joined #perl6
04:05 faraco joined #perl6
04:06 SmokeMachine The important part was that I wrote... the real code is on my work’s computer...
04:07 araraloren And the Perl 6 code ?
04:07 araraloren Or
04:08 ugexe m: use nqp; sub ser($obj is copy) { my Mu $sh := nqp::list_s(); my $n = nqp::time_n(); my Mu $sc := nqp::createsc(nqp::unbox_s("$n")); nqp::setobjsc($obj,$sc); nqp::scsetobj($sc, 0, $obj); my $s = nqp::serialize($sc, $sh); my Mu $i := nqp::iterator($sh); while ($i) {my $s := nqp::shift($i)}; nqp::scdisclaim($sc); nqp::shift_s($sh); $s }; ser("foo").say;
04:08 camelia rakudo-moar d37be2: OUTPUT: «FAAAAEgAAAACAAAAWAAAAAAAAABYAAAAWAAAAAEAAABgAAAAcAAAAAAAAABwAAAAAAAAAHAAAABwAAAAAAAAAHAAAAAAAAAAAQAAAAIAAAADAAAABAAAAH4BEIAAAAAAAjAMACACMCAAIAEAAAAAAA==␤»
04:09 faraco hello
04:09 SmokeMachine But I get the user identifier, concat with the test salt and get the hashCode for that... with this Int, I see if that user should be participating of that test, and if it should, what should be it’s group...
04:16 entonian_ joined #perl6
04:20 skids joined #perl6
04:22 araraloren faraco, hi
04:23 Geth ¦ doc: 351f9007ce | (Zoffix Znet)++ | doc/Language/unicode_entry.pod6
04:23 Geth ¦ doc: Make xtest pass
04:23 Geth ¦ doc: review: https://github.com/perl6/doc/commit/351f9007ce
04:26 araraloren :(
04:30 mr-foobar joined #perl6
04:33 gdonald joined #perl6
04:47 entonian_ joined #perl6
04:48 Ben_Goldberg joined #perl6
05:04 xerx joined #perl6
05:04 mr-foobar joined #perl6
05:15 Ben_Goldberg joined #perl6
05:30 mr-foobar joined #perl6
05:38 AlexDaniel joined #perl6
05:58 mr-foobar joined #perl6
06:02 Cabanossi joined #perl6
06:19 setty1 joined #perl6
06:23 wamba joined #perl6
06:30 skids joined #perl6
06:31 mr-foobar joined #perl6
06:33 Cabanossi joined #perl6
06:38 domidumont joined #perl6
06:42 parv joined #perl6
06:46 domidumont joined #perl6
06:56 ufobat joined #perl6
07:00 bioexpress joined #perl6
07:01 bioexpress hello, is `qx` a short notation of `q:x`?
07:01 mr-foobar joined #perl6
07:01 timotimo yup
07:02 bioexpress Thx!
07:02 timotimo qqx also exists
07:02 bioexpress to interpolate variables
07:02 timotimo yup
07:19 andrzejku joined #perl6
07:27 mr-foobar joined #perl6
07:32 Cabanossi joined #perl6
07:45 lizmat joined #perl6
07:53 darutoko joined #perl6
07:56 Manifest0 joined #perl6
08:04 rindolf joined #perl6
08:13 araraloren_ joined #perl6
08:16 _28_ria joined #perl6
08:32 Ven joined #perl6
08:54 eliasr joined #perl6
08:58 Ven_ joined #perl6
09:23 faraco joined #perl6
09:28 konsolebox joined #perl6
09:28 Sgeo_ joined #perl6
09:30 Morfent joined #perl6
09:45 lizmat joined #perl6
09:56 Ven joined #perl6
10:16 Ven_ joined #perl6
10:16 kaare_ joined #perl6
10:17 Cabanossi joined #perl6
10:36 |oLa| joined #perl6
10:39 Ven_ joined #perl6
10:42 kurahaupo joined #perl6
10:46 lizmat joined #perl6
10:51 Voldenet I've got a mild problem with postfix operators
10:51 Voldenet m: sub postfix:<pa> { "pa_$^a" }; sub postfix:<a> { "a_$^a" }; sub postfix:<p> { "p_$^a" }; say "a"pa
10:51 camelia rakudo-moar d37be2: OUTPUT: «pa_a␤»
10:51 Voldenet however
10:51 Voldenet m: sub postfix:<pa> { "pa_$^a" }; sub postfix:<a> { "a_$^a" }; sub postfix:<p> { "p_$^a" }; say "a"p a
10:51 camelia rakudo-moar d37be2: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3}; sub postfix:<p> { "p_$^a" }; say "a"p7⏏5 a␤    expecting any of:␤        infix␤        infix stopper␤        postfix␤        statement end␤  …»
10:51 Voldenet m: sub postfix:<pa> { "pa_$^a" }; sub postfix:<a> { "a_$^a" }; sub postfix:<p> { "p_$^a" }; say ("a"p)a
10:52 camelia rakudo-moar d37be2: OUTPUT: «a_p_a␤»
10:52 Voldenet can I somehow force usage of specific operator in this context without parentheses?
10:55 hahainternet Voldenet: i seem to remember you can specify tightness/looseness, although i'm not certain
10:56 hahainternet Voldenet: have you tried https://docs.perl6.org/language/functions.html#Precedence ?
10:56 timotimo you'll need a backslash there
10:56 Voldenet timotimo++, that what I was looking for
10:56 timotimo m: sub postfix:<pa> { "pa_$^a" }; sub postfix:<a> { "a_$^a" }; sub postfix:<p> { "p_$^a" }; "a"p\a
10:56 camelia rakudo-moar d37be2: ( no output )
10:56 timotimo m: sub postfix:<pa> { "pa_$^a" }; sub postfix:<a> { "a_$^a" }; sub postfix:<p> { "p_$^a" }; say "a"p\a
10:56 camelia rakudo-moar d37be2: OUTPUT: «a_p_a␤»
10:57 Voldenet hahainternet: it wouldn't be bad, but I wouldn't want to destroy ++ in the process, because it's quite crucial operator to have working :P
10:57 pmurias joined #perl6
10:58 hahainternet Voldenet: i guess i don't quite see what you're going for :)
10:58 Voldenet Oh right, I should be more specific in my examples
10:58 Voldenet (I'm using postfix:<+>)
10:59 timotimo you could use postfix:<×> instead!
10:59 hahainternet ah, and you want to keep ++ with normal preference, but occasionally explicitly support the +
10:59 timotimo because there's no postfix:<××>
10:59 hahainternet yeah and × is not X
10:59 timotimo right, operators can be pulled into scopes lexically
10:59 timotimo in fact, you can only import operators lexically
11:00 timotimo well, except if you bind CALLER::('&infix:<+>') to my &infix:<+> in your sub or whatever
11:03 nadim joined #perl6
11:58 itaylor57 joined #perl6
12:08 Morfent joined #perl6
12:11 pilne joined #perl6
12:32 Actualeyes joined #perl6
12:33 domidumont joined #perl6
12:56 lucasb joined #perl6
13:04 andrzejku joined #perl6
13:05 cyphase joined #perl6
13:32 BenGoldberg joined #perl6
13:40 gdonald joined #perl6
13:50 zakharyas joined #perl6
14:00 kurahaupo left #perl6
14:02 Cabanossi joined #perl6
14:10 kurahaupo joined #perl6
14:11 kurahaupo left #perl6
14:18 sjn o/
14:29 pmurias \o
14:36 lucasb o/
14:37 Voldenet \o
14:39 * sjn found something weird again
14:40 sjn it seems one can't access a .IO object on IntStr's
14:40 sjn an*
14:41 sjn (could be I'm not interpreting things correctly though)
14:42 lucasb m: say <100>.IO.perl
14:42 camelia rakudo-moar b22d18: OUTPUT: «IO::Path.new(IntStr.new(100, "100"), :SPEC(IO::Spec::Unix), :CWD("/home/camelia"))␤»
14:43 sjn let's see if I can reproduce what I'm doing
14:45 pmurias sjn: are you still interested in sharing that TPC::EU room?
14:46 sjn pmurias: ah, sorry, I ended up in a sofa at one of the organizer's home
14:46 timotimo don't forget that IO-related things go through the restricted setting on camelia
14:47 sjn m: subset Existing of Str where { .IO ~~ :f }; my Existing $f = <0>; # gives the same error if there's a file named "0" in the current dir
14:47 camelia rakudo-moar b22d18: OUTPUT: «Must specify something as a path: did you mean '.' for the current directory?␤  in block <unit> at <tmp> line 1␤␤»
14:50 sjn I got that error when using the same subset type as a parameter to MAIN(Existing $i) ,  and passing along "0" to $i from the command line
14:50 sjn (with a filename "0" in the current dir)
14:50 * sjn is unsure of how to reduce this to a minimal test for the bot here
14:53 sjn here's my code (please touch a file named "0" in current dir before running):
14:53 sjn perl6 -e 'subset Existing of Str where { .IO ~~ :f }; sub MAIN (Existing :$i) { ... }; ' -i=0
14:53 Voldenet m: say <0>.IO.perl
14:53 camelia rakudo-moar c040f1: OUTPUT: «Must specify something as a path: did you mean '.' for the current directory?␤  in block <unit> at <tmp> line 1␤␤»
14:54 kaare_ joined #perl6
14:55 sjn yeah, that's a bug, isn't it?
14:55 sjn m: say <1>.IO.perl
14:55 camelia rakudo-moar c040f1: OUTPUT: «IO::Path.new(IntStr.new(1, "1"), :SPEC(IO::Spec::Unix), :CWD("/home/camelia"))␤»
14:58 Voldenet m: say <0 1>.map: { .IO.e }
14:58 camelia rakudo-moar c040f1: OUTPUT: «Must specify something as a path: did you mean '.' for the current directory?␤  in block <unit> at <tmp> line 1␤␤»
14:58 Voldenet m: say <0 1>.map: { CATCH { .resume }; .IO.e }
14:58 camelia rakudo-moar c040f1: OUTPUT: «(False False)␤»
14:59 Voldenet m: say <0 1>.map({ CATCH { .resume }; .IO }).map({ .e })
14:59 camelia rakudo-moar c040f1: OUTPUT: «(False False)␤»
15:00 sjn that one gives the correct (True False) output here. (I have a file name "0")
15:01 pmurias sjn: np
15:02 sjn pmurias: add yourself to the wiki, and mention that you have a room to share?
15:02 * sjn has seen that work before
15:03 sjn ...assuming pmurias is still looking for a room mate
15:04 timotimo m: say so <0>
15:04 camelia rakudo-moar c040f1: OUTPUT: «False␤»
15:04 timotimo m: say so "0"
15:04 camelia rakudo-moar c040f1: OUTPUT: «True␤»
15:05 timotimo clearly a part of the IO constructor thinks "it's a Str and so Str is only False if the Str is empty"
15:05 timotimo i suggest we do a full audit of places that do that that could get tripped up by IntStr and similar
15:08 timotimo in fact, that's kind of a mean gotcha
15:08 timotimo or trap or what you want to call it
15:22 pmurias sjn: I'll try that
15:26 sjn timotimo: yeah, I was a bit surprised too
15:27 skids joined #perl6
15:36 setty1 joined #perl6
15:58 khw joined #perl6
16:00 nightfrog joined #perl6
16:07 nadim joined #perl6
16:09 wamba joined #perl6
16:18 stmuk joined #perl6
16:22 Geth ¦ doc: 188d98e6aa | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/traps.pod6
16:22 Geth ¦ doc: Add numericaly-zero allomorph's Bool to traps
16:22 Geth ¦ doc: review: https://github.com/perl6/doc/commit/188d98e6aa
16:24 timotimo that commit looks good
16:26 ugexe weird, i could have swore i fixed that bug like 2 years ago
16:27 timotimo oh? maybe lost during the IO rewrite?
16:28 ugexe i remember because CURI used to save distribution's meta data as filenames 0, 1, 2, etc
16:32 Cabanossi joined #perl6
16:43 zakharyas joined #perl6
16:51 AlexDaniel joined #perl6
17:00 Ibalon joined #perl6
17:00 ugexe m: say IO::Path.new(".", :CWD(".")).dir eqv IO::Path.new(".", :CWD("")).dir; # wonder if CWD should be handling blank string, since `run "ls", :cwd("")` does not work the same as `run "ls", :cwd(".")`
17:00 camelia rakudo-moar 45cd1a: OUTPUT: «IO::Path is disallowed in restricted setting␤  in sub restricted at src/RESTRICTED.setting line 1␤  in method new at src/RESTRICTED.setting line 32␤  in block <unit> at <tmp> line 1␤␤»
17:02 ugexe reason being that sometimes you want to do like `run "command", $path.relative, :cwd($path.CWD)`
17:02 ugexe especially since on windows you cant always pass the volume in as part of the absolute path as an argument, but you *can* set the CWD to whatever and use a relative path
17:08 mingdao joined #perl6
17:10 deep-book-gk_ joined #perl6
17:12 deep-book-gk_ left #perl6
17:51 Sgeo joined #perl6
18:06 domidumont joined #perl6
18:32 Cabanossi joined #perl6
18:37 jameslenz joined #perl6
19:16 ufobat joined #perl6
19:27 setty1 joined #perl6
19:35 Morfent joined #perl6
19:39 setty1 joined #perl6
19:56 TEttinger joined #perl6
19:59 mr-fooba_ joined #perl6
20:02 Mrofnet joined #perl6
20:02 Cabanossi joined #perl6
20:04 pecastro joined #perl6
20:05 Celelibi joined #perl6
20:15 lizmat joined #perl6
20:41 seatek joined #perl6
21:17 Cabanossi joined #perl6
21:18 nadim it there another way to push a list in a list than:  @l.push: ( (1, 2,3), ) ;
21:30 samcv hi i cannot update zef
21:30 samcv using latest rakudo
21:30 samcv Cannot import symbol &zrun from Zef::Shell, because it already exists in this lexical scope
21:30 samcv at /home/perl/new/site#sources/EEE22B32677EE6A3F8728D1902A4B45D3A74A68A (Zef::Service::Shell::unzip):2
21:30 samcv ------> use Zef::Shell⏏;
21:31 timotimo i thought push always pushes exactly one thing, so if you pass a list, you'll get a list pushed?
21:31 timotimo ah yes, you do have to make it actually a list though, so parens inside the parens
21:31 timotimo but only one set should be necessary
21:37 shlomif joined #perl6
22:00 ptolemarch joined #perl6
22:07 cognominal joined #perl6
22:20 peteretep joined #perl6
22:23 zostay joined #perl6
22:34 rindolf joined #perl6
22:52 rindolf joined #perl6
22:53 Morfent joined #perl6
23:18 Cabanossi joined #perl6
23:50 p6nomad joined #perl6

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

Perl 6 | Reference Documentation | Rakudo