🦋 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.
ben_m I wonder why there's no Unicode variant of the feed operator? ==> looks so ugly to me 00:00
00:15 BenGoldberg left, Ben_Goldberg joined, Ben_Goldberg is now known as BenGoldberg 00:34 rindolf left 00:43 argent0 left 00:52 pecastro left 00:55 aborazmeh joined, aborazmeh left, aborazmeh joined 00:59 aborazmeh left 01:32 argent0 joined
Xliff How can I get DBIish to insert a null? 01:45
Type objects seem to confuse it. 01:46
leont r: dd CallFrame().^coerce(val("1")) 02:02
camelia No such method 'WHICH' for invocant of type 'NQPMu'
in block <unit> at <tmp> line 1
Method 'coerce' not found for invocant of class 'Perl6::Metamodel::CoercionHOW'
in block <unit> at <tmp> line 1
leont That error makes no sense
It looks like coerce is returning a value that can't be dd()ed (or actually .raku()d) 02:06
Ah, seems the issue isn't coercion related, but calling CallFrame.new with a too high number gives a very confusing error 02:21
02:32 evalable6 left, linkable6 left 02:33 evalable6 joined, tejr left 02:34 linkable6 joined, holli__ left
Xliff Is there a phaser that is run even when you ^C out of a running program? 02:36
leont ^C typically sends a SIGINT
You can catch that 02:37
Xliff Yeah, but I want the same code to run at exit.
Ah well, I guess I'll sub it. leont++
rypervenche Actually, rakubrew.org's domain simply needs to be renewed. It expired at the DNS registrar, it seems. 02:55
03:04 Manifest0 left, tejr joined 03:05 tejr left 03:06 Manifest0 joined 03:07 tejr joined
leont What can possibly go wrong if someone hijacks that… 03:10
Grinnz i'm just imagining if someone domain squatted perlbew.pl with malicious intent... ugh 03:11
perlbrew.pl* 03:12
03:17 Kaiepi left 03:29 leont left 03:38 Ayoub left 04:07 _jrjsmrtn joined 04:08 __jrjsmrtn__ left 04:16 jmchael left 05:16 sourceable6 left, coverable6 left, shareable6 left, benchable6 left, releasable6 left, nativecallable6 left, bisectable6 left, notable6 left, evalable6 left, quotable6 left, squashable6 left, greppable6 left, tellable6 left, committable6 left, linkable6 left, bloatable6 left, statisfiable6 left, unicodable6 left, squashable6 joined, committable6 joined 05:17 tellable6 joined, notable6 joined, quotable6 joined, greppable6 joined, benchable6 joined, releasable6 joined, statisfiable6 joined, coverable6 joined 05:18 unicodable6 joined, nativecallable6 joined, shareable6 joined, bisectable6 joined 05:19 sourceable6 joined, linkable6 joined, bloatable6 joined, evalable6 joined 05:24 tejr left 05:25 tejr joined 05:27 orinthe left, orinthe joined 05:29 frost-lab joined 05:50 parabolize left 05:57 argent0 left 06:05 BenGoldberg left, xinming joined 06:09 xinming_ left 06:17 ensamvarg left 06:19 ensamvarg joined 06:47 stanrifkin joined
stanrifkin rakubrew.org still down 06:48
rakudoc still not working
06:49 cpan-raku left 06:50 cpan-raku joined, cpan-raku left, cpan-raku joined 06:51 defaultxr left 06:55 stanrifkin left, stanrifkin joined, xelxebar left 06:56 xelxebar joined 06:58 eattherich joined 07:08 stanrifkin left 07:42 defaultxr joined
Geth doc: 02b8c0d524 | (Stoned Elipot)++ (committed by Juan Julián Merelo Guervós) | doc/Type/Failure.pod6
Failure.handled() is rw
linkable6 Link: docs.raku.org/type/Failure
07:53 argent0 joined 07:54 argent0 left 08:16 Yunga joined 08:22 eattherich left 08:33 wamba joined 08:35 aborazmeh joined, aborazmeh left, aborazmeh joined 08:42 sena_kun joined 09:07 Altai-man joined 09:10 sena_kun left 09:33 Kaiepi joined 09:35 BenGoldberg joined 09:40 wamba left 09:50 wamba joined 09:51 aborazmeh left 10:06 sjm_uk joined 10:09 BenGoldberg left 10:30 stoned75 joined 10:38 sjm left, holli__ joined 10:54 aborazmeh joined, aborazmeh left, aborazmeh joined
Geth doc: a01d1fbe73 | (Stoned Elipot)++ | doc/Type/Failure.pod6
Add refs to lvalue and 'is rw' routine trait
linkable6 Link: docs.raku.org/type/Failure
11:11 JJAtria[m] left, CIAvash left 11:12 MitarashiDango[m left, AlexDaniel` left, ThaEwat left 11:13 matiaslina left, unclechu left 11:18 Sgeo left 11:22 aborazmeh left, stoned75 left 11:23 stoned75 joined 11:31 JJAtria[m] joined 11:32 CIAvash joined
notandinus m: sub t (Str $pass --> Int, Int) {} 11:37
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed return value (return constraints only allowed at the end of the signature)
at <tmp>:1
------> 3sub t (Str $pass --> Int7⏏5, Int) {}
notandinus whats wrong with that ^?
moritz two return values 11:38
if you do a return 1, 2 you are actually returning a List
11:40 unclechu joined, MitarashiDango[m joined
notandinus i see, if i want to return a list of exactly 2 elements & both being Int then what should be used? 11:40
Geth doc: 3bd691993c | (Stoned Elipot)++ | doc/Type/Failure.pod6
Examples rewrite

Make Failure.{Bool,defined} examples certainly repetitive, but more demonstrative and hopefully more readable.
linkable6 Link: docs.raku.org/type/Failure
11:44 matiaslina joined 11:45 AlexDaniel` joined 11:46 ThaEwat joined 11:51 xinming left, xinming joined 11:52 pecastro joined
Geth ecosystem: e986e87e64 | (Elizabeth Mattijsen)++ | ADOPTERS.md
Start keeping track of module adopters
12:02 asymptotically joined
notandinus or how do i return 2 Int the correct way? 12:03
lizmat notandinus: you mean, have it type checked that you did in fact return a list with 2 Ints ? 12:06
because returning 2 Ints is as easy as: "return 42,666" 12:07
notandinus lizmat: yeah i want it type checked 12:08
m: sub t (--> List) {} 12:09
camelia ( no output )
notandinus i changed it to ^
but say i want to make sure its returning 2 ints
lizmat you could start with: 12:12
my subset TwoInts of List where { .elems == 2 }; sub a(--> TwoInts) { 42,666 }
and build from there... there isn't any easy syntactic sugar in Raku for this (yet)
notandinus oh i see, i thought i was missing something. i think for now `List' will be fine. 12:13
thanks for ^
lizmat I was checking whether my Rake module could be helpful for that
and ran into what looks like a bug / oversight to make it easy to use for this type of thing 12:14
my idea was that you could say:
my TwoInts = Rake[Int,Int]; sub foo(--> TwoInts) { return TwoInts(42,666) } 12:15
but that won't work currently
notandinus hmm i see, Rake looks good, i'll check it
i see, also `:` is just for immutability right?
lizmat but please not that generally when you need to return more than two values of information
notandinus m: my $k := 1; $k =2 12:16
camelia Cannot assign to an immutable value
in block <unit> at <tmp> line 1
lizmat you're probably better off creating a class for it
:= is binding
notandinus i see, i haven't looked into class and oop things yet
lizmat when you bind a constant to a lexpad entry, it is immutable
until you bind it with something else
docs.raku.org/language/operators#i...g_operator 12:17
notandinus ah i see, thanks 12:18
masak .oO( := is binding, like a legal contract ) 12:22
oh, so a Rake is a tuple type 12:25
12:28 frost-lab left 12:57 jmchael joined 13:00 BenGoldberg joined 13:01 aluaces left, leont joined 13:02 aluaces joined
Geth doc: 85e7630336 | (Stoned Elipot)++ | doc/Type/Test.pod6
Add ref to testing document
linkable6 Link: docs.raku.org/type/Test
13:07 sena_kun joined 13:09 Altai-man left 13:34 BenGoldberg left 14:04 sjm joined 14:11 wamba left 14:12 aborazmeh joined, aborazmeh left, aborazmeh joined 14:22 sjm left 14:26 aborazmeh left 14:57 nige left, nige joined 15:02 nige left, nige joined 15:29 parabolize joined 15:43 oddp joined 15:58 aindilis left 16:00 CIAvash left 16:02 nige left, nige joined 16:07 nige left, nige joined 16:26 BenGoldberg joined 16:27 aborazmeh joined, aborazmeh left, aborazmeh joined
xinming m: my %x = :a1<a b>; my @h = (|%x<a> // Empty); @h.raku.say; 16:33
camelia [Any]
xinming what is the right way to return "Empty" list, when the value is not defined please? 16:34
m: my %x = :a1<a b>; my @h = (|%x<a> || Empty); @h.raku.say; 16:35
camelia [Any]
xinming m: my %x = :a1<a b>; my @h = (%x<a> ?? |%x<a> !! Empty); @h.raku.say; 16:36
camelia []
xinming the last one work as expected, But a bit tedious really.
stoned75 m: my %x is default(Empty) = :a1<a b>; my @h = |%x<a>; say @h; 16:40
camelia []
codesections yeah, I was about to suggest `is default` too. docs.raku.org/type/Variable#index-...is_default 16:41
16:43 sena_kun left
codesections (if you can't change the signature for %x and want similar behavior where you declare @h, you can do something like `my Any:D @h = |%x<a> // Empty;`) 16:46
16:48 mowcat joined 16:59 BenGoldberg left 17:09 mowcat left 17:13 jmerelo joined 17:21 aborazmeh left 17:24 Doc_Holliwould joined, holli__ left 17:43 RaycatWhoDat left 17:44 BenGoldberg joined
Geth doc: MorayJ self-unassigned "Regex and interpolation is a bit confusing" github.com/Raku/doc/issues/2230
287fe13012 | (Stoned Elipot)++ | doc/Type/Exception.pod6

Do not try if we want to CATCH.
17:50 aindilis joined 18:00 dataangel joined 18:08 wamba joined 18:09 jmcgnh joined 18:11 sjm joined 18:26 xinming left 18:27 xinming joined 18:38 sjm left 18:39 sjm joined 19:03 xinming left 19:04 xinming joined 19:11 onur joined 19:13 xinming left 19:14 xinming joined
ben_m Am I the only one who really dislikes the --> syntax for return types? Especially having it inside the parameter list 19:18
lizmat you can also use the "returns" trait 19:19
MasterDuke ben_m: there is also the `sub a($b) returns Int { ... }` syntax, though it's likely to be deprecated a long time from now
leont Or the of trait
lizmat sub a() returns Int { "bad" }; a
m: sub a() returns Int { "bad" }; a
camelia Type check failed for return value; expected Int but got Str ("bad")
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
lizmat the reason for --> is that you cannot specify the "returns" trait on blocks easily 19:20
m: my $a = --> Int { "bad" }; $a()
camelia 5===SORRY!5=== Error while compiling <tmp>
Prefix -- requires an argument, but no valid term found.
Did you mean -- to be an opening bracket for a declarator block?
at <tmp>:1
------> 3my $a = --7⏏5> Int { "bad" }; $a()
lizmat m: my $a = -> --> Int { "bad" }; $a()
camelia Type check failed for return value; expected Int but got Str ("bad")
in block <unit> at <tmp> line 1
lizmat my $a = --> Int { "bad" }; $a() # hmmm... this should probably be allowed as well? 19:21
ben_m sub f($a, $b --> Int) {} just parses weirdly in my head 19:22
MasterDuke i didn't like it as much either, but i've gotten used to it 19:24
19:27 onur left 19:36 nosqrt joined
lizmat I like it better because it can be used on subs, methods and blocks 19:36
19:37 sjm left
lizmat although the syntax with subs and methods might give you the idea that it is part of the signature of the sub/method, which it is **NOT** 19:37
19:40 jmerelo left 19:49 oddp left, guifa joined 19:51 sjm joined, sjm left 19:54 sjm joined 19:56 cognominal left 19:59 Sgeo joined 20:26 CAPTCHA_REQUIRED left 20:44 v_m_v joined
v_m_v Hello. I am trying to solve Euler problem with Raku (projecteuler.net/problem=12). My solution is really slow (pastebin.com/Drpq6Nsn). Can I somehow make it faster in Raku? 20:45
MasterDuke v_m_v: well, it's probably not the most expensive thing, but you're calling is-prime twice if the number is in fact prime 20:48
also, do you have to go up to `($number div 2)`, could it be `($number.sqrt.Int + 1)`? 20:50
20:53 xinming left, xinming joined 20:55 ggoebel_ left
MasterDuke v_m_v: oh, and you don't want to do `%hash<$candidate>`, that looks for the literal string '$candidate' in the hash. you want `%hash{$candidate}`, that actually looks for the value in the $candidate variable 20:56
i'd fix that first, otherwise your code won't be doing what you want it to 20:57
20:58 no-n joined 21:04 stoned75 left 21:05 xinming left, xinming joined 21:07 stoned75 joined 21:08 kensanata joined
linkable6 Link: docs.raku.org/type/Exception
21:14 chloekek joined
chloekek . 21:14
21:17 nige left 21:21 nige joined 21:25 nige left, nige joined 21:37 lucasb joined 21:44 nige left 21:48 kensanata left 21:49 xinming left 21:50 xinming joined 21:58 BenGoldberg left, Ben_Goldberg joined, Ben_Goldberg is now known as BenGoldberg 22:24 ggoebel_ joined 22:29 ggoebel_ left
v_m_v @MasterDuke: Thank you. 22:36
@MasterDuke: I have removed the "prime" checking (those numbers are quite big and most of them are not primes). I have also changed $number div 2 to $number.sqrt.Int + 1. It is a way faster now. Still Raku is not the faster programming language but it is awesome. 22:40
22:54 xinming left, xinming joined
guifa v_m_v: it will take time for speed to get to Raku, but it’s been making lots of improvements. Just think how slow JS was until Google, Mozilla, and Microsoft poured literal millions of dollars int work speeding it up 23:04
(and now it’s possible for JS code to be as fast or faster than C for some stuff because of the JIT engine) 23:05
23:06 chloekek left 23:13 guifa left 23:27 xinming left, xinming joined
timotimo our good friends on the discord server found out that [+] $foo gets translated directly to $foo.sum, which is wong when $foo contains a list of some kind, since [*] and others won't iterate because scalar 23:40
23:48 xinming left 23:51 xinming joined 23:53 ggoebel_ joined 23:56 asymptotically left 23:58 xinming left, xinming joined