»ö« 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.
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);
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
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.
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
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