»ö« 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 Zoffix on 25 May 2018.
00:08 dct left
AlexDaniel joya: maybe! I think I can argue either way 00:10
joya: but binding is a safe and clear way to do it 00:11
also, this gives a nice error message:
m: my %h = :{ (now) => "Instant", (DateTime.now) => "DateTime" };
camelia Potential difficulties:
Useless use of hash composer on right side of hash assignment; did you mean := instead?
at <tmp>:1
------> 3Instant", (DateTime.now) => "DateTime" }7⏏5;
turdmonkey Given a sub my_sub { ... } 00:12
what is the difference between
my_sub and &my_sub 00:13
Juerd turdmonkey: my_sub calls the sub, &my_sub is the subroutine itself.
AlexDaniel joya: also, with = you can probably do something like `my Mu %h{Any} = $foo`, right? 00:14
Juerd turdmonkey: You can use &my_sub to pass the subroutine as an argument to another subroutine without calling(executing) it.
turdmonkey Oh! Excellent
That accidentally answers my next question. 00:15
timotimo or call methods on the sub object
for introspection and such
Juerd turdmonkey: Note, though, that if you use &my_sub() with the paretheses, that *is* a call.
s/pare/paren/
AlexDaniel joya: but, if you stumbled upon this behavior on accident, and didn't intend it 00:19
joya: then maybe it should be documented here: docs.perl6.org/language/traps
00:19 e5r joined
AlexDaniel joya: please file a ticket on github.com/perl6/doc/issues/ if you feel strongly about it :) 00:19
00:20 e5r left, mcmillhj joined 00:21 perlpilot joined
joya AlexDaniel: it doesn't always give a nice error message 00:22
00:25 mcmillhj left
raschipi If the error messages are LTA (less than awesome), that's also a bug you'd file here: github.com/rakudo/rakudo/issues 00:25
joya AlexDaniel: for example, if i do: my %hm = (1..10).classify: * <= 5
raschipi Example of LTA issue: github.com/rakudo/rakudo/issues/1965 00:26
m: my %hm = (1..10).classify: * <= 5
camelia ( no output )
joya the hash has Str keys in it .. I can't think of a compelling reason why it shouldn't receive typed keys
raschipi m: my %hm = (1..10).classify: * <= 5; say %hm
camelia {False => [6 7 8 9 10], True => [1 2 3 4 5]}
joya oh it's not an LTA issue
basically the type gets erased with no warning
now try %hm.keys[0].^name 00:27
they're Str .... 'True' and 'False'
timotimo assigning into a hash variable is different from binding in that sense
joya yes i realize the advantage of binding
timotimo when you %foo = %bar it'll unpack the pairs of %bar and stash them info %foo
unless we want to make it illegal to assign into a more general hash i don't know what to do here
turdmonkey Can you have optional function parameters e.g 'sub my_sub($var, $optional?) { ... }
timotimo yes, you can, exactly the way you've suggested it 00:28
either with a ? at the end, or with a default value after a =
joya is there a way to specify types when you create the hash itself
timotimo yes, of course
turdmonkey well that is awesome
joya ok, that is my problem then -- i do not know that
timotimo m: my %foo{Any} = (1..10).classify: * <= 5; say %foo.keys.perl
camelia (Bool::False, Bool::True).Seq
timotimo m: my %foo = (1..10).classify: * <= 5; say %foo.keys.perl
camelia ("True", "False").Seq
joya but can you do it on the same line as an assignment 00:29
it's not perl unless i can put the entire program on one line
timotimo my first example there should give you that answer
turdmonkey hahahahahaha
joya interesting because the {Any} actually makes it look like it is declared untyped 00:30
raschipi It would be very surprising if the opposite was true, if Hash keys weren't typed as Str. That's what most people expect, "Object Hashes" are not an obvious feature and not easy to use due to the well known object comparisson issue (which exists in all languages).. 00:31
timotimo the { } is intended to stand for "key goes here"
raschipi Hashes have Str as default type for keys.
timotimo but essentially, yes, you're going for an untyped array
er, hash 00:32
joya ok, i get what you mean
timotimo you can of course have my %foo{Bool} in the classify example
joya so would it be correct to say that my %hm; and my %hm{Str}; are equivalent
timotimo m: say (my %foo).keyof.perl
camelia Str(Any)
raschipi Most people don't even know of non-Str Hash keys.
timotimo joya: almost, since the default is actually a coercion type 00:33
m: my %hm{Str} = (True) => 1;
camelia Type check failed in binding to parameter 'key'; expected Str but got Bool (Bool::True)
in block <unit> at <tmp> line 1
timotimo m: my %hm{Str(Any)} = (True) => 1;
camelia Type check failed in binding to parameter 'key'; expected Str(Any) but got Bool (Bool::True)
in block <unit> at <tmp> line 1
timotimo er, oops?
raschipi Is Bool Str(Any)? Rakudo is confused. 00:34
turdmonkey lol @ 'spurt' and 'slurp'
timotimo i think it's not doing it right
m: say (my %hm{Str(Any)}).keyof.perl 00:35
camelia Str(Any)
timotimo hm.
00:36 mcmillhj joined
timotimo anyway, i'll probably go to bed now. seeya! 00:37
joya 'my %hm{Bool(*)} =' works
although doesnt really refine things beyond %hm{Bool} alone 00:38
geekosaur it probably should refuse coercion types there if it can;t handle them 00:39
raschipi m: my %hm{Str(*)} = (True) => 1; dd %hm;
camelia Hash[Any] %hm = (my Any % = :True(1))
raschipi m: my %hm{Str(*)} = (True) => 1; dd %hm.keyof; 00:40
camelia Str(Any)
00:40 mcmillhj left
turdmonkey if($foo) interprets it has a sub yes? 00:40
so i have to do either: if ($foo) or if $foo 00:41
joya i think the object key "strategy" should be made a little more obvious since people will be plugging boolean expressions into classify all the time 00:42
raschipi turdmonkey: yes 00:43
joya: It's the most obvious there is. 00:44
People are usually surprised when they learn it's possible to have Hashes with anything other than Str as keys. 00:45
00:46 statisfiable6 joined
joya related question then: how does my Array %hm{Bool} differ from my %hm{Bool(Array)} 00:48
does the second contain what you referred to as a coercion type 00:49
raschipi m: my Array %hm{Bool}; my %mh{Bool(Array)}; dd %hm, %mh 00:50
camelia Hash[Array,Bool] %hm = (my Array %{Bool})
Hash[Any,Bool(Array)] %mh = (my Any %{Bool(Array)})
raschipi Yes, Bool(Array) will take an array and coerce it to Bool, which is False if the Array is empty and True if it has something in it. 00:51
Array is too restrictive, you'd want Positional, which can be Arrays, Lists and Seqs. 00:52
joya ok i found the coercion types page
raschipi m: my Array $n = <a b c>; say $n
camelia Type check failed in assignment to $n; expected Array but got List ($("a", "b", "c"))
in block <unit> at <tmp> line 1
00:53 mcmillhj joined
raschipi A List isn't an Array. 00:53
m: my Positional $n = <a b c>; say $n
camelia (a b c)
raschipi m: my Positional $n = ['a', 'b', 'c']; say $n, $n.^name
camelia [a b c]Array
turdmonkey Ok, this will be interesting. 00:54
raschipi Oh, Seqs aren't Positional, sorry.
turdmonkey Should I use Channels to open up a new worker each time my program finds a new URL ?
With a limit.
raschipi turdmonkey: Sorry, can't say, you need to explain more. 00:56
00:57 mcmillhj left
joya well, thanks for the help, raschipi and timo, 😅 00:59
01:01 lookatme joined
turdmonkey Well... 01:01
I only know about Perl's Channel object 01:02
in my web crawler, I want to open up a new thread every time it finds a link
so i'm thinking something like 01:03
raschipi joya: Wou're welcome. 01:04
turdmonkey 'my $channel = Chanell.new; $channel.send($) for get-urls($url);
$channel.send($_)
raschipi You probably want a Supply.
docs.perl6.org/type/Supply 01:05
No, sorry, other way around.
Supply is for when you want everyone to get the messages. Channel is when you want only one of the listeners to get it.
turdmonkey oh, cool 01:06
I figure I will have a separate Channel object for each link
on my way to segfault land
like this: 01:07
raschipi Can have only one channel and when you send, only one thread will get it. It's like a queue.
turdmonkey 'my @links; for 1..10 { push @links, start { while (my $link = $channel.poll) { process-urls; } } } 01:08
01:09 zachk left
raschipi Probably want it to block using .receive instead of .poll 01:10
turdmonkey Ah yes...I definately do 01:11
does that code do what I think?
each time it receives a link, it will spawn a thread, up to a max of 10, and process it 01:12
raschipi Probably want to use the for and while concurrent equivalents: docs.perl6.org/language/concurrenc...r-whenever 01:15
I gotta go, back in few minutes. 01:17
01:24 mcmillhj joined 01:27 subroot left 01:29 mcmillhj left 01:43 mcmillhj joined
raschipi I'M BACK! 01:45
01:46 MasterDuke joined
raschipi turdmonkey: any progress? 01:46
turdmonkey Yes. I am reading up on and experimenting more with Perl's parallel and concurrent features before I try it in my own code 01:47
01:47 mcmillhj left
raschipi Did yu get what was wrong with your code earlier? 01:47
turdmonkey poll? 01:48
raschipi Let's go over it to see what would happen...
turdmonkey ok 01:49
raschipi did you get it to work? 01:50
turdmonkey No, I didn't run it.
01:53 Tideflat joined
raschipi The return types were wrong too. I changed my mind and I don't think it's woth it going over, you were trying to use fundamentals to do it but you should start at a higher level. 01:54
turdmonkey Yes. 01:56
I realized I didn't really understand what I Was doing so now I am reading the docs and really trying to better understand how Perl does it
raschipi It's like a new paradigm. 01:57
02:01 kurahaupo_ joined 02:03 joya left 02:14 mcmillhj joined 02:18 mcmillhj left 02:33 mcmillhj joined 02:38 mcmillhj left 02:58 mcmillhj joined 03:03 mcmillhj left 03:09 titsuki_ joined 03:13 BenGoldberg left 03:19 raschipi left 03:32 mcmillhj joined 03:37 mcmillhj left 03:51 mcmillhj joined 03:55 mcmillhj left 04:01 Tison joined
Tison \o 04:01
lookatme o/ 04:12
04:21 mcmillhj joined 04:26 mcmillhj left 04:36 kurahaupo joined 04:38 turdmonkey joined 04:39 kurahaupo_ left
turdmonkey p6 say "lorfma" 04:41
;o 04:42
p6: say "lorfma";
camelia lorfma
turdmonkey i win
04:42 sno left 04:48 turdmonkey left 04:49 turdmonkey joined 04:53 mcmillhj joined 04:54 skids left 04:58 curan joined, mcmillhj left
turdmonkey This sub runs concurrently, yes? 05:00
sub print-urls($seed, $file?) {
21 await do for get-urls($seed) -> $e {
22 start {
23 say $e<href>; 05:01
24 if $file {
25 my $fh = open "$file", :a;
26 $fh.say("$e<href>", ':', $e.text);
27 $fh.close;
28 }
29 }
30 }
31 }Y
er
it's "multi-threaded"
05:02 jmerelo joined
turdmonkey hi jmerelo 05:02
05:05 mcmillhj joined
jmerelo turdmonkey: hi! 05:06
yoleaux 25 Jun 2018 19:14Z <El_Che> jmerelo: if spain keep playing like that I will be force to cheer the other team :)
turdmonkey are you familiar with concurrent programming with perl?
jmerelo .tell El_Che you're very welcome to do that. Terrible playing...
yoleaux jmerelo: I'll pass your message to El_Che.
jmerelo turdmonkey: I've used it a bit, yes. 05:09
turdmonkey Would you tell me if my sub runs concurrently or not?
jmerelo turdmonkey: if you use start, they should... 05:10
05:10 mcmillhj left
turdmonkey yes 05:10
sub print-urls($seed, $file?) {
21 await do for get-urls($seed) -> $e {
22 start {
23 say $e<href>;
24 if $file {
25 my $fh = open "$file", :a;
26 $fh.say("$e<href>", ':', $e.text);
27 $fh.close;
28 }
29 }
30 }
31 }
jmerelo turdmonkey: it's better if you link github or a gist. And this uses start, so it should run concurrently. Problem might be access to $file, which might be locked and can't be accessed concurrently 05:11
05:11 ufobat_ joined
jmerelo turdmonkey: why do you need to access concurrently a single file? 05:12
turdmonkey Well, I'm about to modify the function so it crawls the links it gets
so it will get a link, and spawn a thread, and follow that link onto its page, and get the links on there, etc. 05:13
jmerelo turdmonkey: the best way to use data structures concurrently is to use a channel 05:14
turdmonkey: you crawl the web, get the URL, send it to a channel, there's another concurrent routine reading from a channel and it's the only one printing to a file 05:15
05:15 wamba joined
jmerelo you can also use as many threads you want to continuosly generate URLs and send them to a channel, you don't need to spawn them every time. You can do that if you need, but you might end up with lots of threads. 05:16
turdmonkey cool
jmerelo turdmonkey: channels are explained here docs.perl6.org/language/concurrency#Channels I needed additionally a couple of questions in StackOverflow, but it's not really impossible. 05:17
If I remember correctly, timotimo is the expert in this. He was really helpful back then.
turdmonkey Thanks 05:19
jmerelo turdmonkey: sure :-)
05:24 titsuki_ left, titsuki joined, turdmonkey left 05:29 sauvin joined 05:35 mcmillhj joined 05:40 mcmillhj left 05:42 xtreak joined 05:50 espadrine joined 05:53 Tison left
Geth doc: 249c0878c6 | (JJ Merelo)++ | doc/Language/contexts.pod6
Expands explanation of string context

Including an explanation of why there could be problem when you mix the string contextualization super-power of `~` with its Buf concatenation super-power. I would say this closes #2124 if everyone is happy with it. I have preferred to document it here, but of course suggestions are welcome.
05:54
synopsebot Link: doc.perl6.org/language/contexts
05:58 releasable6 joined 06:02 sno joined 06:03 xinming joined 06:09 xinming left 06:15 espadrine left 06:22 xinming joined 06:29 mcmillhj joined 06:31 |oLa| joined 06:33 bwisti left, mcmillhj left, rindolf joined 06:37 HaraldJoerg joined
tyil according to pod docs, output/input should not have whitespace squeezed, but the output block gets newlines squeezed 06:38
b.catgirlsare.sexy/iQ5U.png 06:40
using the input as shows here b.catgirlsare.sexy/RBtl.png 06:41
jmerelo tyil: where in Pod docs? 06:42
tyil docs.perl6.org/language/pod#I/O_blocks "The =output block is used to specify pre-formatted terminal or file output, which should also be rendered without re-justification or whitespace-squeezing." 06:43
06:43 Schepeers joined 06:44 mcmillhj joined
jmerelo tyil: well, that's a "should". I would have to look at the actual code... Might be it's already squeezed when interpreted, but maybe it's got to do with the rendering. 06:44
06:45 jmerelo left
tyil its squeezed by the time Pod::To::Pager gets it 06:46
meaning I *cant* render it without whitespace squeezing
06:48 mcmillhj left 06:49 psychoslave joined 06:50 benjikun2 joined 06:54 benjikun left, parv joined 06:58 wamba left 07:05 Tideflat left 07:10 mcmillhj joined 07:15 mcmillhj left, jmerelo joined 07:17 domidumont joined 07:20 jmerelo left 07:24 domidumont left, darutoko joined 07:25 domidumont joined 07:26 wamba joined 07:33 kaare_ joined
ecocode hmmm.. which ORM to choose: DB::ORM::Quicky or KOOS ? 07:37
tyil I havent heard of either of them :( 07:38
07:47 jmerelo joined, dakkar joined 07:48 brrt joined 07:54 mcmillhj joined 07:58 brrt left 07:59 mcmillhj left 08:06 brrt joined
jmerelo exit 08:09
that is, AFK
08:09 jmerelo left 08:12 mcmillhj joined 08:16 kurahaupo left 08:17 mcmillhj left 08:34 xtreak left 08:36 xtreak joined 08:38 xtreak left, xtreak joined 08:39 pmurias joined, xtreak left 08:41 vike1 joined 08:46 mcmillhj joined 08:48 lookatme left 08:50 ChoHag joined, mcmillhj left 08:57 ChoHag left, psychoslave left 08:58 ChoHag joined 09:00 xtreak joined 09:02 wamba left 09:07 kurahaupo joined 09:09 kurahaupo left, parv left 09:16 wamba joined 09:18 xtreak left 09:32 mcmillhj joined 09:34 kaare__ joined, kaare_ left, kaare__ is now known as kaare_ 09:37 mcmillhj left 09:43 brrt left 09:44 zakharyas joined 09:46 mcmillhj joined 09:51 mcmillhj left 09:57 pecastro_ left 10:08 mcmillhj joined 10:12 ExtraCrispy joined 10:13 mcmillhj left 10:23 mcmillhj joined
tbrowder_ tyil: please file an issue on the pod input/output problem if you haven’t already 10:26
tyil tbrowder_: on which repo?
tbrowder_ rakudo 10:27
tyil I'm not sure if its a Perl or a documentation issue
alright
10:27 mcmillhj left
tbrowder_ well, at least some pod whitespace squeezing is handled in nqp portion of rakudo 10:28
10:33 benjikun joined
tyil tbrowder_: github.com/rakudo/rakudo/issues/1968 10:33
10:34 benjikun2 left
tbrowder_ thnx 10:34
10:36 benjikun2 joined 10:38 benjikun left 10:47 brrt joined 10:56 mcmillhj joined 10:58 psychoslave joined 10:59 giraffe joined 11:00 giraffe is now known as Guest34814 11:02 mcmillhj left 11:06 lizmat joined, dct joined 11:11 mcmillhj joined
lizmat waves from Echt 11:12
yoleaux 08:18Z <brrt> lizmat: most of the expr JIT templates came from samcv++
11:16 mcmillhj left
El_Che hey lizmat 11:16
yoleaux 05:06Z <jmerelo> El_Che: you're very welcome to do that. Terrible playing...
lizmat El_Che o/ 11:17
11:17 MasterDuke left
tyil lizmat: how's it be to be back in civilization 11:24
how's it feel*
lizmat mainly too tired from not really having slept last night 11:28
ecocode ehlo lizmat
lizmat ecocode o/ 11:29
ecocode how is Wendy ?
lizmat also really tired, unpacking stuff now
11:30 dakkar left
ecocode :) what did you bring back from USA ? 11:30
11:30 dakkar joined
lizmat ecocode: not a lot 11:33
ecocode any new books ? 11:35
tyil good memories? :D
timotimo any good booze? ;) 11:36
jkramer A Harley Davidson? :) 11:37
tyil all of the above :o
lizmat hehe.. we were just about overweight 11:40
but mostly because of Wendy swapping Perl books for comic books
ah, and a little pile of other books and CD's :-)
11:40 sena_kun joined, wamba left 11:42 cosimo joined, gabiruh joined 11:49 mcmillhj joined
tyil [Coke]: ping~ 11:49
11:52 raschipi joined 11:58 mcmillhj left 12:02 mahafyi joined, raschipi left
BinGOs p/win 50 12:07
mahafyi hello, I am trying to get a substring from XYZ00012345 , need to get 12345. Need to strip everything except the last digits until the left most char is 0. Basically, chop out everything including the zeroes. 12:10
ok never mind, i think i will try using replace with a regext that rids all alpha.. 12:11
tyil / "0" (\d+) $/ ? 12:12
masak m: say "XYZ00012345" ~~ / <?before 0> <[1..9]> \d+ / 12:17
camelia Nil
masak m: say "XYZ00012345" ~~ / <?after 0> <[1..9]> \d+ /
camelia 「12345」
masak mahafyi: ^^
given your problem description, it's hard to know if this was *exactly* what you wanted. but hopefully it can give some ideas. 12:18
m: say "XYZ00012345".comb(/ <[1..9]>+ /) # also works
camelia (12345)
mahafyi masak : thanks. 12:19
masak the first solution above will give back one Match object with digits. the second gives back a list with all matching substrings
m: say "XYZ00012345".comb(/ <[1..9]> \d+ /) # variant, would also match "12305"
camelia (12345)
12:23 imcsk8 joined 12:27 Ven` joined
jkramer m: say +('XYZ00012345' ~~ /\d+$/) 12:47
camelia 12345
jkramer (Assuming you want to extract it as integer anyway) 12:48
12:55 mcmillhj joined 12:57 dct left 12:58 kaare_ left 13:05 ChoHag left 13:07 ChoHag joined 13:11 lizmat left, Khisanth left 13:13 curan left 13:25 Khisanth joined 13:36 AlexDaniel joined 13:44 kaare_ joined 13:46 molaf joined, mrdside joined
mrdside how parse big XML file with unicode symbols? 13:46
xpath 13:47
13:48 Ven` left, Ven` joined
ufobat_ there is XML::XPath 13:49
13:51 brrt left, markoong joined
mrdside when try 'my $fh = open "data.xml", enc => "utf-8"; my $xpath = XML::XPath.new(xml => $fh.slurp-rest);' terminal hang 13:53
`$fh.slurp-rest`output "/╨Ч╨╜╨░╤З╨╡╨╜╨╕╨╡><" 13:54
14:02 zakharyas left 14:03 zakharyas joined 14:04 Zoffix joined
Zoffix mrdside: is that all that's in that file? You said it's big, but that's not very big. 14:05
mrdside: also, you're writing too much to read from files. You can just do `"data.xml".IO.slurp`
mrdside: or, XML::XPath.new(xml => slurp 'data.xml') 14:06
mrdside: or, XML::XPath.new(file => 'data.xml')
14:07 zakharyas left
mrdside 137 Mbytes 14:07
Zoffix oh
14:07 HaraldJo` joined
Zoffix mrdside: that module uses grammars and they haven't seen much optimization since our first release 2 years ago. I suspect it doesn't actually hang, but just taking ages to parse it. 14:08
14:08 HaraldJoerg left
tyil anyone using comma know how much ram I should let java have to make it possible for it to load the rakudo repo ;~; 14:09
Zoffix mrdside: do you have Inline::Perl5 installed? You could see how well `perl6 -e 'use XML::XPath:from<Perl5>; XML::XPath.new: :filename<data.xml>'` performs
eco: Inline::Perl5
buggable Zoffix, Inline::Perl5 'Use Perl 5 code in a Perl 6 program': github.com/niner/Inline-Perl5 1 other matching results: modules.perl6.org/s/Inline%3A%3APerl5
Zoffix tyil: it loaded fine with whatever defaults Ubuntu and Windows have. 14:10
tyil hmm
mine has failed loading with an error I should increase the Xmx value in comma64.vmoptions
are you using openjdk or a different java? 14:11
Zoffix don't remember (and don't have access to that box ATM)
You could experiment with some values. I believe setting `export JAVA_OPTS="-Xmx51200000000"` will also work
(that's the value for rakudo jvm build; maybe I have it set in some config or something) 14:12
m: say 51200000000.polymod: 1024
camelia (0 50000000)
AlexDaniel mrdside: that's a very good question!
Zoffix m: say 51200000000.polymod: 1024 xx *
camelia (0 128 700 47)
AlexDaniel mrdside: so we need something sax-like that doesn't manipulate the whole thing in memory 14:13
Zoffix DOM::Tiny is also slow as ass with largish HTML files 14:14
AlexDaniel well, in that case you can use Gumbo instead and that's much faster
also potentially more correct 14:15
Zoffix Mojo::DOM works fast :)
in P5
BTW, with all the comments about whether p6 is faster than p5, I think we should start taking our measurements on Windows... This mojo web app I'm working on right now starts in ~1s on Linux and like 25s on Windows 14:19
timotimo oh? wow
El_Che wow
AlexDaniel mrdside: alright, so what XML::XPath does, as far as I can see 14:20
mrdside: is that it calls from-xml-file from XML module
Zoffix granted, it might be some bug with longer wait times for socket timeouts or something along those lines, but the difference is there :/
jnthn Much of the early MoarVM optimization work was done on MSVC, so there was a time when Windows was the best place to benchmark. :)
AlexDaniel mrdside: and XML is a basic dom parser as far as I can see
Zoffix :)
jnthn That's probably no longer true.
AlexDaniel mrdside: which is obviously not the right approach for >100M files 14:21
mrdside PS > Select-Xml -XPath "..." -Path "..." works well
AlexDaniel what's that? 14:22
mrdside PowerShell
14:23 Ven` left
AlexDaniel mrdside: so at this point, if I needed to do this, I'd probably use some C library through NativeCall, or Perl5 or Python module through Inline::Perl5 or Inline::Python 14:24
14:24 skids joined
AlexDaniel mrdside: this way you'd have very fast and efficient retrieval of needed data + you'd be able to work with unicode strings on Perl 6 level 14:24
but yes, I wish there was a module that'd do that for you, similar to Gumbo 14:25
14:27 Zoffix left 14:29 wamba joined
mrdside i had try xmllint. but with '--shell' outputs '$#x41A;' in values but with normal xml node names 14:30
14:35 mrdside left 14:36 pmurias left 14:37 pmurias joined 14:43 Tison joined 14:48 Tison_ joined 14:49 Tison left 14:51 Tison_ left 14:53 perlpilot left 14:59 xtreak joined 15:02 bwisti joined 15:06 domidumont left 15:08 Tideflat joined 15:10 perlpilot joined 15:16 jmerelo joined 15:17 turdmonkey joined
turdmonkey Hello. 15:17
15:17 uzl joined
jmerelo hi, turdmonkey 15:18
uzl hello!
15:20 Tideflat left
jmerelo o/ 15:20
15:23 mahafyi left
uzl m: my $wiring = 'EKMFLGDQVZNTOWYHXUSPAIBRCJ'; my @entry = [$_.ord - 'A'.ord for $wiring.comb]; 15:25
camelia ( no output )
15:26 mahafyi joined
AlexDaniel jmerelo: re “I don't really see it as a trap”, here's the commit in question: github.com/perl6/whateverable/comm...19e8b7c278 15:27
jmerelo: my first attempt was to use [~] @chunks, it worked fine. Then I noticed some failing tests, because it was calling .decode on a Str
jmerelo: isn't that pretty much the definition of a trap? You write some code, it looks and works fine, but in reality it doesn't (in some cases)
jmerelo AlexDaniel: let me rephrase that. The behavior is documented. Only I think it would be better when documenting contexts than as a trap 15:28
AlexDaniel jmerelo: why not both? 15:29
jmerelo AlexDaniel: that's what I have said in the issue.
15:29 Ven` joined
uzl m: my $wiring = 'EKMFLGDQVZNTOWYHXUSPAIBRCJ'; my @entry = [$_.ord - 'A'.ord for $wiring.comb]; say @entry; 15:30
camelia [4 10 12 5 11 6 3 16 21 25 13 19 14 22 24 7 23 20 18 15 0 8 1 17 2 9]
AlexDaniel jmerelo: yes please, but with short example inlined on the traps page :)
jmerelo: I do agree that traps page should link to more wordy explanations, but the gist (or at least some short examples) should be right there
that's what I think, feel free to disagree :)
uzl Is there any way to start populating the array at index 1 instead? 15:31
jmerelo AlexDaniel: I'm happy, Spain is proceeding to the next phase in the world cup. So I'll try to comply :-)
AlexDaniel jmerelo: by the way, have you seen mywiki.wooledge.org/BashPitfalls ?
jmerelo uzl: you won't happen to be an undercover R spy, right?
AlexDaniel jmerelo: that's my inspiration for the traps page :) 15:32
15:32 Tideflat joined
uzl I could do it with a foor loop but I'm wondering if it can be done in the list comprehension fashion? 15:32
jmerelo AlexDaniel: I see. Kinda of "this is wrong, this is why it happens, this would be the right way"
uzl jmerelo: No. Probably too invested in Perl 6. 15:33
jmerelo uzl: R arrays start in 1 :-)
uzl jmerelo: i think the same with Lua.
jmerelo uzl: Anyway, this is not like Python. It's not "list comprehension". You're just putting the result in list context. Let's check this 15:34
AlexDaniel m: my $wiring = ‘EKMFLGDQVZNTOWYHXUSPAIBRCJ’; my @entry = 0, |[$_.ord - ‘A’.ord for $wiring.comb]; say @entry
camelia [0 4 10 12 5 11 6 3 16 21 25 13 19 14 22 24 7 23 20 18 15 0 8 1 17 2 9]
AlexDaniel uzl: you mean something like this?
jmerelo m: my $wiring = 'EKMFLGDQVZNTOWYHXUSPAIBRCJ'; my @entry = $_.ord - 'A'.ord for $wiring.comb ; say @entry;
camelia [9]
uzl AlexDaniel: That will do. 15:35
AlexDaniel jmerelo: it quacks very much like list comprehensions
15:35 Tideflat left
jmerelo m: my $wiring = 'EKMFLGDQVZNTOWYHXUSPAIBRCJ'; say $wiring.comb.map: *.ord - 'A'.ord 15:35
camelia (4 10 12 5 11 6 3 16 21 25 13 19 14 22 24 7 23 20 18 15 0 8 1 17 2 9)
jmerelo m: my $wiring = 'EKMFLGDQVZNTOWYHXUSPAIBRCJ'; say 0, $wiring.comb.map: *.ord - 'A'.ord
camelia 0(4 10 12 5 11 6 3 16 21 25 13 19 14 22 24 7 23 20 18 15 0 8 1 17 2 9)
jmerelo m: my $wiring = 'EKMFLGDQVZNTOWYHXUSPAIBRCJ'; say ($wiring.comb.map: *.ord - 'A'.ord).unshift: 'Bookend' 15:36
camelia Cannot resolve caller unshift(Seq: Str); none of these signatures match:
(Any:U \SELF: |values is raw)
in block <unit> at <tmp> line 1
uzl if it quacks like list comprehension, then it's likely that is list comprehension ;)
probably not true!
AlexDaniel m: my $wiring = ‘EKMFLGDQVZNTOWYHXUSPAIBRCJ’; my @entry = 0, |do $_.ord - ‘A’.ord for $wiring.comb; say @entry 15:37
camelia [0 4 10 12 5 11 6 3 16 21 25 13 19 14 22 24 7 23 20 18 15 0 8 1 17 2 9]
jmerelo uzl: that's DWIM by any other words.
m: my $wiring = 'EKMFLGDQVZNTOWYHXUSPAIBRCJ'; say 'Quak', | $wiring.comb.map: *.ord - 'A'.ord
camelia Quak410125116316212513191422247232018150811729
jmerelo m: my $wiring = 'EKMFLGDQVZNTOWYHXUSPAIBRCJ'; say ('Quak', | $wiring.comb.map: *.ord - 'A'.ord ).join: '|' 15:38
camelia Quak|4|10|12|5|11|6|3|16|21|25|13|19|14|22|24|7|23|20|18|15|0|8|1|17|2|9
AlexDaniel uzl: maybe consider using Nil instead of 0
jmerelo m: my $wiring = 'EKMFLGDQVZNTOWYHXUSPAIBRCJ'; say (Mu, | $wiring.comb.map: *.ord - 'A'.ord ).join: '|' 15:39
camelia Use of uninitialized value of type Mu in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
|4|10|12|5|11|6|3|16|21|25|13|19|14|22|24|7|23|20|18|15|0|8|1|17|2|9
in block <unit> at <tmp> l…
jmerelo m: my $wiring = 'EKMFLGDQVZNTOWYHXUSPAIBRCJ'; say (Nil, | $wiring.comb.map: *.ord - 'A'.ord ).join: '|'
camelia Use of Nil in string context
|4|10|12|5|11|6|3|16|21|25|13|19|14|22|24|7|23|20|18|15|0|8|1|17|2|9
in block <unit> at <tmp> line 1
jmerelo m: my $wiring = 'EKMFLGDQVZNTOWYHXUSPAIBRCJ'; say ('', | $wiring.comb.map: *.ord - 'A'.ord ).join: '|'
camelia |4|10|12|5|11|6|3|16|21|25|13|19|14|22|24|7|23|20|18|15|0|8|1|17|2|9
uzl jmerelo: yesterday I mentioned that my pull request for the Spanish translation for Learn X in Y -- Perl 6 has been pushed to the website.
jmerelo uzl: great!
uzl jmerelo: probably you could take a look at it whenever you have time. Or somebody else! 15:40
it could benefit from some revision.
jmerelo uzl: I'll outsource to family :-) 15:41
uzl AlexDaniel: That would be more according to what I was trying to do. So Nil makes more sense (in this case)!
jmerelo: that's great! 15:42
jmerelo uzl: but thanks for taking the work to translate that :-)
15:42 brrt joined, perlpilot left
uzl jmerelo: I guess that's my way to give back to the Perl community. So thanks to you all for the great work. 15:43
jmerelo uzl++
BTW, about to close this straw poll on the future of prescriptions for hashes in the Perl6 doc style guide: github.com/perl6/doc/issues/2117#i...-399742781 15:44
uzl Any consensus reached? 15:46
15:47 mahafyi left
jmerelo uzl: no consensus, just a simple majority. 15:47
15:47 mahafyi joined
AlexDaniel jmerelo: I'm surprised with “Have you used Perl 6 in academia?” responses 15:48
jmerelo AlexDaniel: there are too many "yes", right?
AlexDaniel yes, too many
which is great but I'm really surprised
jmerelo: I thought we're the odd ones but I guess we're not special at all :P :P
jmerelo AlexDaniel: it's not you and me answering lots of times, right? moritz is also in academia, or was. 15:49
uzl jmerelo: Oh, I see!
jmerelo AlexDaniel: we're the ones in computer architecture. That makes us special. We build the stuff that everyone else needs to run stuff.
uzl Are the poll results out already?
jmerelo uzl: they are to a lucky few.. who are in academia :-) 15:50
uzl: you can probably request access, I don't think benjikun will have a problem with that.
uzl jmerelo: Oh, well! What a priviliged group! ;) 15:51
15:51 psychoslave left
uzl uzl: That's fine! I'll see it when it comes out! 15:51
jmerelo AlexDaniel: actually, the responses are not so surprising. I would like to see whoever used it in a course, unless it was one of my students. And some people chose to use it by themselves, which should be expected... 15:52
AlexDaniel: 10 for research, that's great to hear :-)
sena_kun oh, are survey results already can be seen? 15:54
jmerelo sena_kun: let me see if I can publish the responses only 15:55
sena_kun also, is there a way to know if a role is from CORE.setting or not?
jmerelo, thanks, that'd be interesting to see. :) 15:56
jmerelo sena_kun: um. Not sure what you mean... (the roles)
15:56 uzl left
sena_kun m: class A does Positional {}; role Foo {}; class B does Foo {}; 15:57
camelia ( no output )
AlexDaniel clickbaits docs.google.com/forms/d/e/1FAIpQLS...g/viewform
15:57 mahafyi left
sena_kun So Positional is from CORE, while Foo is just your user-defined role. 15:58
Was wondering if there is a way to check if role Foo user-defined or not. It is not really necessary, just can make some things easier. :)
15:58 xtreak left
jmerelo sena_kun: here are the responses: docs.google.com/forms/d/19qSBpGWWc...wanalytics 15:59
sena_kun jmerelo, thanks!
jmerelo sena_kun: Other than looking at the source, I don't see a way, easy or otherwise, to do that. All classes and roles use the same protocol... 16:00
jnthn m: say Positional.^candidates[0].^body_block.file
camelia SETTING::src/core/Positional.pm6
jnthn sena_kun: ^^
sena_kun jnthn, isn't it a bit fragile to depend on? Hmm.
jmerelo jnthn: I really had no idea of that. Thanks! So it's a matter of smartmatching to core, right? 16:01
sena_kun jnthn, anyway, will consider this option too, thanks.
jnthn Well, the SETTING:: at the start may be better to match on and that bit may be a little fragile I guess
The introspection bit...well, that bit of the MOP has been factored that way for probably close to a decade. :) 16:02
Juerd Where is 'for' implemented? I'm curious :)
jnthn Juerd: In multiple places, for performance reasons. At statement list level, it's compiled into a .iterator method call and a loop with a .pull-one method call and block invocation in it for some cases (like the single arg case). That's done in Actions.nqp. In Optimizer.nqp a loop like `for 1..5000 { }` is rewritten into a `loop (...) { }` style construct instead. For all other case, it's just .map + an 16:05
appropriate contextualizer.
Juerd Thanks!
16:05 MilkmanDan joined, mahafyi joined
Juerd Also, that's incredibly interesting :) 16:06
16:10 mcmillhj left 16:13 sena_kun left, sena_kun joined 16:15 Zoffix joined
Zoffix m: role Foo {}; class A does Positional does Foo {}; say "{.^name} is{" not" unless CORE::{.^name} === $_} from core" for A.^roles 16:15
camelia Foo is not from core
Positional is from core
Zoffix sena_kun: ^ maybe that does the trick?
m: say CORE::<Positional> =:= $_ for class :: does Positional {}.^roles 16:16
camelia False
Zoffix m: say CORE::<Positional> =:= $_ for class :: does Positional {}.^roles.<> 16:17
camelia False
Zoffix m: say CORE::<Positional> =:= $_ for class :: does Positional {}.^roles».<>
camelia False
Zoffix Wonder why that's false
sena_kun Zoffix, this is another option indeed. And it seems a bit less fragile to me than filename matching. Thanks.
timotimo Zoffix: probably role group vs role instance? 16:18
Zoffix: because positional's got a parameter?
Zoffix timotimo: wouldn't the difference between === and =:= be just the different containers? 16:19
m: say CORE::<Positional> === $_ for class :: does Positional {}.^roles
camelia True
16:19 mcmillhj joined
Zoffix Cause it's true with ===, only with =:= it's false and AFAIS they ain't in any containers 16:19
timotimo don't know how === is implemented for this, tbh
Zoffix s: &infix:<===>, \(CORE::<Positional>, class :: does Positional {}.^roles.head) 16:20
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/e935...y.pm6#L490
16:20 Ven` left
timotimo so it compares the WHICHes 16:20
Zoffix ah, k, yeah
Alright, makes sense.
timotimo m: Positional.WHICH.say; Positional[Any].WHICH.say
camelia Positional|U48023568
Positional[Any]|U57988064
timotimo m: say CORE::<Positional>.WHICH; say (class :: does Positional {}.^roles)[0].WHICH 16:21
camelia Positional|U48583584
Positional|U48583584
timotimo oh, huh?
Zoffix Default is mu
timotimo well, it seems to pun it anyway i guess?
Zoffix m: Positional.WHICH.say; Positional[Mu].WHICH.say
camelia Positional|U29801408
Positional[Mu]|U39763568
Zoffix hm
Zoffix shrugs
timotimo it might pun the object to use it in === 16:22
16:24 brrt left, mcmillhj left, st_elmo joined 16:27 lizmat joined 16:30 Zoffix left 16:31 telex joined 16:34 dakkar left 16:35 kalkin- joined
kalkin- hi 16:35
16:35 xinming left
kalkin- so I see that some people started using in source-url: www.cpan.org/*.tar.gz, which just contains source files, but no .git information 16:36
this sucks, because now ddt hack Pod::To::Pager checkout the module code via git, so I can start hacking 16:37
What is the blessed way to communicate the VCS repository location for your module?
Geth ecosystem: pheix++ created pull request #401:
Add Net::Ethereum to ecosystem
16:40
16:41 mcmillhj joined, mcmillhj left
Geth ecosystem: e9d59bf4b1 | (Konstantin Narkhov)++ | META.list
Add Net::Ethereum to ecosystem

See gitlab.com/pheix/net-ethereum-perl6
16:42
ecosystem: f49f7c5127 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Merge pull request #401 from pheix/master

Add Net::Ethereum to ecosystem
AlexDaniel kalkin-: I'm pretty sure that the source-url should be pointing to the git repo
but I could be wrong
kalkin- Well S26 doesn't say anything about source-url 16:44
Geth doc: 9c7b4ead97 | (JJ Merelo)++ | doc/Language/regexes.pod6
Space added closes #2125. Thanks @devine for the detailed bug report
synopsebot Link: doc.perl6.org/language/regexes
16:45 sno left
kalkin- Hmm now rereading my second message, I will explain it a little bit more for everyone. 16:47
I have a tool(ddt) which checkouts the modules git repository via ”source-url” in META6.json (via zef). This is broken because some module have a cpan tar.gz file linked in source-url. The tar.gz file doesn't contain any git repo information. 16:48
The question is, what is expected in source-url? If this is defined, may be cpan/modules infrastructure could be patched to assert the right kind of value in source-url
turdmonkey Does anyone else love kebab case as much as I? It makes typing functions quicker than underscore_case and more readable than crapCase 16:54
geekosaur many people do, that's why perl 6 has it 16:55
and a small handful of other languages
16:56 mcmillhj joined 16:59 mahafyi left
kalkin- kebab is great 17:01
[Coke] tyil: yes, I saw your email. 17:03
17:05 natrys joined
AlexDaniel turdmonkey: yes ♥ 17:05
turdmonkey <3 17:08
I'm working on the concurrent portion of my web crawler now, which is, realy, the main feature that I want to show off. 17:10
17:10 aindilis joined
turdmonkey Concurrent...rather...asynchronous? Because it may takes some links longer than others. 17:10
Geth doc: 4f18e4e87b | (JJ Merelo)++ | doc/Language/traps.pod6
Adds also to trap section, *really* closes #2124
17:12
synopsebot Link: doc.perl6.org/language/traps
doc: e232c3883a | (JJ Merelo)++ | writing-docs/STYLEGUIDE.md
Prescription for a particular form of declaring hashes eliminated

The tally was 6 votes for this option, 3 for not touching it, 4 for changing to {} (from %()). So, eliminated and closes #2117.
17:15
17:15 turdmonkey left
Geth doc: AlexDaniel self-assigned Potential trap with concatenating Bufs/Blobs, [~] returns a Str github.com/perl6/doc/issues/2124
573cbf408a | (JJ Merelo)++ | doc/Language/regexes.pod6
17:18
17:20 n1ge left
jmerelo Have you seen this? twitter.com/JoinAppleSearch/status...1416370176 is it legit? Or a bot? 17:23
AlexDaniel if it's a bot, I like that bot 17:28
jmerelo AlexDaniel: because it's mentioning perl 6, but I'm not sure it's taking it from somewhere else. It's probably triggered by some Apple thing. 17:29
Let me check.
Come to think of it, it's probably both things. That tweet is legit, but it's telling us how the bot works? I mean, has anyone heard of the DOHP stack? With Perl 6? 17:30
17:36 zakharyas joined 17:37 uzl joined 17:38 Zoffix joined
uzl Can somebody look into this and tell me where are the two implicit nested loops? (github.com/LaurentRosenfeld/thinkp...L516-L527) 17:39
I am struggling to find them!
Zoffix kalkin-: that source-url is correct. The source lives on CPAN and it doesn't need to have any repo associated with it. If you download the tar itself, it should have the original META file that likely has the original source-url that's likely a git repo 17:40
jmerelo uzl: index is a loop. It checks one by one
Zoffix kalkin-: the other possibility is to use modules.perl6.org's API; the value should be in `repo-url` key for the dist. But note that the site currently needs distro name, it doesn't work if you specify a name of some module contained in the dist 17:41
geekosaur uzl, one is explicit (the for), the other implicit (indexing through the other item). see the other varianbt at lines 499--505
Zoffix kalkin-: though looks like some authors don't specify anything at all for the repo URL: modules.perl6.org/dist/Pod::To::Pa...META6.json 17:42
17:43 turdmonkey joined
Zoffix I see only one loop in there :/ 17:44
uzl jmerelo, geekosaur: That totally over my head! I never thought of index in that way.
Thans for the clarification!
Zoffix Why is index a loop? It's a routine call. How it is implemented is a secret.
17:45 sno joined
jmerelo uzl: sure :-) 17:45
uzl Zoffix: So it shouldn't be thought as one?
geekosaur Zoffix, but thinking of it that way obscures that you can make the other implementation
geekosaur looking at it with haskell eyes 17:46
jmerelo Zoffix: it's got to check the argument against the string. Unless you've done some clever indexing of the string, it's going to be a loop. I doubt it's done otherwise for plain strings.
Zoffix is looking at it with practical eyes
17:46 mcmillhj left
geekosaur not very, if you can't see the other possibility 17:46
"practical" can mean "only see brute force solutions" 17:47
Zoffix No, practical is I know only that I need to know: index "finds a string in another string". I don't need to know the details of how it's implemented to find the two methods to implement that routine. It's irrelevant how `index` is implemented for that purpose. In fact, you're merely assuming it's implemented as a loop and you claim that assumption gave you some special magic knowledge that made you see both 17:48
solutions, when you really just used the same method as I and saw the symmetry of looking for a thing in another thing.
jmerelo Zoffix: but you know there's an implicit loop, that's implicit in the question. Any other candidate there? 17:49
Zoffix jmerelo: I know nothing.
The definition of index routine is not present. 17:50
And the question is wrong.
jmerelo Zoffix: Well, it says so in line 516: github.com/LaurentRosenfeld/thinkp...#L516-L527
Zoffix jmerelo: that doesn't make it correct. 17:51
Maybe you guys should assume there's an implicit loop around the book, so you could see it both ways, eh :P
jmerelo Zoffix: that's rich :-)
Zoffix: but you don't have to look at the general truthiness or not of the book, just at the implicit assumptions of the text and the code. If we assume there's an implicit loop, that must be the one 17:52
17:52 mcmillhj joined 17:53 mcmillhj left
uzl Zoffix: Do you think it could be expressed more clearly? As far I know, the book hasn't made any mention of the index routine being a loop. 17:53
jmerelo Zoffix: in fact, it's the reverse of the code above in line 499, which uses index for the outer "for" loop. So that's it.
uzl: I don't know what's the point of identifying the number of loops there... But I guess the intention of the text is exactly that. 17:54
17:54 MilkmanDan left 17:55 MilkmanDan joined
Zoffix uzl: yup: $forbidden.contains: none $word.comb 17:55
17:56 zakharyas left
uzl Zoffix: I meant the statement about the implicit loops. 17:57
I am probably ruminating too much on it. I guess it's just what jmerelo said. 17:58
Zoffix uzl: dunno, I'd need to know why that paragraph is talking about loops to give a reasonable answer.
uzl Zoffix: you're totally right about that! 18:00
Zoffix Kinda bummed that example is so verbose. The `for 0..$forbidden.chars - 1 -> $idx` part can just be `for ^$forbidden.chars -> $idx`, the `for ^$forbidden.chars -> $idx { my $letter = substr $forbidden, $idx, 1;` could be just `for $forbidden.comb -> $letter {`, the `for $forbidden.chars -> $letter { return False if defined index $word, $letter;` could be just `for $forbidden.comb -> $letter { return False if 18:03
$word.contains: $letter;` which itself could just be `$forbidden.contains: none $word.comb`
Some of them use more advanced features, I can accept that, but surely `$word.contains: $letter` is simpler and more understandable than `defined index $word, $letter`
18:08 mcmillhj joined, dct joined
Zoffix kalkin-: FWIW, modules.perl6.org/repo/$^module redirects to the repo 18:09
Can't use `git clone modules.perl6.org/repo/$^module` tho, sadly
18:10 tailgate joined 18:12 tailgate left, tailgate joined 18:15 melezhik joined
Zoffix kalkin-: and this is the "api" way (the API is poorly defined, mostly just a JSON view of some pages): perl6 -MWWW -MURI::Escape -e 'sub MAIN { "modules.perl6.org/s/&uri-escape...po_url> andthen "Clonning $_".say && «git clone -- "$_"».&run orelse say "Not found" }' JSON::Tiny 18:15
18:15 Zoffix left
melezhik Hi! How to prove that array include some element ? 18:15
El_Che m: [1,3,3].grep: 10 18:16
camelia ( no output )
El_Che m: [1,3,3].grep: 3
camelia ( no output )
El_Che m: say so [1,3,3].grep: 3 18:17
camelia True
AlexDaniel m: [1,3,3].contains: 3
camelia ( no output )
timotimo but is that proof?
AlexDaniel m: say [1,3,3].contains: 3
camelia True
melezhik Thanks, :AlexDaniel 18:18
18:18 espadrine joined 18:20 dct left
El_Che .index can be handy as well, if you need that (nil if not present) 18:20
synopsebot Link: doc.perl6.org/language/regexes
18:23 jmerelo left, sauvin left 18:25 robertle joined, dct joined
Geth doc: 376ca54578 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Type/IO.pod6
Remove merge conflict markers
18:28
synopsebot Link: doc.perl6.org/type/IO
18:29 Zoffix joined
Zoffix m: say [1,33].contains: 3 18:29
camelia True
Zoffix m: say [1,33].index: 3
camelia 2
AlexDaniel wait uh 18:30
Zoffix melezhik: depends on what how you define "contains" (object identity, string equivalence, numerical equivalence?) and what possible elements it might contains (will Nil ever be a possible value, are all values defined?)
AlexDaniel melezhik: yeah don't listen to me, it was a brainfart… 18:31
Zoffix s: [1, 2, 3].grep.iterator, 'bool-only', \()
SourceBaby Zoffix, Something's wrong: ␤ERR: Cannot resolve caller grep(Array: ); none of these signatures match:␤ ($: Bool:D $t, *%_)␤ ($: Mu $t, *%_)␤ in block <unit> at -e line 6␤␤
Zoffix s: [1, 2, 3].grep(3).iterator, 'bool-only', \()
AlexDaniel melezhik: .contains is for strings, so most likely not what you're looking for if you have arrays
SourceBaby Zoffix, Something's wrong: ␤ERR: Could not find candidate that can do \()␤ in sub sourcery at /home/zoffix/services/lib/CoreHackers-Sourcery/lib/CoreHackers/Sourcery.pm6 (CoreHackers::Sourcery) line 32␤ in block <unit> at -e line 6␤␤
Zoffix boo
AlexDaniel m: say so [1, 2, 3].any == 2 18:32
camelia True
AlexDaniel a few minutes ago I was thinking about something and hit my head against a wall real hard 18:33
not my day I guess :)
El_Che AlexDaniel: hopefully not a Larry
or gloria
AlexDaniel that I wouldn't mind, but it was an actual concrete wall
Zoffix melezhik: if you're OK with checking item identity (ie 42, <42>, and "42" are all different), then my favourite is `42 ∈ @teh-array`. Otherwise, if all possible array elements are definied, you could use with @array.first: $value { … }`. If `Nil` is a possible value, then I'd go with grep variant that was suggested above 18:34
hmm
m: my $s := gather { take 1; say "one"; take 2 }; $s.grep(1).so 18:35
camelia ( no output )
Zoffix m: my $s := gather { take 1; say "one"; take 2 }; dd $s.grep(1).so
camelia Bool::True
Zoffix I guess .first is kind'of a perl5-ism, innit? Since in perl 6 grep is lazy and doesn't process all the values and stuff 18:36
m: my $s := gather { take 1; say "one"; take 2 }; dd $s.grep(1) 18:37
camelia one
(1,).Seq
Zoffix m: my $s := gather { take 1; say "one"; take 2 }; dd $s.grep(1).head
camelia 1
Zoffix :)
18:38 turdmonkey is now known as Bowlslaw 18:39 Bowlslaw is now known as turdmonkey
AlexDaniel Zoffix: hm, it's also interesting that without args .head and .first are probably identical 18:39
18:39 turdmonkey is now known as Bowlslaw
Zoffix Yeah 18:39
Bowlslaw cool
Zoffix They used to differ around 2015 and .head returned (el,), but then was changed, making the two the same
18:40 uzl left, uzl joined
Zoffix m: my @a := 1, 2, 3; my \n := 100_000; { for ^n { .grep(1).so; Nil }; say now - ENTER now }; { for ^n { .first(1).so; Nil }; say now - ENTER now }; 18:41
camelia 1.1955954
0.5162271
Zoffix m: my @a := 1, 2, 3; my \n := 100_000; { for ^n { (1 ∈ @a).so; Nil }; say now - ENTER now }; { for ^n { my $ = .first(1).so; Nil }; say now - ENTER now }; 18:43
camelia 0.3567726
0.4258263
Zoffix w00t :)
lizmat++ # optimizing ∈
El_Che those pesky macbook users with their 1 and only use for that trackbar 18:44
El_Che ducks
18:44 psychoslave joined
Zoffix never used a mac 18:44
well, I did remotely once, I guess to debug stuff 18:45
El_Che Zoffix: I am teasing lizmat :)
Zoffix ah
AlexDaniel: looks like one is like twice slower than the other tho
AlexDaniel Zoffix: which one? :)
Zoffix .first is slower 18:46
3.24x slower, on a 3-el array 18:47
Bowlslaw github.com/Bowlslaw/webcrawler/blo...crawler.p6
18:47 st_elmo left
Bowlslaw in order to follow the links, I would have get-urls return get-urls($dom.find('a[href]');, right? 18:47
recusively, right?
Zoffix 3el list 18:48
R#1973 18:49
synopsebot R#1973 [open]: github.com/rakudo/rakudo/issues/1973 [perf] .first() is equivalent to .head(), but is 3x slower
AlexDaniel Bowlslaw: but why not .race?
Bowlslaw I don't know, haha.
I am still experimenting with Perl's concurrency features
AlexDaniel should give more control over the amount of workers
Zoffix Bowlslaw: that file will get clobbered
AlexDaniel and yeah, that poor file 18:50
Bowlslaw yes I know right now
er
18:50 benji__ joined
melezhik zoffix: value ∈ @array works for me, thanks 18:50
Bowlslaw wait, it will?
i open it with :a
melezhik btw this is the first time when I use unicode in my code )))
Zoffix Bowlslaw: you're writing into it from multiple threads at the same time tho
you wanna lock it
Bowlslaw ooh
18:51 benji__ is now known as benjikun
Zoffix Bowlslaw: docs.perl6.org/routine/lock.html#(...ethod_lock 18:51
AlexDaniel melezhik: you can also write `value (elem) @array`
geekosaur you can get away with that if and only if you control buffering manually so you can ensure every write is atomic. or you lock the Handle so non-atomic writes don't get interleaved; but make sure you flush output before unlocking 18:52
Zoffix Bowlslaw: as for `get-urls($dom.find('a[href]'))` <-- that would pass a list of DOM::Tiny objects as the argument. You want $dom.find('a[href]')»<href>».&get-urls
geekosaur or disable buffering
Zoffix Bowlslaw: in other words, you need to get the actual value of the `href` attribute and also you need to call your routine for each of the links in the list 18:53
Bowlslaw >> is the "apply to all" operator?
Zoffix Bowlslaw: more or less, yes
18:53 benjikun2 left
melezhik AlexDaniel: sure, thanks 18:54
Zoffix Bowlslaw: and another thing: some `href`s won't be full URLs, they could be `/some-page` or even `../some/page`. You need to normalize them based on current page's URL or `<base>` element, if one's preseent 18:55
Bowlslaw yes, I've noticed
18:55 mcmillhj left
Bowlslaw thanks a lot 18:55
you're helping me make it much more concrete and giving me good direciton
melezhik btw , zoffix: how to I input "∈" using standard keyboard?
Zoffix melezhik: depends on your OS 18:56
melezhik: Compose, i, n does that work 18:57
u: ∈
unicodable6 Zoffix, U+2208 ELEMENT OF [Sm] (∈)
Bowlslaw "$dom.find('a[href]')»<href>».&get-urls"
18:57 psychoslave left
Zoffix melezhik: or Ctrl+Shift+u, 2208 that's not the easiest way tho 18:57
melezhik virtual machine in google cloud centos7
AlexDaniel there are some suggestions on docs.perl6.org/language/unicode_entry
Bowlslaw that code gets the DOM::Tiny objects, uses '>>' to get all of the hrefs,and then passes all of those hrefs to get-urls, right? 18:58
El_Che
AlexDaniel melezhik: what text editor do you use?
El_Che it works wow
Zoffix Bowlslaw: basically, yeah
Bowlslaw Zoffix, that is very cool
El_Che reminds me of wndows 3.11 in the nineties :)
Zoffix Indeed
Bowlslaw '>>' seems so useful...
El_Che alt + 255 is one I remeber
255
Bowlslaw Zoffix: so my code, as it stands, with await do ... and start { ... } I do not entirely understand what it is doing 18:59
it just makes one thread as it stands, right?
18:59 mcmillhj joined
Bowlslaw but when I add the recursive functionality to get-urls, it will spawn a thread for each URL ? 19:00
Zoffix Bowlslaw: basically yeah
Bowlslaw: you're probably better off using a Supply. It got a throttle on it
Bowlslaw yes, I am reading about the different concurrency etc. objects 19:01
they all use the Promise object?
Zoffix Don't think so
Bowlslaw so I make a Supply and throttle it to, say, 10, which would limit it to 10 workers?
or 10 threads?
19:01 uzl left, zachk joined
Zoffix Promise is like a single value, while Supply is a list of values or whatever 19:02
19:02 uzl joined
Zoffix Bowlslaw: 10 jobs running at the same time. 19:02
When one completes, another one is started, until they're all done.
Bowlslaw Sorry for so many questions, I've never written a concurrent app before 19:03
Zoffix neither
Like one maybe
19:03 zachk left, zachk joined 19:04 darutoko left
Zoffix Bowlslaw: and instead of opening the file and locking into it on each link, you could set up a Channel, which is thread-safe, and then the threads would send stuff to the channel and on the receiving way, you can just keep the file open and write to into it without a lock as data arrives 19:04
huggable: Channel
huggable Zoffix, Thread-safe queue for sending values from producers to consumers: docs.perl6.org/type/Channel
melezhik AlexDaniel: thanks , will look into this 19:05
AlexDaniel: nano
Bowlslaw omg that is cool
Zoffix Bowlslaw: you could also use .race, as AlexDaniel said
Bowlslaw yes
19:05 dct left
Bowlslaw as in... 19:06
er...
where the heck do I put .race ?
await do for get-urls($seed) -> $e.race ?
get-urls($seed).race
Zoffix The latter 19:07
Bowlslaw I knew it!
my Perl 6 instinct increases!
19:07 dct joined
Zoffix Bowlslaw: just keep in mind, if you do `for @blah.race { ... }` that will be serial, you need `race for @blah`. That's a special thing that RaceSeq and HyperSeq get serialized by normal `for` 19:08
Bowlslaw do I need to remove 'await do' ?
await do race for @blah, lol 19:09
19:09 mcmillhj left
Zoffix Bowlslaw: yeah, remove it all 19:09
m: sub get-urls { $^v.comb }; get-urls("meows").race.map: { say "Got $_" } 19:10
camelia Got m
Got e
Got o
Got w
Got s
Zoffix m: sub get-urls { $^v.comb }; get-urls("meows").race(:batch).map: { say "Got $_" }
camelia Got m
Got e
Got o
Got w
Got s
Zoffix m: sub get-urls { $^v.comb }; get-urls("meows").race(:batch).map: { say "Got $_" }
camelia Got m
Got e
Got o
Got w
Got s
Zoffix m: sub get-urls { $^v.comb }; get-urls("meows").race(:batch).map: { say "Got $_"; sleep rand }
camelia Got m
Got e
Got o
Got w
Got s
Zoffix :|
Bowlslaw lol 19:11
Zoffix Does .race use afinity queue or general queue?
m: sub get-urls { $^v.comb }; get-urls("meows").race(:batch).map: { say "Got $_"; sleep 2 }; say now - ENTER now 19:12
camelia Got m
Got e
Got o
Got w
Got s
4.0223487
Zoffix ok, so it's batching right, but they're all in order somehow :/
m: my int $n; sub get-urls { $^v.comb }; get-urls("meow").race(:batch).map: { print $_; sleep $n⚛++ }; say " ", now - ENTER now 19:14
camelia meow 3.051368 19:15
Zoffix oh, I'm dumb
I'm printing the stuff BEFORE it sleeps :P
no, still in order :/ 19:16
AlexDaniel m: my int $n; sub get-urls { $^v.comb }; get-urls("meow").race(:batch).map: { sleep rand; print $_ }; say " ", now - ENTER now 19:17
camelia wemo 0.98007657
Bowlslaw wemo!
AlexDaniel m: my int $n; sub get-urls { $^v.comb }; get-urls("meowmeowmeowmeow").race(:batch).map: { sleep rand; print $_ }; say " ", now - ENTER now
camelia memwoeoowmeewwmo 2.17836912
Zoffix m: my int $n; sub get-urls { $^v.comb }; get-urls("meow").race(:batch).map({ say $n; sleep $n⚛++; $_ }).join.&say: " ", now - ENTER now
camelia 0
1
2
3
meow 3.05100321
19:18
AlexDaniel looks racy to me
Zoffix m: my int $n; sub get-urls { $^v.comb }; get-urls("meow").race(:batch).map({ say $n; sleep $n⚛++; $_ }).join.&say: " ", now - ENTER now
camelia 0
1
2
3
meow 3.051496
Zoffix oh right
m: my int $n = 3; sub get-urls { $^v.comb }; get-urls("meow").race(:batch).map({ say $n; sleep $n⚛--; $_ }).join.&say: " ", now - ENTER now
camelia 3
2
1
0
woem 3.0166136
19:19 HaraldJo` left 19:20 mcmillhj joined
Zoffix "Perl 6: conventient constructs for parallelism that save you time coding… so you could waste it trying to see if those construct give stuff out of order" :) 19:21
Bowlslaw lol
19:25 mcmillhj left 19:26 dct left 19:27 dct joined
Zoffix m: sub get-urls($url) { gather { take $url; $url.chars > 1 and .take for get-urls $url.chop } }; await get-urls("meows").Supply.throttle: 3, {.say; sleep ½}; 19:30
How come it never finishes?
camelia (timeout)meows
Zoffix ah, nm 19:31
the `and` is part of the `for` body
m: 'sub get-urls($url) { gather { take $url; $url.chars > 1 and (.take for get-urls $url.chop) } }; await get-urls("meows").Supply.throttle: 3, {.say; sleep ½};
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1)
at <tmp>:1
------> 3s").Supply.throttle: 3, {.say; sleep ½};7⏏5<EOL>
expecting…
Zoffix m: sub get-urls($url) { gather { take $url; $url.chars > 1 and (.take for get-urls $url.chop) } }; await get-urls("meows").Supply.throttle: 3, {.say; sleep ½};
camelia meows
meow
meo
me
m
19:31 _uzl joined 19:32 DeepIO joined, DeepIO left 19:33 uzl left
Zoffix m: (my Channel $c .= new).Supply.tap: { say "Got URL: $_" }; sub get-urls($url) { gather { take $url; $url.chars > 1 and (.take for get-urls $url.chop) } }; await get-urls("meows").Supply.throttle: 3, {$c.send: $_}; $c.done 19:34
camelia (timeout)Got URL: meows
Zoffix Weird that it hangs if you erroneously call .done instead of .close on a channel, eh?
m: (my Channel $c .= new).Supply.tap: { say "Got URL: $_" }; sub get-urls($url) { gather { take $url; $url.chars > 1 and (.take for get-urls $url.chop) } }; await get-urls("meows").Supply.throttle: 3, {$c.send: $_}; $c.close 19:35
:/
camelia (timeout)Got URL: meows
Zoffix I guess I'm doing something wrong. 'cause this works locally
oh, ok, got it to hang
m: start react whenever (my Channel $c .= new) { say "Got URL: $_" }; sub get-urls($url) { gather { take $url; $url.chars > 1 and (.take for get-urls $url.chop) } }; await get-urls("meows").Supply.throttle: 3, {$c.send: $_}; $c.close 19:36
camelia Got URL: meows
Got URL: meow
Got URL: meo
Got URL: me
Got URL: m
Zoffix Bowlslaw: this is what I was talking about ^ but I dunno if it's right, I'm a n00b
19:37 n1ge joined, n1ge left
Bowlslaw haha 19:38
yeah I was looking at reach whenever
i think jremelo suggested it last night 19:39
react*
19:39 mcmillhj joined
Zoffix Filed R#1974, just in case 19:40
synopsebot R#1974 [open]: github.com/rakudo/rakudo/issues/1974 [ASYNC] Async code hangs on occasion, possibly because of the bug in the program
19:42 Zoffix left
ecocode by any chance: has somebody put the perl6 documentation in an epub ? 19:44
19:44 mcmillhj left 19:52 n1ge joined 19:53 haj` joined
haj` gq reboot 19:53
19:53 haj` left 19:54 n1ge left, n1ge joined 19:56 mcmillhj joined, pmurias left 20:02 dct left
lizmat ecocode: there's one project to put all of the docs in one HTML file, so the epub should not be far away 20:03
jjmerelo would probably know more about it, or [Coke]
20:06 melezhik left 20:07 mr_ron joined, aindilis left 20:08 rindolf left, aindilis joined
ecocode github.com/perl6/doc/issues/1981 20:10
20:13 rindolf joined 20:17 reisinge joined 20:25 pmurias joined 20:32 reisinge left
buggable New CPAN upload: FindBin-0.1.4.tar.gz by LEMBARK modules.perl6.org/dist/FindBin:cpan:LEMBARK 20:34
20:58 pmurias left
buggable New CPAN upload: FindBin-0.1.5.tar.gz by LEMBARK modules.perl6.org/dist/FindBin:cpan:LEMBARK 21:14
New CPAN upload: FindBin-0.1.6.tar.gz by LEMBARK modules.perl6.org/dist/FindBin:cpan:LEMBARK
21:17 perlpilot joined 21:25 mcmillhj left
tyil eh 21:25
that FindBin dist has a README for Pod::To::Markdown 21:26
21:32 __uzl joined, rindolf left 21:34 _uzl left 21:39 mcmillhj joined 21:43 mcmillhj left 21:48 mcmillhj joined
Bowlslaw Anyone here used Cro? 21:56
Also, can you set up the perl interpreter to be more like Haskell, in that you can load a file to it and import all of your symbols and use autocomplete on them, etc? 21:57
perlpilot Bowlslaw, I have used cro a little bit. 22:00
Bowlslaw What do you think? Pros and Cons?
perlpilot Bowlslaw, well .... I think cro is the most perl6ian way to do a web framework and it seems well suited to be more than just a web framework (but I haven't played with the other services yet) 22:02
22:03 Zoffix joined
perlpilot as far as cons ... I'm not sure. Maybe the documentation is a little opaque sometimes? i.e. it would be nice to have a quick reference 22:03
Zoffix ecocode: yeah, I got one from last October: temp.perl6.party/pub/2017/PSix-Doc...-2017.epub
ecocode: you could gen newer one from this file: docs.perl6.org/perl6.html with calibre 22:04
22:04 mr_ron left, mr_ron joined
Zoffix "Convert individually" and in "Table of Contents" use h1, h2, and h3 as selectors. And it should do the rest automagically 22:04
perlpilot Bowlslaw, btw, I don't know if you can setup the Perl 6 REPL to be more like Haskell. Loading a file doesn't seem too bad, but autocompleting the symbols might be a bit more work. 22:05
Zoffix Bowlslaw: you might be able to repurpose this code for that purpose: github.com/perl6/routine-map/blob/...p6#L64-L79 22:06
Bowlslaw: as for Cro. It's great. Tho I see it plugged as a Web Framework by many people, yet it's more a of microservices thing, to my eyes 22:07
Bowlslaw hmm
That's exciting.
timotimo more webappy stuff is on the way
including a perl6-y template system that currently exists as an experiment
Bowlslaw I think I need to write some more Perl 6 before I can meaningfully contribute to actually developing perl 6
Zoffix timotimo: awesome 22:08
timotimo github.com/jnthn/cro-webapp - aptly named
ah, actually, it's currently only the template system
Zoffix Bowlslaw: you can do both at the same time :) 22:09
perlpilot Bowlslaw, lots of people have contributed to developing Perl 6 and some of them have barely known what they were doing at the time (i.e. I've contributed some bits before ;-) 22:10
Zoffix Bowlslaw: there are tons of easy Issues to hack on: github.com/rakudo/rakudo/issues?q=...resolve%22
Bowlslaw Zoffix: ahha, yes
perlpilot I guess my i.e. was more of an e.g.
Bowlslaw alright guys, cya later 22:12
22:12 Bowlslaw left
Zoffix \o 22:12
22:12 Zoffix left 22:15 skids left, mcmillhj left 22:18 wamba left 22:30 mcmillhj joined 22:35 mcmillhj left 22:47 sena_kun left 22:48 MasterDuke joined 22:50 mcmillhj joined, natrys left
buggable New CPAN upload: Vroom-Reveal-0.0.2.tar.gz by JGOFF cpan.metacpan.org/authors/id/J/JG/...0.2.tar.gz 22:54
22:55 mcmillhj left 23:00 mr_ron left 23:10 raynold joined 23:20 turdmonkey joined, turdmonkey is now known as Bowlslaw
Bowlslaw Hello. 23:21
23:33 __uzl left, _uzl joined 23:36 subroot joined 23:42 mcmillhj joined 23:46 mcmillhj left
Bowlslaw Perl 6 is so weridly fun to code... 23:48
23:52 mcmillhj joined
hobbs that's our evil plan 23:53
23:56 mahafyi joined 23:57 mcmillhj left