🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:00 reportable6 left 00:03 reportable6 joined 00:30 derpydoo joined 01:03 lichtkind_ left 02:22 tea3po left, tea3po joined 02:23 teatwo joined 02:26 tea3po left 04:50 andinus joined 04:52 zara joined 04:55 andinus left 04:58 andinus joined 05:04 zara left 05:21 japhb joined 05:48 merp left 06:00 reportable6 left 06:01 reportable6 joined
Nemokosch those of you who were wary of Discord turned out to be right painfully soon: www.reddit.com/r/discordapp/commen...nvites_to/ 07:31
07:38 linkable6 left, evalable6 left 07:40 linkable6 joined 07:41 evalable6 joined 07:44 Sgeo left 08:09 emakei joined 08:26 jpn joined 08:33 sena_kun joined 09:17 samcv left 09:18 samcv joined
Geth Raku-Steering-Council/main: f821d74e24 | (Elizabeth Mattijsen)++ | 2 files
Announcement Richard Hainsworth joining the board
09:25
09:52 lichtkind_ joined 09:54 kaol joined 10:20 emakei left 10:24 jpn left 10:34 ab5tract joined 10:55 Manifest0 joined 11:00 euandreh joined
Anton Antonov Good to know! 11:47
12:00 reportable6 left, reportable6 joined 12:52 emakei joined 13:07 derpydoo left
[Coke] wow, I'm out of the loop, congrats to Richard! 13:22
lizmat well, with 5/6 RSC members at the Raku Core Summit, it was hardly any effort at all 13:23
and Richard was there as well, and was on the original ballot, and accepted the invitation, so there's that :-)
Nemokosch sounds like a good choice so Forza 13:30
14:15 jpn joined 14:21 teatwo left 14:22 teatwo joined 14:38 Sgeo joined 15:27 emakei left
tonyo . 15:38
tellable6 2023-06-07T23:45:31Z #raku <tbrowder__> tonyo: my suspicion is correct, the book's pseudo code is misleaading and my tests prove it. i'll update the repo in a minute.
tonyo ahh which book are you going through? 15:39
15:39 jpn left 16:39 notable6 left, unicodable6 left, reportable6 left, quotable6 left, benchable6 left, statisfiable6 left, greppable6 left, coverable6 left, committable6 left, bisectable6 left, evalable6 left 16:40 bisectable6 joined, benchable6 joined 16:41 quotable6 joined, coverable6 joined, unicodable6 joined, statisfiable6 joined, evalable6 joined, greppable6 joined 16:42 reportable6 joined, committable6 joined, notable6 joined
tbrowder__ well knock me down, *I* had the (nonlethal) bug. passed all my tests, but it wouldn't work for overlapping patterns. (book is refernced in the README: Intro to Algorithyms, 3e). see the updated module for all the gory details. 17:15
17:30 ab5tract left 18:00 reportable6 left 18:03 reportable6 joined 18:42 dogbert11 left 18:45 dogbert11 joined 19:26 dogbert17 joined
tbrowder__ module is "AlgorithmsIT" (IT for "Introduction to") 19:27
19:28 dogbert11 left 19:56 buffet left 20:36 dogbert11 joined, dogbert17 left
tbrowder__ finana 20:36
.tell finanalyst congratulations Richard 20:37
tellable6 tbrowder__, I'll pass your message to finanalyst
20:42 dogbert17 joined 20:44 dogbert11 left 20:59 dogbert17 left 21:08 dogbert17 joined 21:18 dogbert11 joined 21:20 dogbert17 left 21:26 dogbert17 joined 21:28 dogbert11 left, dogbert11 joined 21:31 dogbert17 left 21:33 jpn joined 21:35 dogbert11 left 21:53 jpn left 22:06 dogbert11 joined 22:16 dogbert11 left 22:26 dogbert11 joined 22:32 dogbert11 left 22:35 dogbert11 joined
Tirifto So apparently numeric operators operate (;D) separately from numeric context in Raku. I thought defining the method ‘Numeric’ would let me use the objects of a custom class in numeric comparisons, but it seems the less-than (<) operator requires the method Real instead, as it coerces its operands to Real. 22:45
In other words, if I want a custom class to be usable as (able to be coerced to) a number, I need to care about more than just the numeric context. 22:46
Is that correct? And if so, is there a complete interface the class should implement, perhaps documented somewhere? Or should I just check the behaviour of every operator I might want to use? 22:48
Just asking out of curiosity, for the most part. 22:49
avuserow Tirifto: I think you may just need to implement the Bridge method, and maybe claim that you implement the Real role. 23:21
m: class Foo {has Int $.data; method Bridge { $!data }}; my $f = Foo.new(:data(3)); say $f; $f++; say $f 23:22
camelia Foo.new(data => 3)
No such method 'succ' for invocant of type 'Foo'. Did you mean 'sum'?
in block <unit> at <tmp> line 1
avuserow m: class Foo {has Int $.data; method Bridge { $!data }}; my $f = Foo.new(:data(3)); say $f; say $f + 14; 23:23
camelia Foo.new(data => 3)
Cannot resolve caller Numeric(Foo:D: ); none of these signatures matches:
(Mu:U \v: *%_)
in block <unit> at <tmp> line 1
avuserow Let me look a bit, it's been a while
Tirifto Thank you. ^ ^ 23:25
23:35 evalable6 left, linkable6 left 23:36 evalable6 joined 23:38 derpydoo joined, linkable6 joined
avuserow m: class Foo does Real {has Int $.data; method Bridge { $!data }}; my $f = Foo.new(:data(3)); say $f; say $f + 14; say $f++; say $f 23:54
camelia 3
17
3
4
avuserow Tirifto: ^^
looks like the minimum viable number needs to implement the Real class, and then have a `Bridge` method that returns the numeric guts. everything else seems to just work 23:55
Tirifto Very interesting! :o Thank you, avuserow. 23:57
avuserow though, if you want `$f + $f` in that example to return an instance of Foo, then you will also need to implement your own `multi method infix:<+>(Foo $a, Foo $b) {...}` 23:58
m: class Foo does Real {has Int $.data; method Bridge { $!data }}; my $f = Foo.new(:data(3)); say $f.WHAT; say $f ~~ Foo; my $f2 = $f + $f; say $f2.WHAT; say $f2 ~~ Foo;
camelia (Foo)
True
(Int)
False
avuserow m: class Foo does Real {has Int $.data; method Bridge { $!data }; multi method infix:<+>(Foo $a, Foo $b) {Foo.new(:data($a + $b))}}; my $f = Foo.new(:data(3)); say $f.WHAT; say $f ~~ Foo; my $f2 = $f + $f; say $f2.WHAT; say $f2 ~~ Foo; 23:59
camelia (Foo)
True
(Int)
False
avuserow m: class Foo does Real {has Int $.data; method Bridge { $!data }; multi sub infix:<+>(Foo $a, Foo $b) {Foo.new(:data($a + $b))}}; my $f = Foo.new(:data(3)); say $f.WHAT; say $f ~~ Foo; my $f2 = $f + $f; say $f2.WHAT; say $f2 ~~ Foo;
camelia (Foo)
True
(Int)
False