🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
Geth doc: 0rir++ created pull request #4081:
Simple typos, misphrasings, and punc
02:46
sienet_ja_LSD[m] hi, has someone experienced died with exception when trying to access webpages? I can put this www.nasdaqomxnordic.com/webproxy/Da...2018-12-14 into my firefox and I get an XML response back instantly, but with Cro the HTTP::Client get timeouts 05:21
fetching other websites seems to work though 05:26
with LWP::Simple it works similarly, just freezes and does nothing 05:41
Voldenet sienet_ja_LSD[m]: this address doesn't respond if you don't use proper browser headers - it needs User-Agent, Accept-Language and Connection headers to work 08:52
I bet it's some anti bot protection 08:53
sienet_ja_LSD[m] hmm ok, I have useragent but probly need those others too
sienet_ja_LSD[m] ok now with headers it fails: Malformed UTF-8 near byte 8b at line 1 col 2 09:58
Voldenet >my $resp = await Cro::HTTP::Client.get("…", user-agent => "Mozilla/5.0", headers => [Accept-Language => "en", Connection => "keep-alive", Accept => "*/*"]); 10:05
try this
I think using instance of the client will set `Connection: keep-alive` by default 10:07
Nope, they don't 10:08
sienet_ja_LSD[m] hmm now it's complaining about ampersands in the url 10:10
parameters aren't passed as they ought to 10:11
Voldenet cro.services/docs/reference/cro-ht...parameters 10:13
sienet_ja_LSD[m] nope, still malformed utf-8 10:23
Voldenet consider CRO_TRACE=1, then 10:25
tho this service sounds like a pain to work with
sienet_ja_LSD[m] perl5 works, but trying to use v5 errors No compiler available for Raku v5
I got it working with full headers 10:26
Voldenet don't be too surprised when they add js challenge to it :/
sienet_ja_LSD[m] maybe the output is actually non-utf8 although all fronts say that it is supposedly utf8 10:35
this says the same: use LWP::Simple; my %headers = ('User-Agent' => 'Mozilla/4.76 [en] (Win98; U)', 'Accept-Language' => 'en-US', 'Accept-Charset' => 'iso-8859-1,*,utf-8', 'Accept-Encoding' => 'gzip', 'Accept' => "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*"); my $content =
LWP::Simple.get('www.nasdaqomxnordic.com/webproxy/Da...18-12-14', %headers)
those same headers get an XML response with p5 10:37
so I guess use v5; doesn't work? or? 10:47
nine raku.land/cpan:NINE/Inline::Perl5 10:50
sienet_ja_LSD[m] ah thanks 10:52
Nemokosch hello 11:23
I have a process and I'm reading it's stdout
how can I make it not assume UTF-8 for text? 11:25
I'd need Latin-1 in particular
this seems to work actually: 11:29
$diff-proc.stdout(:bin).decode('iso-8859-1')
another one 12:12
I'm sure I've come across this but I don't remember the preferred solution
I want to get rid of _adjacent_ duplicates in a Positional 12:13
gfldex <@297037173541175296> you are looking for `.squish` 12:21
Nemokosch So this even has a name? Wow 😄 12:23
Thank you
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2022/06/06/2022-...y-release/ 12:42
Nemokosch I noticed a mistake 12:46
> But you can also use a zen slice and the :v adverb:
The example does not contain zen slicing, according to the docs
"Zen slicing is different from passing a Whatever-star (which, like a normal slice, always returns a List of elements no matter the type of the original object) or an empty list (which returns an empty slice):" 12:48
Voldenet zen slice would still work though, right? 12:50
m: my @a; @a[3] = 42; @a[5] = 666; say @a[]:v;
camelia (42 666)
Nemokosch seems like that 12:53
Voldenet btw, in the example whatever-star also returns list 12:58
gfldex m: multi sub infix:<M>(\l, \r) { l.tail eqv r ?? l !! slip(l,r) }; multi sub infix:<M>(\l, Mu:U \r) { l }; my @a = <a a b c c d e e e>; my \foo = lazy gather for @a -> $l, $r? { take $l M $r }; dd [M] <a a b c c d e e e>; 13:02
camelia slip("a", "b", "c", "d", "e")
gfldex <@297037173541175296> if you use operators (or inline a block), you can even get lazy.
Nemokosch oh right, I tried to do something like this but apparently messed it up 13:04
is not defined @var also not a thing? 14:45
😩 14:46
marcel_ m: say 3; 15:07
camelia 3
systems hi 16:14
which two folders in should add to my path on windows
C:\rakudo\bin is one
which is the other
while installing i unchecked this step, thinking i was upgrading, so no need to clutter the path, but it seem i still need to add them 16:15
found it i think C:\rakudo\share\perl6\site\bin 16:18
ugexe m: say CompUnit::RepositoryRegistry.repository-for-name(q|site|).prefix.add(q|bin|).absolute 16:21
camelia /home/camelia/rakudo-m-inst-1/share/perl6/site/bin
ugexe you can run that to get the PATH where module bin scripts are typically installed 16:22
systems thanks 16:24
sienet_ja_LSD[m] how would I create a 2dimensional matrix row by row? append flattens it 17:26
m: my @a = [[rand xx 2] xx 3]; say @a; 17:27
camelia [[0.13418002515610716 0.6678566564232125] [0.19015445598582792 0.7429061642968087] [0.325871474624009 0.09065142650269675]]
sienet_ja_LSD[m] like that
but I'm extracting it from xml
xinming SmokeMachine: Seems Red doesn't work well with 2022.06 version of raku 17:30
Voldenet m: my @a; @a.push([rand xx 2]) for ^3; say @a; 17:32
camelia [[0.7651678791845333 0.12262858201485227] [0.5144848317870481 0.46827779697223415] [0.6788642244410071 0.4080803165619924]]
Voldenet sienet_ja_LSD[m]: ^ this should work
sienet_ja_LSD[m] ah push, got it. thanks 17:33
drakonis github.com/sirherrbatka/vellum v. inspiring. 18:29
systems m: 9/99999999999999999999 18:43
camelia Unhandled exception: Cannot unbox 67 bit wide bigint into native integer
at gen/moar/Optimizer.nqp:3248 (/home/camelia/rakudo-m-inst-1/share/perl6/lib/Perl6/Optimizer.moarvm:)
from gen/moar/Optimizer.nqp:3223 (/home/camelia/rakudo-m-inst-1/s…
Unhandled exception: Cannot unbox 67 bit wide bigint into native integer
at gen/moar/Optimizer.nqp:3248 (/home/camelia/rakudo-m-inst-1/share/perl6/lib/Perl6/Optimizer.moarvm:)
from gen/moar/Optimizer.nqp:3223 (/home/camelia/rakudo-m-inst-1/s…
18:44
systems hmmm
m: 9/99999999999999999999e0
camelia ===SORRY!===
Cannot unbox 67 bit wide bigint into native integer
systems m: say 9/99999999999999999999e0 18:45
camelia 9e-20
systems m: say 9/99999999999999999999
camelia 0.00000000000000000009
systems m: say 9/999999999999999999999
camelia 9e-21
systems so what is the threshold for switching to scientific notation, and how can i enforce bignum
i can enforce scientific notation by prefixing with e0 18:46
sorry postfix
drakonis works fine here
each one of them works as expected 18:47
is camelia up to date?
systems what do you mean work fine
drakonis no errors nor unhandled exceptions here 18:48
systems yes, i think camelia, needs the say operator
it works fine on my pc as well 18:49
i am asking thought when does numbers switch to scientific notation using e0
and how can i enforce bignumbers
drakonis m: $*VM
camelia ( no output )
drakonis hm 18:50
m: $*RAKU
camelia ( no output )
drakonis m: say $*VM
camelia moar (2022.06)
systems m: say $*VM
camelia moar (2022.06)
drakonis oh its up to date huh
systems m: say $*RAKU
camelia Raku (6.d)
drakonis weird
systems whats weird, maybe this is how camelia is programmed 18:51
not a repl
systems m: my $x = 9/999999999999999999999 ; say $x 18:52
camelia 9e-21
systems m: my $x = $*RAKU ; say $x
camelia Raku (6.d)
SmokeMachine xinming: is it giving any error?
systems m: my $x = 9/999999999999999999999
camelia ( no output )
systems m: 9/999999999999999999999
camelia Unhandled exception: Cannot unbox 70 bit wide bigint into native integer
at gen/moar/Optimizer.nqp:3248 (/home/camelia/rakudo-m-inst-1/share/perl6/lib/Perl6/Optimizer.moarvm:)
from gen/moar/Optimizer.nqp:3223 (/home/camelia/rakudo-m-inst-1/s…
systems m: 9/99 18:53
camelia WARNINGS for <tmp>:
Useless use of "/" in expression "9/99" in sink context (line 1)
systems m: 9 / 99
camelia WARNINGS for <tmp>:
Useless use of "/" in expression "9 / 99" in sink context (line 1)
systems m: 9 * 99
camelia WARNINGS for <tmp>:
Useless use of "*" in expression "9 * 99" in sink context (line 1)
systems m: 9 * 99
camelia WARNINGS for <tmp>:
Useless use of "*" in expression "9 * 99" in sink context (line 1)
systems i guess, ppl expect more a repl like behavior, when camelia, seem to offer a script behavior 18:54
does raku have a slack or a discord 18:55
MasterDuke yes to discord at least 18:56
systems which channel to use on discord, its very confusing , too many channels 18:57
systems test 18:58
MasterDuke looks like you found it
systems yes
it too big
so many channels
systems test test 18:59
jdv vrurg: thanks. works. 19:28
drakonis thems some neat talks on tprc 19:56