[00:03] *** deoac left [00:13] *** habere-et-disper left [00:26] *** Kaiepi left [00:29] *** Kaiepi joined [01:00] habere-et-disper it's doing scalar-style assignment [01:01] m: my UInt ( $foo, @bar ) := ( 3, [14] ); say $foo, @bar; [01:01] rakudo-moar 17062c32f: OUTPUT: «3[14]␤» [01:01] binding works though [01:56] *** Kaiepi left [02:01] *** razetime joined [02:04] *** frost joined [03:03] *** frost left [03:05] *** frost joined [03:22] m: my @foo of Int = 33,44,'a'; [03:22] rakudo-moar 17062c32f: OUTPUT: «Type check failed in assignment to @foo; expected Int but got Str ("a")␤ in block at line 1␤␤» [03:22] m: my ( @foo of Int) = 33,44,'a' [03:22] rakudo-moar 17062c32f: ( no output ) [03:23] hmm my repl says this results in ([33 44 a]) [03:24] m: my (UInt $foo, @bar of UInt ) = ( 3, 14,15,'a' ) [03:24] rakudo-moar 17062c32f: ( no output ) [03:25] m: my (UInt $foo, @bar of UInt ) = ( 3, 14,15,'a' ); @bar.raku [03:25] rakudo-moar 17062c32f: ( no output ) [03:26] Again, my repl (2022.7) ends up with @bar containing an 'a' [03:26] jaguart: I can confirm that. And it's that the `of Foo` isn't applied [03:27] golfed: [03:27] m: my (@foo of Int) = 1,'a'; say @foo; say @foo.of [03:27] rakudo-moar 17062c32f: OUTPUT: «[1 a]␤(Mu)␤» [03:28] it works as expected with no brackets :o [03:32] The parentheses induce special handling, and certain attributes aren't be applied as a result [03:34] M: my (UInt @bar) = 1,2; @bar.raku [03:34] gives this in my repl: Array[].new(1, 2) [03:35] m: my UInt @bar = 1,2; @bar.raku [03:35] rakudo-moar 17062c32f: ( no output ) [03:35] gives: Array[UInt].new(1, 2) [03:38] m: my UInt @bar = 1,2; say @bar.raku [03:38] rakudo-moar 17062c32f: OUTPUT: «Array[UInt].new(1, 2)␤» [03:38] m: my (UInt @bar) = 1,2,'a'; say @bar.raku [03:38] rakudo-moar 17062c32f: OUTPUT: «Type check failed in assignment to @bar; expected but got Str ("a")␤ in block at line 1␤␤» [03:39] m: my (@bar of UInt) = 1,2,'a'; say @bar.raku [03:39] rakudo-moar 17062c32f: OUTPUT: «[1, 2, "a"]␤» [03:46] *** razetime left [04:32] *** razetime joined [04:53] *** Heptite left [05:50] *** frost left [06:02] *** razetime left [06:03] *** razetime joined [06:12] *** razetime left [06:12] *** razetime joined [07:26] *** Kaiepi joined [07:34] *** Kaiepi left [07:39] *** razetime left [07:39] *** razetime_ joined [07:45] *** razetime_ is now known as razetime [07:45] *** razetime left [07:45] *** razetime joined [07:46] *** habere-et-disper joined [07:48] *** Kaiepi joined [08:08] *** frost joined [08:18] *** razetime left [08:19] *** frost left [08:24] *** frost joined [09:12] *** dakkar joined [09:31] *** codesections left [10:28] Hello, I was wondering whether there is a more Rakuish way of generating all subsequences in an array. The function .combinations gets close, but I did not succeed in finding a correct usage. Here is my not-so-nice solution, any thoughts on how to make that more elegant? [10:28] m: [10:28] sub subsequences(@input){ [10:28] my $n = @input.elems(); [10:28] my @result; [10:28] for ^$n { [10:28] my $subseq_len = $_ + 1; [10:28] for ^$n -> $i { # start at every element of array [10:28] my @subsequenz; [10:28] @subsequenz.append(@input[$i]); [10:28] for 1..^$subseq_len -> $j { # add $subseq_len elements [10:28] @subsequenz.append(@input[$j]); [10:28] } [10:30] m: [10:30] sub subsequences(@input){ [10:30] my $n = @input.elems(); [10:30] my @result; [10:30] for ^$n { [10:30] my $subseq_len = $\_ + 1; [10:30] for ^$n -> $i { # start at every element of array [10:30] my @subsequenz; [10:30] @subsequenz.append(@input[$i]); [10:30] for 1..^$subseq_len -> $j { # add $subseq_len elements [10:30] @subsequenz.append(@input[$j]); [10:30] } [10:31] please post code in a gist [10:36] How do I post code in a gist? [10:40] hello rcmlz i think they mean https://gist.github.com/ or https://pastebin.com/ or https://hastebin.com/ kind of things [10:40] hello rcmlz i think they mean https://gist.github.com/ or https://pastebin.com/ or https://hastebin.com/ kind of things [10:40] https://gist.github.com/rcmlz/5c33ae1a2cd2d60f6bb616b23c7a1c14 [10:40] because the message is from IRC bridge and not sure how multiple line code blocks are seen there [10:42] <@836605577400549436> Thank you. I was reading gist() in Raku and did not get it. Now it is clear. [10:46] *** rcmlz joined [10:52] I logged in to IRC to see what a mess I created there by pasting so much code ... [10:53] https://irclogs.raku.org/raku-beginner/live.html shows me, that indeed it became unreadable. Sorry, I did not know that. Will use gist in the future. [10:53] thank you :-) [10:53] sorry for being a bit grumpy in the early morning [10:54] *** frost left [10:56] looking at the gist, feels like lines 9-11 can be simplified to: [10:56] @subsequenz.append(@input[1..^$subseq_len]); [10:57] Hello, I was wondering whether there is a more Rakuish way of generating all subsequences in an array. The function .combinations gets close, but I did not succeed in finding a correct usage. Here is my not-so-nice solution, any thoughts on how to make that more elegant? [10:57] https://gist.github.com/rcmlz/5c33ae1a2cd2d60f6bb616b23c7a1c14 [10:57] I see that you want to return a Set at the end [10:58] perhaps https://docs.raku.org/type/SetHash#method_set could be of use ? [10:58] so not create an array, but create a SetHash [10:59] No, Set or Array does not matter [10:59] if you really want to return an immutable Set, you could coerce it to a Set on line 15 [10:59] array, list, set - anything I can later itterate over is fine [11:29] lizmat : indeed, using the range saved me one loop. https://gist.github.com/rcmlz/3e604059949f08c7ea1d6380265459a2 [11:30] *** frost joined [11:33] *** rcmlz left [11:48] *** habere-et-disper left [12:03] *** rcmlz joined [12:05] *** rcmlz left [12:19] *** frost left [12:28] *** rcmlz joined [12:43] *** rcmlz left [13:22] *** mahafyi joined [13:49] *** rcmlz joined [13:59] *** codesections joined [14:08] Inline::Perl will use only system installed version, or can allow for a perlbew verision also? [14:49] *** mahafyi left [15:02] *** codesections left [15:04] *** codesections joined [15:25] I developed two versions of a function that are doing the same. Is there a prefered way in Raku to compare the performance of them depending on the input size? https://gist.github.com/rcmlz/3e604059949f08c7ea1d6380265459a2 [15:27] How do you usually measure speed and memory usage of two alternatives? [15:33] *** razetime joined [16:22] *** razetime left [16:23] *** razetime joined [16:25] *** rcmlz left [16:28] *** rcmlz joined [16:29] *** Heptite joined [16:51] *** codesections left [16:51] *** codesections joined [17:07] *** codesections left [17:08] *** codesections joined [17:20] *** razetime left [17:26] *** rcmlz left [17:32] *** dakkar left [17:44] *** codesections left [17:45] *** codesections joined [18:02] *** mahafyi joined [19:13] rcmlz: there are a few Benchmark modules in the ecosystem. I've been using "Bench" lately. There's also Benchmark and Benchy. [19:13] .tell rcmlz there are a few Benchmark modules in the ecosystem. I've been using "Bench" lately. There's also Benchmark and Benchy. [20:06] *** codesections left [20:08] *** codesections joined [20:25] *** ToddAndMargo joined [20:25] *** ToddAndMargo left [20:25] *** ToddAndMargo joined [20:46] *** tirnanog joined [20:52] *** codesections left [20:52] *** codesections joined [20:59] *** ToddAndMargo left [21:00] *** codesections left [21:01] *** codesections joined [21:42] *** ToddAndMargo joined [22:21] *** codesections left [22:23] *** codesections joined [22:23] *** codesections left [22:24] *** codesections joined [22:24] *** codesections left [22:25] *** codesections joined [22:28] *** codesections left [22:28] *** codesections joined [22:31] *** ToddAndMargo left [22:48] *** bigfondue left [23:18] *** codesections left [23:19] *** codesections joined [23:29] *** Heptite left [23:33] *** Heptite joined [23:34] *** codesections left [23:35] *** codesections joined [23:53] *** codesections left [23:54] *** codesections joined [23:54] *** codesections left [23:55] *** codesections joined [23:56] *** codesections left [23:57] *** codesections joined [23:57] *** codesections left