🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
Voldenet m: my @h; @h.push: <d>, <b c>; @h.perl.say; my ($val, @list) := do given @h { when :($, @) { @h }; default { (Any, ()) } }; [$val, @list].perl.say 00:00
xinming_: ^ the above should work 00:01
Voldenet not sure if you can otherwise assign in destructuring signatures, it doesn't sound like something that should even be possible 00:04
stanrifkin i've got an linking error with rakudobrew 2020.01 "multiple definition of `cmp_tc'" 00:44
anybody got the same error as me? 00:45
elcaro how do i disable SSL verification in Cro 05:14
similar to `-k` in curl, or `$ua->insecure(1)` in Mojolicious
Voldenet elcaro: probably Cro::HTTP::Client.get("whatever", :ca(insecure => True)) 05:54
uh, `:ca(:insecure)`, even 05:57
Cro::HTTP::Client also has 'ca' property 06:01
s/property/attribute/ 06:02
stoned75 hi. can someone help me and tell me if this snippet is idiomatic enough ("rakuic" ?) ? Or how it can be made more idiomatic ? gist.github.com/stoned/66816a5c15b...07263b7825 06:44
the idea was to use Supply.first ;)
jmerelo stoned75: there's no such thing as idiomatic in Raku. TIMTOWTDI 06:49
stoned75: that one looks fine, really
stoned75 I was sure someone would say this ;)
jmerelo m: m: my @results = gather for 1..1 { ^10 .map: *.take }; say @results 06:50
m: my @results = gather for 1..1 { ^10 .map: *.take }; say @results
Camelia has stopped working...
stoned75 my @results = gather for Real { ^10 .map: *.take }; say @results 06:53
;)
SmokeMachine m: my Supply $s .= from-list: ^100 .roll x *; $s.first: *.is-prime; react whenever $s { .say } 07:41
:( no bots?! 07:42
jmerelo m: class Sunk { has $.titanic; method sink { say "Sinking $!titanic"; }}; Sunk.new( :titanic($_) ) for 1..3; 08:23
SmokeMachine: no bots
Geth doc/master: 4 commits pushed by (JJ Merelo)++ 08:51
cpan-raku New module released to CPAN! Math::Libgsl::Matrix (0.0.4) by 03FRITH 12:23
elcaro more cro struggles... client.get('/path/to/api?query=query+goes+here') works fine 12:50
but how can i pass the query normally. i've tried `query => { query => '...' }`
elcaro as well as `body` but i just keep getting 404 12:51
also, when i create a request, how can i see the stringified url it's sending? 12:52
jnthn You probably don't want a body with a GET request, though I think you'd want to pass a content-type for the body too if sending one 12:54
CRO_TRACE=1 in the environment will show you details of what it sends
I don't think there's a convenient way to form query strings yet, though Cro::Uri provides the way to do the percent encodingt. 12:55
elcaro i did have trace on, and the api reported back the value cannot be null, so i suspected the query wasn't getting passed 12:56
just to be clear, this works in mojolicious with `$ua->get($path => form => { query => '...' }) 12:57
api docs say it's a GET, with a query param
jnthn Yes, as noted, there's no better way to do it yet than putting together the query string yourself, using encode-percents on the parts. Please make an issue requesting it at github.com/croservices/cro-http/issues/new 12:58
elcaro ahh, sorry i missed that comment. ok, thanks... i will construct a Cro::Uri object manually 12:59
jnthn It really should be there (there's plenty of conveniences for getting query string parts on the server side...)
elcaro ok... i can raise an issue, but it just clocked midnight here, so it'll need to wait until tomorrow 13:00
thanks again
jnthn OK, thanks 13:01
I'm planning to spend some time on the HTTP client in the next week or so anyway, so can have a look at adding this too :) 13:02
Geth doc: 3e6270d197 | (Elizabeth Mattijsen)++ | doc/Type/Mu.pod6
Elaborate on the volatility of .WHERE values
13:10
linkable6 Link: docs.raku.org/type/Mu
cpan-raku New module released to CPAN! Math::Libgsl::Matrix (0.0.5) by 03FRITH 14:27
Coleoid Good morning - (my local offset) + (your local offset), #raku. 15:37
Coleoid I'm trying to use the newly announced rakubrew, had trouble, and failed to make contact via listed urls for CPAN or Github... 15:39
Coleoid Though a new search just found the repos on Github, so perhaps I have no question any longer. 15:40
Enjoy the day!
guifa Coleoid: if you get any problems, don’t hesitate to ask. We’re all on different TZs so someone will eventually be able to respond but sometimes might take a bit 15:41
guifa heads to $day-job
Coleoid Thanks, guifa. I just posted an issue in the right repo, so I think I'm good. Patrick Böker said right up front not to expect it to work right now, so I'm not fussed. 15:50
cpan-raku New module released to CPAN! Text::Utils (2.1.0) by 03TBROWDER 16:00
Kaiepi m: say "aa" ~~ / (<[abc]>) <!before $0> . / 16:13
m: say 1
blegh
is there a way i can ensure a capture group is not repeated? 16:14
ctilmes elcaro: URI::Template makes it easy to construct URIs, filling in variables and constructing queries, etc. 16:21
jnthn: ^
cpan-raku New module released to CPAN! Math::Libgsl::Matrix (0.0.6) by 03FRITH 16:47
Geth doc: Kaiepi++ created pull request #3217:
Reorganize and add Trait::Traced to the debugging programs page
17:03
SmokeMachine m: say "aa" ~~ / (<[abc]>) (.) <?{ $0 ne $1 }> / 17:30
Geth doc: 6d64be7ed6 | (Elizabeth Mattijsen)++ | doc/Language/faq.pod6
Mention Perl 6, fixes #3216
18:17
linkable6 Link: docs.raku.org/language/faq
linkable6 DOC#3216 [closed]: github.com/Raku/doc/issues/3216 [RFE][docs][easy to resolve] Mentions of Perl 6 in the docs were edited out a little TOO thoroughly
SmokeMachine I am testing my new asetniop keyboard... 18:24
I am spending too long to write anything... but it is cool 18:26
moritz imagines an actively cooled keyboard :D 18:32
lizmat moritz: do you know how and where camelia is supoosed to run ? 18:33
it's been awol for two days now :-(
moritz lizmat: it's supposed to be running on niner.name... and the weird thing is that it says it's running just fine 18:35
lizmat nine ^^ ?? :-)
moritz perlpunks.de/paste/show/5e4445c2.1f8b.f8 18:36
no idea why it doesn't actually connect 18:37
rypervenche How would a regex be affecting $/ in this context? I don't think I quite understand it. docs.perl6.org/language/traps#Grammars 18:44
moritz rypervenche: a normal regex match like 'a' ~~ /a/ sets $/ to the resulting Match object 18:45
rypervenche Oooooh
moritz this is true everywhere, not just in action methods
rypervenche I completely overlooked that. That makes total sense now.
nine moritz: there's a weird issue with the VMs losing network. To be precise inbound packets get lost somehow. Rebooting the VM doesn't help, it's not any hardware offload, iptables or ebtables issue. A reboot of the host seems to be the only workaround. 18:51
Been traveling all day so I didn't dare to reboot. OTOH I still got ~ half an hour till my flight back home leaves... 18:52
moritz nine: interesting 19:00
nine m: "reboot went well".say 19:01
camelia reboot went well 19:02
lizmat whee!
nine++
moritz nine++ indeed 19:07
Geth doc/master: 5 commits pushed by (Ben Davies)++, (Juan Julián Merelo Guervós)++ 19:34
Doc_Holliwood weekly: www.perlmonks.org/?node_id=11112794 20:45
notable6 Doc_Holliwood, Noted! (weekly)
rypervenche Yay! I finally got my grammar working! It took me a while to figure out the issues with using regexes in an action, as well as the nested $matches. 20:59
I'm curious to know if I did anything horrible or inefficient in my phone-number method: gist.github.com/rypervenche/2a42fb...df93369d08 21:00
MasterDuke rypervenche: i don't see any glaring algorithmic inefficiencies. however, if you're looking to optimize, `$num .= substr(1) if $num.starts-with("9") and $num.chars == 11` might be faster than `$num = $num.flip.chop.flip if $num ~~ / ^ 9 \d ** 10 $ /` 21:31
rypervenche Oh! Thanks a lot. I knew there had to be something better. 21:32
MasterDuke since you already know that all the characters are numbers by the definition of the phone-number token
MasterDuke i'm not going to promise anything, you should measure both 21:33
and you could do the same with the following lines. e.g., `$num = "88850$num" if $num.starts-with("1" | "4") and $num.chars == 5` 21:35
rypervenche Ooh, I should be able to use $/ again in that case. 21:37
MasterDuke and if you want just one complicated line (and only if you know 1,4,5 are the only possible values for the leading character), `$num = "8885{ $num.starts-with("5") ?? "5" !! "0" }$num"` 21:40
but that's a questionable "optimization" 21:41
rypervenche That's lovely. I think I'll stick with the longer version since it's more understandable and extendable. 21:44
MasterDuke yep 21:45
rypervenche Still though, it's going to take me a while to start using the ternary operator. It's good to see more examples of how it can be used like this. 21:46
xinming_ What is the right way to do smart match on the $_ without using when? 22:13
Something like the m// for smart match.
lizmat .ACCEPTS ? 22:15
lizmat .ACCEPTS(foo) or foo.ACCEPTS($_) depending on what's where :-) 22:16
xinming_ Got it, thanks. will use .ACCEPTS 22:17
xinming_ m: my @h = <a>, <c d e>; given @h { when (Any, List) { "Value matched".say; }; default { "Not matched".say; }; }; @h.ACCEPTS(\(Str, List)).perl.say; 22:20
camelia Value matched
Bool::False
xinming_ hmm
m: my @h = <a>, <c d e>; given @h { when (Any, List) { "Value matched".say; }; default { "Not matched".say; }; }; :(Str, List).ACCEPTS(Any, List).perl.say;
camelia Value matched
Cannot resolve caller ACCEPTS(Signature:D: Any:U, List:U); none of these signatures match:
(Mu:U: \topic, *%_)
(Mu:U: Mu:U \topic, *%_)
(Any:D: Mu:D \a, *%_)
(Any:D: Mu:U, *%_ --> Bool::False)
(Any:U: \top…
xinming_ How do I match do the same with ACCEPTS for the when (Any, List) in this example please? 22:21
xinming_ I tried the @h.ACCEPTS(\(Any, List)); @h.ACCEPTS((Any, List),); none worked 22:25
xinming_ @h ~~ (Any, List) <--- In this example, How can we write it with the .ACCEPTS version? 22:27
lizmat hmmmm 22:36
xinming_ I got it.
m: (Any, List,).ACCEPTS(("5", <a b c>),).perl.say; 22:37
camelia Bool::True
lizmat xinming_++
stoned75 lizmat: hi. sorry for the log2 incorrect example and thanks for your fix 22:41
lizmat stoned75: yw
Voldenet Is there some nice way to turn binary stdin into Supply of Buf[uint8]? 22:59
what I'm doing now is: sub raw-stdin { my Supplier $s .= new; start { loop { my $buf = $*IN.read; last unless $buf; $s.emit($buf) }; $s.done }; $s };
Voldenet but do I really that thread? 23:00
jnthn $*IN.Supply(:bin) ?
Voldenet m: sub raw-stdin { my Supplier $s .= new; start { loop { my $buf = $*IN.read; last unless $buf; $s.emit($buf) }; $s.done }; $s }; react whenever raw-stdin() { .say } 23:02
camelia ( no output )
Voldenet hm
Voldenet apparently no, Supply only accepts buffer size 23:03
Voldenet $*IN = "/dev/stdin".IO.open(:bin); react whenever $*IN.Supply 23:05
Voldenet ah, `"-".IO.open(:bin);` doesn't actually open a file, so it's a better solution 23:19
m: "-".IO.open(:bin).close; react whenever $*IN.Supply { .say
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3close; react whenever $*IN.Supply { .say7⏏5<EOL>
expecting any of:
statement end
statement modifier
statement modifier loo…
Voldenet m: "-".IO.open(:bin).close; react whenever $*IN.Supply { .say }
camelia A react block:
in block <unit> at <tmp> line 1

Died because of the exception:
read bytes requires an object with REPR MVMOSHandle (got VMNull with REPR Null)
in block <unit> at <tmp> line 1
Voldenet …which means you can close $*IN without even touching it 23:20