🦋 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.
00:12 aborazmeh joined, aborazmeh left, aborazmeh joined 00:47 markoong left 00:58 leont joined 01:01 wamba left 01:15 wildtrees joined 01:24 nt80 left, wildtrees left 01:26 Redfoxmoon joined 01:33 upupbb-user2 left 01:49 Altai-man_ joined 01:52 sena_kun left 02:09 molaf left 02:15 sivoais left 02:18 upupbb-user2 joined 02:20 leont left 02:22 molaf joined 03:00 mowcat left 03:45 reach_satori left 03:50 sena_kun joined 03:52 Altai-man_ left
uzl[m] I've created the following section(?) (gist.github.com/uzluisf/7f575c7023...565b2db40) to complement the other section on the `handles` trait . I'm unsure if it meets the standard for the docs but if it does, I can submit a PR to include it. I was thinking it'd be a nice addition to the Objects page. 04:01
AFK
04:16 reach_satori joined 04:20 hungrydonkey left, hungrydonkey joined 04:29 upupbb-user2 left
[Coke] . 04:30
04:33 aborazmeh left 04:51 Actualeyes left, Actualeyes joined 05:50 Altai-man_ joined 05:52 sena_kun left 06:45 Actualeyes left, Actualeyes joined 06:52 ufobat joined 06:53 sauvin joined 06:57 SCHAPiE left 07:02 SCHAPiE joined 07:41 rindolf joined 07:47 gugod1 is now known as gugod 07:49 upupbb-user2 joined 07:51 sena_kun joined 07:52 Altai-man_ left 08:25 shadowpaste0 left 08:38 patrickb joined 08:46 shadowpaste joined 08:52 pecastro left 08:53 pecastro joined 08:58 PavelB joined 09:05 Redfoxmoon left, Redfoxmoon joined 09:19 ensamvarg left 09:20 vike left 09:24 vike joined 09:39 upupbb-user2 left 09:49 nightfrog left 09:50 Altai-man_ joined 09:53 sena_kun left 09:55 nightfrog joined 10:05 Black_Ribbon left 10:06 ensamvarg joined 10:08 reach_satori left, kent\n left 10:09 kent\n joined 10:19 xelxebar_ joined, xelxebar left 10:24 Doc_Holliwood left, reach_satori joined 10:27 andrzejku joined 10:39 leont joined 10:41 upupbb-user2 joined 10:46 tphilipp joined 10:49 tphilipp left 11:00 xelxebar_ left 11:03 xelxebar joined 11:08 PavelB left 11:10 andrzejku left 11:11 Nile joined 11:12 Nile left 11:15 wamba joined 11:22 andrzejku joined 11:23 markoong joined 11:34 mowcat joined 11:39 aborazmeh joined, aborazmeh left, aborazmeh joined 11:51 sena_kun joined 11:52 Altai-man_ left 11:58 xelxebar left 12:05 caterfxo left 12:07 caterfxo joined 12:16 hungryd8 joined, hungrydonkey left 12:17 markong joined, markoong left 12:22 hungryd8 left 12:23 xelxebar joined 12:32 andrzejku left 12:47 hungrydonkey joined 12:52 wamba left 12:58 Doc_Holliwood joined 12:59 andrzejku joined 13:00 wamba joined 13:03 aborazmeh left 13:11 upupbb-user2 left 13:14 lucasb joined 13:17 regreg left
synthmeat if FatRat is infectious, why does this break on line 6? gist.github.com/synthmeat/635fdda6...9b3ce81dd6 13:21
13:40 thundergnat joined
thundergnat synthmeat: As it is, it breaks because $_ is undefined. 13:41
tellable6 2020-02-08T20:06:22Z #raku <Doc_Holliwould> thundergnat: Ty, that is a nice way. I did not know about this function.
synthmeat thundergnat: ok, good catch, but even without it gist.github.com/synthmeat/635fdda6...9b3ce81dd6 13:45
thundergnat Yeah, there is something else going on there, I'm looking at it. 13:46
13:50 Altai-man_ joined
synthmeat it isn't infectious as exponent? 13:51
thundergnat synthmeat: Ok, that is a little unintuitive but yeah, FatRat exponents aren't infectious 13:52
13:52 sena_kun left
thundergnat Change it to: $sum += FatRat.new(1 , 2 ** $n++); and it works how I would expect 13:53
synthmeat yeah, that's what it says in the book. was just wondering why this wasn't working too. ty ^_^
thundergnat At first glance, I was quite puzzled too.
synthmeat doesn't even work when both base and exponent are fat rats 13:55
thundergnat Without going and digging around in the source, I suspect that exponentiation only has Num and Int candidates 13:56
synthmeat yeah, "The exponentiation operator coerces both arguments to Numeric and calculates the left-hand-side raised to the power of the right-hand side." 13:57
thundergnat If you want to operate on FatRats: github.com/SqrtNegInf/Rosettacode-...utines#L50 Lines 50-90 13:58
synthmeat nice. i'll give it a proper look once i'm up to speed with raku in general 14:00
14:29 andrzejku left 14:36 patrickb left 14:51 Doc_Holliwood left 14:56 Actualeyes left
synthmeat (quite some fun all this raku so far!) 15:10
15:18 Doc_Holliwood joined 15:29 wamba left 15:42 patrickb joined 15:51 sena_kun joined 15:52 Altai-man_ left 15:55 aborazmeh joined, aborazmeh left, aborazmeh joined 16:06 hungrydonkey left 16:07 hungrydonkey joined, hungrydonkey left 16:08 hungrydonkey joined, hungrydonkey left 16:14 wamba joined 16:21 TreyHarris joined 16:23 Doc_Holliwood left 16:27 aborazmeh left, cpan-raku left, cpan-raku joined, cpan-raku left, cpan-raku joined 16:32 benlittle joined 16:39 aborazmeh joined, aborazmeh left, aborazmeh joined 16:42 caterfxo is now known as Guest11420, Guest11420 left, caterfxo joined 16:43 lucasb left, markong left 16:44 markong joined 16:56 upupbb-user2 joined
benlittle p6: say "x" ~~ rx:r/ <-[-]>+ %% <.ws>+ (.*) /; 17:00
camelia (signal XCPU)
benlittle Any idea why that regex hangs?
leont Because <ws> can be zero width 17:01
benlittle Is there a canonical way to alternate whitespace without running into zero width issues? The only way I know of is to redefine the <ws> token 17:03
leont I think you want to use something other than <ws> 17:05
moritz you don't need to quantify <.ws> with a +
it matches more than one blank anyway
m: ' ' ~~ /<ws>/ and say $/.Str.chars
camelia 3
leont You probably want to use <.space>+
<.ws> is closer to <.space>* 17:06
moritz or \s+
leont Eh, yeah that's the more logical way to write that 17:07
benlittle Right on 😃 17:08
leont I remember being bitten exactly by this myself at some point, it's not entirely obvious
17:14 Skarsnik joined
Skarsnik Hello, what is the best way to compare data in a Buf inside test? when using just ok I get an error that it can't stringify one buf, but is-deeply fail when comparing Buf and Buf[uint8] 17:15
tellable6 2019-07-09T11:54:10Z #perl6 <timotimo> skarsnik: did you see that gumbo has probably been fixed?
Skarsnik July 2019, you are kinda late tellable6 ! 17:16
/using just ok/using just is/ 17:19
sena_kun Skarsnik, can you golf it a bit? 17:21
m: use Test; say is Buf.new(42), Buf[uint8].new(42);
camelia ok 1 -
True
17:22 margeas joined
Skarsnik let see 17:25
17:25 upupbb-user2 left 17:26 markong left
Skarsnik m: use Test; is Buf.new([0 xx 40]), Buf.new([1 xx 40]); 17:26
camelia not ok 1 -
# Failed test at <tmp> line 1
Cannot use a Buf as a string, but you called the Stringy method on it
in block at /home/camelia/rakudo-m-inst-2/share/perl6/core/sources/2D4A7CA10695CD2B374573413D261A660E282E2A (Test) line 188
in…
Skarsnik that what I get when the test fail instead of expected: blabla, got: claclalca 17:27
sena_kun oh, I see where I'm wrong
Geth ecosystem: 35308e509d | thundergnat++ (committed using GitHub Web editor) | META.list
Add String::Splice to the ecosystem

See github.com/thundergnat/String-Splice
17:28 caterfxo left, caterfxo joined
Skarsnik m: use Test; is Buf.new([0 xx 40]), Buf.new([0 xx 40]); 17:28
camelia ok 1 -
sena_kun Skarsnik, I'd convert it to Blob, to be honest
I think we have such tests in Cro
it isn't too pretty, of course
Skarsnik feel like Test/rakudo bug x) 17:29
sena_kun maybe Test should not attempt to use .Str, using .gist instead
Skarsnik ? Str look fine, just why it fail when data are not the same 17:30
sena_kun Skarsnik, no, I mean...
thundergnat Skarsnik: Do you get the same failure if you do a is-deeply() rather than is()? 17:31
sena_kun the thing is that when the comparing fails, it tries to show you expected/got message and apparently uses .Str method on Buf to stringify it, but Buf wants decode. Using .gist instead of .Str might be better, but I am not really pro.
Skarsnik, can you file a ticket, please? 17:32
Skarsnik is-deeply fail correcly, just it's annoying because my test data are from a file and slurp give me a buf8 and my data are Buf
17:32 domidumont joined
Skarsnik so it fails because type are not the same ^^ 17:32
thundergnat is() is really geared toward string comparisons, so things that aren't strings can fail in weird ways 17:33
Skarsnik m: say Buf.new(<1 2 3>).gist; say buf8.new(<1 2 3>); 17:34
camelia Buf:0x<01 02 03>
Buf[uint8]:0x<01 02 03>
Skarsnik sena_kun, it's in rakudo/rakudo issues to fill a ticket now?
17:35 Doc_Holliwood joined
sena_kun Skarsnik, yeah, github.com/rakudo/rakudo/issues 17:35
thundergnat m: open( $*IN, :bin); say .slurp;
camelia No such method 'slurp' for invocant of type 'Any'
in block <unit> at <tmp> line 1
rypervenche I've got a list of hashes. I want to do a for loop and loop through and create a string from each hash and then have that string end in a newline. I'd like to have the output of that for loop essentially be a string with one string on each line, each line ending in a new line and be put in a variable. How might I accomplish that? I can do it using my $var = do for... but I can only manage to get it
to work using "say", but it doesn't go into the variable.
sena_kun rypervenche, let's see... 17:36
rypervenche I can show what I have, so it might make more sense.
sena_kun m: my %a = a => 1, b => 2; my $str = %a.map({ "$_.key() is $_.value()" }).join("\n") ~ "\n"; say $str; 17:37
camelia a is 1
b is 2
sena_kun rypervenche, something like this?
Skarsnik sub buf-is {is $buf1.Str, $buf2.Str, $msg}; could that work? x) the issue is probably to redirect the error of the is to the line of buf-is
rypervenche Oh, I completely forgot about join. 17:38
sena_kun Skarsnik, no, this won't work, Buf are not .Str. And that's the issue with `is` you have.
leont has been planning a feature to do that redirecting, but hasn't gotten around to that
rypervenche I'm converting a really old db file, which is '| ' delimited to a \0-delimited one: gist.github.com/rypervenche/0834f7...d2b38f0744 17:39
I think join will do exactly what I need. I completely forgot about that.
sena_kun m: say Buf.new(1,2,3).Str;
camelia Cannot use a Buf as a string, but you called the Str method on it
in block <unit> at <tmp> line 1
Skarsnik duh
sena_kun m: use Test; ok Buf.new(1) eq Buf[uint8].new(1); ok Buf.new(0) eq Buf[uint8].new(1); 17:40
camelia ok 1 -
not ok 2 -
# Failed test at <tmp> line 1
sena_kun if you don't really care about what's the difference, you can do ^, otherwise a ticket (though even if there will be a fix, it means it'll have to go into a release and then be fresh enough and) 17:41
Skarsnik oh right, it compare with eq then fail to .Str to show what is wrong
sena_kun yesh
Skarsnik Not sure how to formulate the issue xD 17:44
sena_kun Skarsnik, "Buf comparing dies when using `is` Test subroutine" 17:45
Skarsnik, and then provide a sample of what's happening (you know, this "It compares ok, but dies in attempt to do .Str to provide failure message") and "It shouldn't die, instead should just mark this compare is nok". 17:46
Skarsnik Everytime I touch Raku I found some bugs/annoying behavior x 17:48
another bugs to report: the issue template should maybe be updated for raku xD it says * Compiler version (`perl6 -v`): 17:49
17:49 Altai-man_ joined
benlittle p6:grammar Test { token TOP { <x>+ % \h+ [\N*] \n } proto token x {*} token x:sym<A> { \S+ [\h \S+]* } token x:sym<B> { "[" <special-token> "]" <.ws> <important-message> } token special-token { "SPECIAL TOKEN" } token important-message { \S+ }}my $dat = q:to/EOF/;59.5 Some Term [SPECIAL TOKEN] Important!! Yet 17:50
another termEOFsay Test.parse($dat);
evalable6 (exit code 1) 04===SORRY!04=== Er…
benlittle, Full output: gist.github.com/f1824bcc7894f9b973...56be2854b0
17:51 markoong joined
rypervenche Nice. .join fixed my issue and I was able to do it all in my grammar's actions. :) 17:52
17:52 sena_kun left 17:54 aluaces left 17:55 margeas left
Skarsnik m: 'class A { method get-tab returns Array[A] {my A @t; @t.append(A.new); return @t} }; multi sub infix:<(elem)>(Str $stuff, A @d) { say "my infix" }; my $a = A.new; my @tab = $a.get-tab; say "foo" (elem) @tab;' 17:57
camelia WARNINGS for <tmp>:
Useless use of constant string "class A { method get-tab returns Array[A] {my A @t; @t.append(A.new); return @t} }; multi sub infix:<(elem)>(Str $stuff, A @d) { say \"my infix\" }; my $a = A.new; my @tab = $a.get-tab; say \"foo\"…
Skarsnik m: class A { method get-tab returns Array[A] {my A @t; @t.append(A.new); return @t} }; multi sub infix:<(elem)>(Str $stuff, A @d) { say "my infix" }; my $a = A.new; my @tab = $a.get-tab; say "foo" (elem) @tab;
camelia False
Skarsnik it's annoying to have to write my A @tab to have the right infix called. I know the compiler does not check method type to solve type 17:58
moritz that's the downside of using nominal types over structural types 18:01
Skarsnik maybe there should be a pragma to force the compiler to check method type and such, I am pretty sure 99% of code written by people does not compose much/change a class at run time x) 18:03
18:12 markong joined 18:14 aborazmeh left
Skarsnik 1..10 good enought for today x) 18:15
18:15 markoong left 18:16 rindolf left 18:28 margeas joined, markong left
Doc_Holliwood Any of you guys do work in Swift? 18:45
18:51 ufobat_ joined 18:53 aborazmeh joined, aborazmeh left, aborazmeh joined, cpan-raku left, cpan-raku joined, cpan-raku left, cpan-raku joined 18:54 wamba left 18:55 ufobat left 18:58 domidumont left 19:12 wildtrees joined, aborazmeh left 19:50 sena_kun joined 19:52 oneeggeach joined, Altai-man_ left 20:16 mowcat left 20:18 rindolf joined 20:19 sno left 20:21 sno joined 20:29 oneeggeach left 20:30 sivoais joined 20:31 oneeggeach joined 20:36 mowcat joined
rypervenche How might I supply a string to a command's STDIN using "run"? I've tried following the docs on run, but I haven't been able to find the right combination of things. 20:48
I'd like to do something like this: run «gpg -c -o "$new-encrypted-db"», :in($passwords); where $new-encrypted-db is the output file and $passwords is a string.
20:48 aborazmeh joined, aborazmeh left, aborazmeh joined 20:49 Doc_Holliwood left 20:58 Doc_Holliwood joined
leont If you specify :in, then the proc object will have an $proc.in member that you can write to 21:00
21:04 oneeggea_ joined 21:08 oneeggeach left 21:14 xelxebar left 21:15 xelxebar_ joined, aborazmeh left
rypervenche leont: Ahh, thank you. I understand it better now. I had to assign the Proc object(?) to a variable and then do $p.in.say: $passwords; and then $p.in.close; That did the trick :) 21:23
21:27 Skarsnik left 21:33 oneeggea_ left 21:35 rindolf left 21:50 Altai-man_ joined 21:52 sena_kun left 22:19 TeamBlast joined 22:21 xinming_ left 22:23 xinming_ joined 22:48 markoong joined, margeas left 22:59 markong joined 23:03 markoong left 23:08 xelxebar_ left 23:09 xelxebar joined 23:19 dustinm` left 23:31 dustinm` joined 23:37 dustinm` left 23:45 patrickb left 23:50 sena_kun joined 23:52 Altai-man_ left, ufobat_ left 23:56 dustinm` joined 23:58 Doc_Holliwood left