»ö« 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:02 kurahaupo_ joined 00:03 ufobat left 00:04 cpage__ joined 00:05 kurahaupo left 00:06 cpage left, cpage__ is now known as cpage
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:08
00:16 Cabanossi left 00:19 Cabanossi joined 00:20 atta left 00:26 mr-foobar left 00:28 mr-foobar joined 00:30 zacts joined 00:38 TreyHarris joined 00:54 Morfent joined, mr-foobar left 00:56 kybr left, kybr joined 00:59 mr-foobar joined, Morfent left 01:04 Morfent joined 01:06 itaylor57 left 01:07 ctilmes left 01:08 Morfent left, Mrofnet joined 01:11 itaylor57 joined 01:16 Cabanossi left 01:18 Cabanossi joined 01:21 entonian joined 01:25 entonian left 01:26 mr-foobar left 01:28 entonian joined, mr-foobar joined 01:29 entonian left, entonian joined 01:35 entonian left 01:45 ohmyfish joined 01:46 ilbot3 left 01:48 ilbot3 joined, ChanServ sets mode: +v ilbot3 01:54 avalokite joined, avalokite left 02:03 noganex_ joined 02:06 noganex left 02:13 ohmyfish left 02:16 Morfent joined 02:17 Mrofnet left 02:19 aborazmeh joined, aborazmeh left, aborazmeh joined 02:25 mr-foobar left 02:28 mr-foobar joined 02:33 aborazmeh left 02:36 pmurias left 02:39 aborazmeh joined, aborazmeh left, aborazmeh joined 02:51 cyphase left 02:54 Mrofnet joined 02:55 kerframil left 02:56 Morfent left, skids joined 02:57 Mrofnet left 02:58 cyphase joined 03:06 cyphase left 03:07 cyphase joined
SmokeMachine Is there anything equivalente to Java’s hashCode for perl6? 03:13
03:16 skids left
araraloren m: say 1.WHICH 03:24
camelia Int|1
araraloren m: say 1.WHICH; my $a; say $a.WHICH; 03:25
camelia Int|1
Any|U16722968
araraloren SmokeMachine, do you mean this ?
03:26 mr-foobar left
SmokeMachine araraloren: a method that returns a Int depending of the content of the object 03:26
I mean a hash function... 03:27
araraloren I think hash has many kinds of implementation 03:28
03:28 mr-foobar joined
SmokeMachine Yes, but default classes haven’t default hash functions? 03:28
araraloren What does that hash function for ? 03:29
I don't know well Java 03:30
Or SmokeMachine , what are you trying to do 03:31
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:33
03:34 pilne joined
araraloren It's like a group factory ? 03:35
SmokeMachine Sorry, I dodnt get what means “group factory”...
araraloren Oh 03:36
You want get a group of a particular user? 03:37
SmokeMachine The hashCode, for the same object will always return the same Int...
araraloren Identify by that `userIdentifier.hashCode` 03:38
SmokeMachine Yes
araraloren you wan store them in Hash
SmokeMachine The true conde used a test Id as a salt:
araraloren my %hash = userIdentifier => $group; and somewhere my $testGroup = %hash{userIdentifier}; 03:39
s/wan/can/
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>;
camelia Group A
Group A
araraloren m: class AG {}; class BG {}; my %hash = 'A' => AG.new, B => B.new; dd %hash{'A'}; dd %hash<B>; 03:41
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
B used at line 1
araraloren m: class AG {}; class BG {}; my %hash = 'A' => AG.new, B => BG.new; dd %hash{'A'}; dd %hash<B>;
camelia AG %hash = AG.new
BG %hash = BG.new
03:41 aborazmeh left
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...
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...
I just want a hash function... 03:45
araraloren Oh, But I recommend you do that in Perl 6 way
03:46 Cabanossi left
araraloren A hash function is no need 03:46
SmokeMachine This is what I want: en.m.wikipedia.org/wiki/Java_hashCode()
Yes, I need...
03:47 cyphase left, entonian joined, Cabanossi joined
araraloren If you want a hash function, I think you have to write it yourself SmokeMachine 03:48
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
camelia Set|F5FB15BD0FAD0FEA9366E0DF58948C292A378E77
timotimo :P
well, it's not an integer
araraloren As I say, Hash has a lot of implementation 03:50
03:52 cyphase joined
SmokeMachine m: say 42.WHERE 03:52
camelia 140366095598312
araraloren This is a memory address, I think 03:53
SmokeMachine But it changes... :(
I know...
ugexe m: use nqp; say nqp::sha1("xxx")
camelia B60D121B438A380C343D5EC3C2037564B82FFEF3
SmokeMachine Getting better! 03:54
m: use nqp; say :16(nqp::sha1("xxx")) 03:55
camelia 1039327807276066319526960639699341474749786095347
SmokeMachine :)
03:55 AlexDaniel joined
SmokeMachine Any way to not use nqp? 03:55
03:56 mr-foobar left
timotimo there's modules that give you hash functions 03:56
SmokeMachine m: use nqp; say :16(nqp::sha1(class :: {}.new.WHICH)) 03:57
camelia 1148741742642494095844578821678109723607158773451
SmokeMachine m: use nqp; say :16(nqp::sha1(class :: {}.new.perl)) 03:58
camelia 36243988929059578703623939259804296396100285399
03:59 mr-foobar joined
SmokeMachine WHICH in some classes uses the memory position, right?! 03:59
timotimo for mutable things it'll do something like that
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);
camelia ( no output )
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;
camelia 1500177622.01373
531476C94944C40F030060AEB60539343668769B
gen/moar/CORE.setting
5E1B038AD8D0FE925C90549EA867F661F6FAAB44
<tmp>
/home/camelia
FAAAAEgAAAACAAAAWAAAAAAAAABYAAAAWAAAAAYAAACIAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAQAAA…
timotimo ugh, that's terrible :D :D 04:01
ugexe you used to be able to do a type of base64 encoding of objects like that 04:02
i wasnt expecting that output
araraloren SmokeMachine, can you show us some code kotlin 04:05
your code
04:05 entonian_ joined, faraco joined 04:06 entonian left
SmokeMachine The important part was that I wrote... the real code is on my work’s computer... 04:06
araraloren And the Perl 6 code ? 04:07
Or
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 FAAAAEgAAAACAAAAWAAAAAAAAABYAAAAWAAAAAEAAABgAAAAcAAAAAAAAABwAAAAAAAAAHAAAABwAAAAAAAAAHAAAAAAAAAAAQAAAAIAAAADAAAABAAAAH4BEIAAAAAAAjAMACACMCAAIAEAAAAAAA==
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:10 entonian_ left 04:16 entonian_ joined 04:20 skids joined 04:21 gdonald left
araraloren faraco, hi 04:22
Geth doc: 351f9007ce | (Zoffix Znet)++ | doc/Language/unicode_entry.pod6
Make xtest pass
04:23
araraloren :( 04:26
04:27 mr-foobar left 04:30 mr-foobar joined 04:33 gdonald joined 04:47 entonian_ left, entonian_ joined 04:48 Ben_Goldberg joined, BenGoldberg left, Ben_Goldberg is now known as BenGoldberg 04:57 mr-foobar left 05:01 pilne left 05:03 khw left 05:04 xerx joined, mr-foobar joined 05:15 Ben_Goldberg joined, BenGoldberg left, Ben_Goldberg is now known as BenGoldberg 05:27 mr-foobar left 05:30 mr-foobar joined 05:38 AlexDaniel left, AlexDaniel joined 05:57 mr-foobar left 05:58 mr-foobar joined 06:00 Cabanossi left 06:02 Cabanossi joined 06:08 entonian_ left 06:12 faraco left 06:19 setty1 joined 06:22 BenGoldberg left 06:23 wamba joined 06:26 skids left 06:27 mr-foobar left 06:30 skids joined 06:31 AlexDaniel left, mr-foobar joined 06:32 Cabanossi left 06:33 Cabanossi joined 06:38 domidumont joined 06:42 parv joined 06:43 skids left 06:45 domidumont left 06:46 domidumont joined 06:52 lizmat left 06:56 ufobat joined 06:57 mr-foobar left 07:00 bioexpress joined
bioexpress hello, is `qx` a short notation of `q:x`? 07:01
07:01 mr-foobar joined
timotimo yup 07:01
bioexpress Thx! 07:02
timotimo qqx also exists
bioexpress to interpolate variables
timotimo yup
07:05 bioexpress left 07:19 andrzejku joined 07:26 mr-foobar left 07:27 mr-foobar joined 07:31 Cabanossi left 07:32 Cabanossi joined 07:45 lizmat joined 07:51 Manifest0 left 07:53 darutoko joined 07:56 Manifest0 joined 08:04 rindolf joined 08:13 araraloren_ joined 08:14 _28_ria left 08:16 _28_ria joined, araraloren left 08:18 ufobat left 08:28 parv left 08:32 Ven joined, Ven is now known as Guest47238 08:34 domidumont left 08:49 _28_ria left 08:50 Guest47238 left 08:54 eliasr joined 08:58 Ven_ joined 09:09 setty1 left 09:22 konsolebox left 09:23 lizmat left, faraco joined 09:28 konsolebox joined, Sgeo_ joined 09:30 Morfent joined, Sgeo left 09:35 kurahaupo_ left 09:42 Ven_ left 09:44 itaylor57 left 09:45 lizmat joined 09:56 Ven joined, Ven is now known as Guest11421 10:01 Guest11421 left 10:11 |oLa| left 10:16 kaare_ left, Cabanossi left, Ven_ joined, kaare_ joined 10:17 Cabanossi joined 10:26 Ven_ left 10:36 |oLa| joined 10:38 lizmat left 10:39 Ven_ joined 10:40 Ven_ left 10:43 kurahaupo joined 10:46 lizmat joined
Voldenet I've got a mild problem with postfix operators 10:51
m: sub postfix:<pa> { "pa_$^a" }; sub postfix:<a> { "a_$^a" }; sub postfix:<p> { "p_$^a" }; say "a"pa
camelia pa_a
Voldenet however
m: sub postfix:<pa> { "pa_$^a" }; sub postfix:<a> { "a_$^a" }; sub postfix:<p> { "p_$^a" }; say "a"p a
camelia 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
Voldenet m: sub postfix:<pa> { "pa_$^a" }; sub postfix:<a> { "a_$^a" }; sub postfix:<p> { "p_$^a" }; say ("a"p)a
camelia a_p_a 10:52
Voldenet can I somehow force usage of specific operator in this context without parentheses?
hahainternet Voldenet: i seem to remember you can specify tightness/looseness, although i'm not certain 10:55
Voldenet: have you tried docs.perl6.org/language/functions....Precedence ? 10:56
timotimo you'll need a backslash there
Voldenet timotimo++, that what I was looking for
timotimo m: sub postfix:<pa> { "pa_$^a" }; sub postfix:<a> { "a_$^a" }; sub postfix:<p> { "p_$^a" }; "a"p\a
camelia ( no output )
timotimo m: sub postfix:<pa> { "pa_$^a" }; sub postfix:<a> { "a_$^a" }; sub postfix:<p> { "p_$^a" }; say "a"p\a
camelia a_p_a
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
10:57 TEttinger left, pmurias joined
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
(I'm using postfix:<+>)
timotimo you could use postfix:<×> instead! 10:59
hahainternet ah, and you want to keep ++ with normal preference, but occasionally explicitly support the +
timotimo because there's no postfix:<××>
hahainternet yeah and × is not X
timotimo right, operators can be pulled into scopes lexically
in fact, you can only import operators lexically
11:00 andrzejku left
timotimo well, except if you bind CALLER::('&infix:<+>') to my &infix:<+> in your sub or whatever 11:00
11:03 nadim joined 11:27 faraco left 11:42 Morfent left 11:58 itaylor57 joined 12:08 Morfent joined 12:11 pilne joined, cognominal left 12:32 Actualeyes joined 12:33 domidumont joined 12:56 lucasb joined 13:00 cyphase left 13:04 andrzejku joined 13:05 cyphase joined 13:28 gdonald left 13:32 BenGoldberg joined 13:40 gdonald joined 13:41 kaare_ left 13:50 zakharyas joined 14:00 kurahaupo left 14:01 Cabanossi left 14:02 Cabanossi joined 14:10 kurahaupo joined 14:11 kurahaupo left 14:15 Morfent left 14:18 wamba left
sjn o/ 14:18
pmurias \o 14:29
lucasb o/ 14:36
Voldenet \o 14:37
sjn found something weird again 14:39
it seems one can't access a .IO object on IntStr's 14:40
an*
(could be I'm not interpreting things correctly though) 14:41
lucasb m: say <100>.IO.perl 14:42
camelia IO::Path.new(IntStr.new(100, "100"), :SPEC(IO::Spec::Unix), :CWD("/home/camelia"))
sjn let's see if I can reproduce what I'm doing 14:43
pmurias sjn: are you still interested in sharing that TPC::EU room? 14:45
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
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 Must specify something as a path: did you mean '.' for the current directory?
in block <unit> at <tmp> line 1
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
(with a filename "0" in the current dir)
sjn is unsure of how to reduce this to a minimal test for the bot here
here's my code (please touch a file named "0" in current dir before running): 14:53
perl6 -e 'subset Existing of Str where { .IO ~~ :f }; sub MAIN (Existing :$i) { ... }; ' -i=0
Voldenet m: say <0>.IO.perl
camelia Must specify something as a path: did you mean '.' for the current directory?
in block <unit> at <tmp> line 1
14:54 kaare_ joined
sjn yeah, that's a bug, isn't it? 14:55
m: say <1>.IO.perl
camelia IO::Path.new(IntStr.new(1, "1"), :SPEC(IO::Spec::Unix), :CWD("/home/camelia"))
Voldenet m: say <0 1>.map: { .IO.e } 14:58
camelia Must specify something as a path: did you mean '.' for the current directory?
in block <unit> at <tmp> line 1
Voldenet m: say <0 1>.map: { CATCH { .resume }; .IO.e }
camelia (False False)
Voldenet m: say <0 1>.map({ CATCH { .resume }; .IO }).map({ .e }) 14:59
camelia (False False)
sjn that one gives the correct (True False) output here. (I have a file name "0") 15:00
pmurias sjn: np 15:01
sjn pmurias: add yourself to the wiki, and mention that you have a room to share? 15:02
sjn has seen that work before
...assuming pmurias is still looking for a room mate 15:03
timotimo m: say so <0> 15:04
camelia False
timotimo m: say so "0"
camelia True
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
i suggest we do a full audit of places that do that that could get tripped up by IntStr and similar
in fact, that's kind of a mean gotcha 15:08
or trap or what you want to call it
pmurias sjn: I'll try that 15:22
sjn timotimo: yeah, I was a bit surprised too 15:26
15:27 skids joined 15:34 Sgeo_ left 15:36 setty1 joined 15:46 nadim left 15:58 nightfrog left, khw joined 16:00 nightfrog joined 16:07 zakharyas left, nadim joined 16:09 wamba joined 16:18 stmuk joined 16:20 stmuk_ left
Geth doc: 188d98e6aa | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/traps.pod6
Add numericaly-zero allomorph's Bool to traps
16:22
timotimo that commit looks good 16:24
ugexe weird, i could have swore i fixed that bug like 2 years ago 16:26
timotimo oh? maybe lost during the IO rewrite? 16:27
16:28 domidumont left
ugexe i remember because CURI used to save distribution's meta data as filenames 0, 1, 2, etc 16:28
16:29 araraloren_ left 16:30 Cabanossi left 16:32 Cabanossi joined 16:43 zakharyas joined 16:51 AlexDaniel joined, lucasb left 17:00 Ibalon joined, Ibalon left
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 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
ugexe reason being that sometimes you want to do like `run "command", $path.relative, :cwd($path.CWD)` 17:02
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:06 mingdao left 17:08 mingdao joined 17:10 zakharyas left, deep-book-gk_ joined 17:12 deep-book-gk_ left 17:51 Sgeo joined 18:06 domidumont joined 18:30 Cabanossi left 18:32 Cabanossi joined 18:37 jameslenz joined 19:08 zacts is now known as reasoningircbot, reasoningircbot is now known as zacts 19:13 zacts left 19:16 ufobat joined 19:25 setty1 left 19:27 setty1 joined 19:33 domidumont left 19:35 Morfent joined 19:36 setty1 left 19:37 darutoko left 19:39 setty1 joined 19:56 TEttinger joined, lizmat left 19:59 mr-fooba_ joined, mr-foobar left 20:01 Cabanossi left 20:02 Mrofnet joined, Cabanossi joined 20:04 pecastro joined 20:05 Celelibi joined 20:07 Morfent left, Mrofnet is now known as Morfent 20:15 lizmat joined 20:41 seatek joined 21:04 |oLa| left 21:09 andrzejku left 21:15 Cabanossi left 21:17 Cabanossi joined
nadim it there another way to push a list in a list than: @l.push: ( (1, 2,3), ) ; 21:18
samcv hi i cannot update zef 21:30
using latest rakudo
Cannot import symbol &zrun from Zef::Shell, because it already exists in this lexical scope
at /home/perl/new/site#sources/EEE22B32677EE6A3F8728D1902A4B45D3A74A68A (Zef::Service::Shell::unzip):2
------> use Zef::Shell⏏;
timotimo i thought push always pushes exactly one thing, so if you pass a list, you'll get a list pushed? 21:31
ah yes, you do have to make it actually a list though, so parens inside the parens
but only one set should be necessary
21:37 shlomif joined 21:38 rindolf left 21:45 shlomif is now known as rindolf 21:55 Morfent left 21:59 ptolemarch left 22:00 ptolemarch joined 22:07 cognominal joined 22:18 robertle left 22:20 peteretep joined 22:23 zostay joined 22:33 ufobat left, rindolf left, pmurias left 22:34 rindolf joined 22:35 BenGoldberg left 22:51 rindolf left 22:52 rindolf joined 22:53 Morfent joined 23:02 espadrine left 23:14 wamba left 23:15 Cabanossi left 23:18 Cabanossi joined 23:41 nightfrog is now known as culb 23:50 p6nomad joined