[00:04] *** reportable6 left [00:05] *** reportable6 joined [00:13] elcaro: https://gfldex.wordpress.com/2020/10/26/planned-obsolescence/ [00:23] *** dextercd left [00:42] gfldex: yeah I knew about this, and used your module prior... but I thought it was only `postcircumfix:<{|| }>` ... not `postcircumfix:<[|| ]>` [00:43] when your blog post was published, I'm sure I tried using it on a matrix and it didn't work. maybe I'm wrong... or maybe it was fixed later. [00:56] elcaro: It can take a few weeks for PRs to make it into a release. [01:01] *** xinming joined [01:17] *** jgaz left [01:17] *** jgaz joined [01:23] *** swaggboi left [01:28] *** swaggboi joined [01:41] *** jgaz left [01:57] *** xinming left [02:02] *** frost joined [02:07] *** ggoebel left [02:15] *** xinming joined [02:17] gfldex: It was after the merge... more likely I forgot to use v6.e.PREVIEW before testing :/ [02:18] glad it's there, tho... seems I've been awaiting a feature that's been implemented for over a year :D [02:22] *** swaggboi left [02:36] *** swaggboi joined [02:50] *** swaggboi left [03:02] *** nine left [03:02] *** nine joined [03:03] *** swaggboi joined [03:50] *** gordonfish left [04:50] *** reportable6 left [04:50] *** shareable6 left [04:50] *** evalable6 left [04:50] *** notable6 left [04:50] *** unicodable6 left [04:50] *** linkable6 left [04:50] *** tellable6 left [04:50] *** statisfiable6 left [04:50] *** greppable6 left [04:50] *** bloatable6 left [04:50] *** committable6 left [04:50] *** coverable6 left [04:50] *** squashable6 left [04:50] *** sourceable6 left [04:50] *** nativecallable6 left [04:50] *** benchable6 left [04:50] *** quotable6 left [04:50] *** releasable6 left [04:50] *** bisectable6 left [04:51] *** committable6 joined [04:51] *** coverable6 joined [04:51] *** squashable6 joined [04:52] *** linkable6 joined [04:52] *** greppable6 joined [04:52] *** statisfiable6 joined [04:52] *** sourceable6 joined [04:52] *** unicodable6 joined [04:52] *** tellable6 joined [04:53] *** evalable6 joined [05:50] *** releasable6 joined [05:51] *** shareable6 joined [05:52] *** bisectable6 joined [05:53] *** nativecallable6 joined [06:08] *** squashable6 left [06:09] *** squashable6 joined [06:11] *** squashable6 left [06:12] *** squashable6 joined [06:34] *** mathias[m] left [06:52] *** benchable6 joined [06:52] *** bloatable6 joined [06:53] *** notable6 joined [07:05] *** reportable6 joined [07:29] *** seednode left [07:30] *** seednode joined [07:58] *** squashable6 left [08:00] *** squashable6 joined [08:07] *** abraxxa joined [08:13] *** abraxxa left [08:14] *** abraxxa joined [08:38] *** jjido joined [08:43] *** TheAthlete joined [09:35] *** Sgeo left [09:45] *** frost left [09:45] *** TheAthlete left [10:03] *** Skarsnik_ joined [10:40] How can i invoke a method from an object, when i have the method name as string in a var, like this: class A{method t(){say "t!!"}}; my $a = A.new(); my $m = 't'; $a.$m(); ? [10:40] *** mathias[m] joined [10:49] m: class A{method t(){say "t!!"}}; my $a = A.new(); my $m = 't'; $a.$m(); [10:49] rakudo-moar b5a71ab2a: OUTPUT: «No such method 'CALL-ME' for invocant of type 'Str'␤ in block at line 1␤␤» [10:49] m: class A{method t(){say "t!!"}}; my $a = A.new(); my $m = 't'; $a."$m"(); [10:49] rakudo-moar b5a71ab2a: OUTPUT: «t!!␤» [10:50] gfldex: super! :-) [10:54] i have to say, though, it's not intuitive [11:08] *** frost joined [11:08] *** ab5tract joined [11:15] *** TempIRCLogger left [11:37] *** squashable6 left [11:37] *** ggoebel joined [11:40] *** squashable6 joined [11:42] *** squashable6 left [11:49] *** Altai-man joined [12:02] *** TempIRCLogger joined [12:03] *** reportable6 left [12:04] *** reportable6 joined [12:12] *** Skarsnik_ left [12:31] *** TempIRCLogger left [12:31] *** TempIRCLogger joined [12:35] *** TempIRCLogger left [12:35] *** TempIRCLogger joined [12:35] *** Ergo444 joined [12:36] hi [12:36] where can I view the log of this channel? [12:36] https://logs.liz.nl/raku/live.html [12:44] *** squashable6 joined [12:48] *** ab5tract left [12:52] *** [Coke] left [12:59] *** [Coke] joined [12:59] *** jgaz joined [13:04] How can I successfully slurp in (or something) a latin1 encoded file when I don't happen to know the encoding? [13:04] slurp :encoding("latin1") ? [13:05] Yeah, but I don't know the encoding, it might be UTF-8 or latin1. [13:05] actually: :enc [13:05] Fair enough, still :) [13:06] then utf8-c8 as encoding perhaps ? [13:06] Hmm... I'll try-that. [13:08] Still complains of malformed UTF-8 :( [13:09] not suprising [13:10] I'd try to trap the exception, except that the data is coming from $*IN, so if it fails at first, I think the data is not available to try again, or is it? [13:12] Is there any way to get the raw $*IN contents into a variable and work from that? [13:13] *** TempIRCLogger left [13:13] *** TempIRCLogger joined [13:14] slurp(:bin) will give you a Bug [13:14] *Buf [13:14] Oh, okay, never worked with those, will read up on them. [13:14] Thanks. [13:18] *** TempIRCLogger left [13:18] *** TempIRCLogger joined [13:25] *** mscha joined [13:25] m: class Foo { rule foo { foo }; method bar($s) { dd $s ~~ // } }; Foo.new.bar('foo'); [13:25] rakudo-moar b5a71ab2a: OUTPUT: «No such method 'foo' for invocant of type 'Match'␤ in method bar at line 1␤ in block at line 1␤␤» [13:25] m: class Foo { my rule foo { foo }; method bar($s) { dd $s ~~ /<&foo>/ } }; Foo.new.bar('foo'); [13:25] rakudo-moar b5a71ab2a: OUTPUT: «Match.new(:orig("foo"), :from(0), :pos(3))␤» [13:27] Declaring a `rule` (or `token`, `regex`) is apparently legal outside of a Grammar, but is unusable as far as I can tell. Why isn't he first one a syntax error? [13:36] *** lizmat_ joined [13:37] *** frost left [13:37] *** [Coke] left [13:38] *** TempIRCLogger left [13:38] *** lizmat left [13:40] *** [Coke] joined [13:45] *** ab5tract joined [13:46] m: class A{method t(){say "t!!"}}; my $a = A.new(); my $m = 't'; $a.<<$m>>(); [13:46] rakudo-moar b5a71ab2a: OUTPUT: «Type A does not support associative indexing.␤ in block at line 1␤␤» [13:46] (was simply curious :) ) [13:51] *** lizmat_ left [13:51] *** lizmat joined [13:52] *** quotable6 joined [13:54] *** TempIRCLogger__ joined [13:54] *** TempIRCLogger__ left [13:58] *** TempIRCLogger joined [14:00] *** TempIRCLogger left [14:01] *** TempIRCLogger joined [14:03] *** TempIRCLogger left [14:03] *** TempIRCLogger joined [14:08] *** TempIRCLogger left [14:08] *** TempIRCLogger joined [14:08] *** habere-et-disper joined [14:10] *** TempIRCLogger left [14:10] *** TempIRCLogger joined [14:13] What is the recommended/idiomatic way to sort an array of arrays? [14:13] m: say sort [ [1,3,2], [5,4,6], [6,2,1] ].map: *.sort [14:13] rakudo-moar b5a71ab2a: OUTPUT: «((1 2 3) (1 2 6) (4 5 6))␤» [14:14] It seems we have to say sort twice? [14:14] what is the criterium to sort the lists on ? [14:14] Maybe that is a good compromise for composability? [14:14] *** TempIRCLogger left [14:14] *** abraxxa left [14:14] *** TempIRCLogger joined [14:16] lizmat ascending numerical order is fine [14:16] so you want to sort on the first element, if that's the same, sort on the next, etc ? [14:17] after having sorted all of the "sub" arrays ? [14:17] *** jjido left [14:17] Sort all the sub-arrays, then the top array. [14:17] Which I sort of think of as a default in this case? [14:18] well, I think it will stringify arrays and compare that [14:18] which is... suboptimal [14:20] okay, thanks. [14:25] Are we using the Edit Distance/Levenshtien algorithm to make suggestions? That would seem to automatically catch typos. [14:26] yes, we are, plus some specific suggestions [14:26] m: say "foo".length [14:26] rakudo-moar b5a71ab2a: OUTPUT: «No such method 'length' for invocant of type 'Str'. Did you mean any␤of these: 'chars', 'codes'?␤ in block at line 1␤␤» [14:28] Wow! Excellent. Thanks. [14:32] *** TempIRCLogger__ joined [14:32] *** lizmat_ joined [14:33] *** abraxxa joined [14:33] *** habere-et-disper left [14:34] *** TempIRCLogger left [14:34] *** lizmat left [14:35] *** lizmat_ left [14:35] *** lizmat joined [14:46] *** TempIRCLogger__ left [14:47] *** TempIRCLogger joined [14:49] *** mscha left [14:55] *** eseyman left [14:58] publishing modules to Zef with mi6 is now soooo easy. i have now published 8 there which were orig on cpan and will do more. [14:59] *** mcmillhj joined [14:59] if you haven't been using App::Mi6 for module management you have been missing the boat [15:00] *** Ergo4444 joined [15:00] *** Ergo4444 left [15:01] how can I empty a hash? [15:01] m: my %h; %h = {}; [15:01] rakudo-moar b5a71ab2a: OUTPUT: «Potential difficulties:␤ Useless use of hash composer on right side of hash assignment; did you mean := instead?␤ at :1␤ ------> 3my %h; %h = {}7⏏5;␤» [15:01] What is wrong in here? [15:03] m: my %h = :a, :b; say %h; %h = (); say %h [15:03] rakudo-moar b5a71ab2a: OUTPUT: «{a => True, b => True}␤{}␤» [15:03] m: my %h; %h = (); [15:03] rakudo-moar b5a71ab2a: ( no output ) [15:04] Maybe I am being dense and not understanding the documentation, but is there are there methods for adding and removing elements from sets? Or am I supposed to use the set operators for this? https://docs.raku.org/type/Set [15:04] "A Set is an immutable set" [15:04] "(For mutable sets, see SetHash instead.)" [15:05] *** eseyman joined [15:05] m: my %s is SetHash; %s.set: 1,2,3; dd %s [15:05] rakudo-moar b5a71ab2a: OUTPUT: «Too many positionals passed; expected 2 arguments but got 4␤ in block at line 1␤␤» [15:05] m: my %s is SetHash; %s.add: 1,2,3; dd %s [15:05] rakudo-moar b5a71ab2a: OUTPUT: «No such method 'add' for invocant of type 'SetHash'␤ in block at line 1␤␤» [15:05] hmmm [15:06] El_Che sorry, I did mean to link SetHash I have both tabs open :) [15:06] m: my %s is SetHash; %s.set: (1,2,3); dd %s [15:06] rakudo-moar b5a71ab2a: OUTPUT: «SetHash.new(2,1,3)␤» [15:06] lizmat okay, but to test for existence do I just `%s{}` ? [15:06] mcmillhj: indeed [15:07] m: my %s is SetHash; %s.set: (1,2,3); dd %s{1}; dd %s{0} [15:07] rakudo-moar b5a71ab2a: OUTPUT: «Bool::True␤Bool::False␤» [15:07] okay, great. I think I was just not understanding the documentation. Thanks all. [15:10] mcmillhj: then the documentation may need some love [15:11] El_Che I think it was more me being confused / not reading carefully. I was just kind of expecting an API like I have seen in other languages: .add, .has, etc... My bias isn't the docs fault though :) [15:13] mcmillhj: BagHashes have .add [15:13] hello what is wrong with this? [15:14] mcmillhj: SetHashes also have .unset [15:14] m: my %h; %h = {}; [15:14] rakudo-moar b5a71ab2a: OUTPUT: «Potential difficulties:␤ Useless use of hash composer on right side of hash assignment; did you mean := instead?␤ at :1␤ ------> 3my %h; %h = {}7⏏5;␤» [15:14] useless use? [15:14] it is not useless [15:14] Ergo444: so what do you think it should do ? [15:15] empty the hash [15:15] %h = () [15:15] will do that for you [15:15] what is wrong with {}? [15:15] well, its semantics are not clear [15:15] how so? [15:16] should it flatten or not ? [15:17] %h = () will reset an existing Hash object [15:17] %h := { } will re-bind the %h to a fresh (empty) Hash object [15:17] flatten? [15:17] Flatten what? [15:17] the right hand side of %h = } [15:18] the right hand side of %h = { } [15:18] there is nothing to flatten [15:18] yes there is, A Hash object [15:18] %h = { } [15:18] is effectively the same as: [15:18] %h = Hash.new [15:19] and? [15:22] How would an object be flattened? [15:23] I only know this term with lists. [15:23] What does it mean to flatten an object? [15:24] *** Sgeo joined [15:24] well, generally we talk about it in the context of arrays / hashes only [15:24] m: my @a = { :a, :b }; dd @a [15:24] rakudo-moar b5a71ab2a: OUTPUT: «Array @a = [:b(Bool::True), :a(Bool::True)]␤» [15:25] this flattened the hash into Pairs in the array [15:25] m: my @a = { :a, :b }, { :c, :d }; dd @a [15:25] rakudo-moar b5a71ab2a: OUTPUT: «Array @a = [{:a(Bool::True), :b(Bool::True)}, {:c(Bool::True), :d(Bool::True)}]␤» [15:25] this did not, because of the single argument rule [15:33] *** euandreh left [15:35] *** mcmillhj left [15:35] *** euandreh joined [15:38] *** Geth left [15:38] *** Geth joined [15:40] *** TempIRCLogger left [15:40] *** TempIRCLogger joined [16:07] What is the single assignment rule? [16:08] *** mcmillhj joined [16:09] single argument rule [16:10] m: my @a = ^5; for @a { dd $_ } [16:10] rakudo-moar b5a71ab2a: OUTPUT: «Int @a = 0␤Int @a = 1␤Int @a = 2␤Int @a = 3␤Int @a = 4␤» [16:10] note that this flattened the array in the for loop [16:10] m: my @a = ^5; for @a, @a { dd $_ } [16:10] rakudo-moar b5a71ab2a: OUTPUT: «Array @a = [0, 1, 2, 3, 4]␤Array @a = [0, 1, 2, 3, 4]␤» [16:10] note that this did not, because the for loop got more than 1 argument [16:11] *** dextercd joined [16:26] *** Altai-man left [16:29] *** Altai-man joined [16:34] *** abraxxa left [16:34] *** Guest36 joined [16:34] Beat do raku [16:36] The single argument rule should arguably ( ;) ) be considered the lynch pin to understanding the somewhat odd corners of when to slip/flatten and when to not. IIRC this was basically how we came to "solve" the GLR (Great List Refactor). [16:37] which reminds me to ask a) how is TimToady these days?; and b) where is the butterfly book? :) [16:38] *** Guest36 left [17:04] *** lichtkind_ left [17:14] *** lichtkind joined [17:33] *** ab5tract left [17:34] *** mcmillhj left [17:36] *** Ergo444 left [17:44] *** ggoebel left [18:02] *** reportable6 left [18:09] *** abraxxa-home joined [18:20] *** Altai-man left [18:41] *** mcmillhj joined [19:01] *** djerius left [19:02] *** djerius joined [19:04] m: class Point { has Int $.x; has $.y; method find(SetHash[Point] %search-space) { return Nil; } }; my $p = Point.new(x => 0, y => 0); $p.find(SetHash.new); [19:04] rakudo-moar b5a71ab2a: OUTPUT: «Type check failed in binding to parameter '%search-space'; expected Associative[SetHash[Point]] but got SetHash (SetHash.new())␤ in method find at line 1␤ in block at line 1␤␤» [19:04] *** reportable6 joined [19:04] ^ what's the correct way to type the `find` function if I want to accept a `SetHash` of `Point` objects [19:10] m: class Point { has Int $.x; has $.y; method find(SetHash[Point] $search-space) { return Nil; } }; my $p = Point.new(x => 0, y => 0); $p.find(SetHash.new); [19:10] rakudo-moar b5a71ab2a: OUTPUT: «Type check failed in binding to parameter '$search-space'; expected SetHash[Point] but got SetHash (SetHash.new())␤ in method find at line 1␤ in block at line 1␤␤» [19:10] m: class Point { has Int $.x; has $.y; method find(SetHash[Point] $search-space) { return Nil; } }; my $p = Point.new(x => 0, y => 0); $p.find(SetHash[Point].new); [19:10] rakudo-moar b5a71ab2a: ( no output ) [19:11] mcmillhj ^^ [19:11] m: class Point { has Int $.x; has $.y; my constant SHP = SetHash[Point]; method find(SHP $search-space) { return Nil; } }; my $p = Point.new(x => 0, y => 0); $p.find(SHP.new); [19:11] rakudo-moar b5a71ab2a: OUTPUT: «5===SORRY!5=== Error while compiling ␤Undeclared name:␤ SHP used at line 1␤␤» [19:12] lizmat ty++ [19:12] m: class Point { has Int $.x; has $.y; our constant SHP = SetHash[Point]; method find(SHP $search-space) { return Nil; } }; my $p = Point.new(x => 0, y => 0); $p.find(SHP.new); [19:12] rakudo-moar b5a71ab2a: OUTPUT: «5===SORRY!5=== Error while compiling ␤Undeclared name:␤ SHP used at line 1␤␤» [19:13] m: class Point { ... }; our constant SHP = SetHash[Point]; class Point { has $.x; has $.y; method find(SHP $search-space) { return Nil; } }; my $p = Point.new(x => 0, y => 0); $p.find(SHP.new); [19:13] rakudo-moar b5a71ab2a: ( no output ) [19:13] oh nice, that looks a lot cleaner. Thank you. [19:15] *** jgaz left [19:16] mcmillhj: what is done there with class Point { ... } is called "stubbing the class" so that it is known, and only later actually filled in [19:17] lizmat I like it, it will let me rewrite my types in my domain [19:24] *** abraxxa-home left [20:01] *** Skarsnik_ joined [20:37] Is there a way to provide an initial value for `reduce` ? [20:43] this is typically the value that the argumentless call of the operator returns [20:43] *** tejr left [20:44] m: say &infix:<+>() [20:44] rakudo-moar b5a71ab2a: OUTPUT: «0␤» [20:44] m: say &infix:<*>() [20:44] rakudo-moar b5a71ab2a: OUTPUT: «1␤» [20:44] mcmillhj ^^ is that what you mean [20:44] ? [20:45] not exactly, I was thinking more like a foldl or foldr operation but when I can supply the initial value of the accumulator [20:45] I can paste my small example if that would make it more clear. [20:46] yes, please [20:47] *** tejr joined [20:49] Uploaded file: https://uploads.kiwiirc.com/files/12b32d29889ef4675576f60b27d7714e/pasted.txt [20:49] https://topaz.github.io/paste/#XQAAAQBmAgAAAAAAAAA5nUhjF2ndxP+pUCEMHFLnPEpRmKGo9ML0+AfaL9RoEpZyamtiBmGioYB0v5i54/Jt0xmTBQM3oY/zdiQMzBV463qpW8fc6LYOTfUxC4MTr2GOoaoL61lSttbE26e0UoYRTaBSaA0ktIO2LwOzIbUaj3k7YAi6TKEvAWmH4M3YlWcxXd3unFFSQykyQR0KZ5jZiJFvZv2P/2HSbFM1c8M2ZQCKhmNNfKQ61+SPGSt6p18kcQzkzbhpqC4IxLEUzGaH6nxrBtZRTRW/qGJp0EEjMMKDvUctNZE43+0TxaCF4mb [20:49] /9/TUj9S4YvpcEK6xYWPhCiPug5vxGfsTBgY= [20:54] maybe reduce is the wrong verb, it's more like aggregate in my case [20:58] perhaps something like this: [20:58] m: my %m is Map = "(", 1, "[", 2, q/{/, 3, "<", 4; my $current = "<"; say %m{$current} [20:58] rakudo-moar b5a71ab2a: OUTPUT: «4␤» [20:58] m: my %m is Map = "(", 1, "[", 2, q/{/, 3, "<", 4; my $current = "x"; say %m{$current} // 0 [20:58] rakudo-moar b5a71ab2a: OUTPUT: «0␤» [21:04] that could work, let me try that out. Thank you. [21:14] *** Geth left [21:14] *** Geth joined [21:19] *** gordonfish joined [21:37] *** mcmillhj left [21:48] what happened with this? https://docs.raku.org/language/modules#Distributing_modules [21:48] was fez removed for some reason? [21:51] <[Coke]> https://docs.raku.org/language/modules#Upload_your_module_to_zef_ecosystem ? [21:53] <[Coke]> don't see any recent changes to that bulleted list. [21:53] <[Coke]> last content change on that file is from Jul 31 2021 [21:53] <[Coke]> (and it doesn't seem to touch that section) - so probably not yet added. [22:01] *** jjido joined [22:55] *** MasterDuke left [22:56] *** summerisle is now known as eof [23:33] *** jjido left [23:48] *** dextercd left