🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Logs can be inspected at colabti.org/irclogger/irclogger_log/raku
Set by lizmat on 1 May 2021.
canbenshanlo Playing around with game of life in raku atm. How do i swap shaped arrays? This doesn't work: 00:06
m: my @a[3;3]; my @b[3;3]; (@a, @b) = (@b, @a)
camelia Index 3 for dimension 2 out of range (must be 0..2)
in block <unit> at <tmp> line 1
codesections Does [@a, @b] = [@b, @a] do what you want? 00:17
canbenshanlo doesn't seem to be swapping. is it only returning a newly allocated junk of mem? 00:26
canbenshanlo for ^steps { `my Bool @next[$dim; $dim];` ... @curr = @next; } works for now i guess 00:28
interesting that shaped arrays are so much slower than the manual indexing via $row * $dim + $col. Or maybe my fedora raku package is missing some of the shaped array optimization goodies i've been reading about in the weekly 00:31
newly allocated chunk* 00:34
raydiak bisectable6: my @a[1]; my @b[1]; @a = @b; dd @a 04:13
bisectable6 raydiak, Will bisect the whole range automagically because no endpoints were provided, hang tight
raydiak, Output on all releases: gist.github.com/992d291eff8557cba2...474c0e1edd
raydiak, Bisecting by output (old=2019.11 new=2020.01) because on both starting points the exit code is 1
raydiak, bisect log: gist.github.com/888e5e275505a170e1...4faf2943d6 04:14
raydiak, (2020-01-02) github.com/rakudo/rakudo/commit/62...ecef98b6dc
raydiak, Bisecting by exit code (old=2016.10 new=2016.11). Old exit code: 0
raydiak, bisect log: gist.github.com/e739b66f87cfe86a6d...083dc8ccc3
raydiak, (2016-11-09) github.com/rakudo/rakudo/commit/a1...69246719c6
raydiak, ⚠ New output detected, please review the results manually
raydiak, Output on all releases and bisected commits: gist.github.com/092a9a8aa6ab9d4985...625c0e33f8
cog_ #vscode 11:15
arf
stoned75 m: releases Int.^mro(:roles) 13:04
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
releases used at line 1. Did you mean 'reverse', 'repeated'?
stoned75 m: release Int.^mro() 13:05
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
release used at line 1. Did you mean 'reverse'?
stoned75 m: release say "hi"
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
release used at line 1. Did you mean 'reverse'?
stoned75 arf 13:06
commit: releases Int.^mro(:roles)
committable6 stoned75, gist.github.com/e49bd3f34fe24bef5d...a5ed0ac0bf
stoned75 commit: releases Int.^roles(:mro) 13:09
committable6 stoned75, gist.github.com/f45e5350faa893c4af...29f8aac9dd 13:10
tbrowder hi, i’m looking for a practical use for an enum in a signature to express a user’s desire for a particular option. the option should have a default. 15:56
i have written a sub with that use that works, but i see no real advantage over strings and regexes. 15:58
comments? (i’m away from home so i can’t yet show a gist of it). 15:59
lizmat m: $ r 'enum U <FOO BAR BAZ>; sub a(U $a = FOO) { dd $a }; a; a BAR; a 42
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3$7⏏5 r 'enum U <FOO BAR BAZ>; sub a(U $a = F
expecting any of:
infix
infix stopper
statement end
statement …
lizmat m: enum U <FOO BAR BAZ>; sub a(U $a = FOO) { dd $a }; a; a BAR; a 42
camelia U::FOO
U::BAR
Type check failed in binding to parameter '$a'; expected U but got Int (42)
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
lizmat it would give you a runtime error if you specify something wrong ? 16:00
Altreus That seems like the sort of error that needs repackaging for user display 16:06
Although all errors need repackaging for user display
Lest the user be not speaking of the English
tbrowder lizmat: thanks! 16:43
canbenshanlo is there something like .flat(1) in raku? what i'm currently doing: 17:24
m: say (((1,2,3), (4,5,6), (7,8,9))).flat.rotor(3) 17:25
camelia ((1 2 3) (4 5 6) (7 8 9))
tonyo m: say (((1,2,3), (4,5,6), (7,8,9))) 17:27
camelia ((1 2 3) (4 5 6) (7 8 9))
tonyo if you're just want it to flatten use a pipe 17:28
moon-child probably want (((1,2,3), (4,5,6), (7,8,9)),) 17:28
tonyo m: say (((1,2,3), (4,5,6), (7,8,9),),)
camelia (((1 2 3) (4 5 6) (7 8 9)))
tonyo m: say |(((1,2,3), (4,5,6), (7,8,9),),)
camelia ((1 2 3) (4 5 6) (7 8 9))
moon-child m: my @x = (((1,2,3), (4,5,6), (7,8,9)),); say @x; say @x.map(&slip) 17:29
camelia [((1 2 3) (4 5 6) (7 8 9))]
((1 2 3) (4 5 6) (7 8 9))
canbenshanlo seems to work. thanks a lot 17:31
moon-child it would be nice if deepmap took a max depth 17:50
codesections I haven't used it much, but would &tree be able to do that with the right arguments? 17:51
moon-child e.g. deepmapping over [[1], [[2, 3], [4, 5]], [[1], 1]] with depth 1 would apply separately to: [1], [2, 3], [4, 5], [[1], 1]
codesections: hmmm 17:53
I'm not sure how you would get 'back' out of the tree representation
tbrowder ref enums and signatures, besides the advantage of type-checking per lizmat above, i refound the cool way to use them is you can smart match without the // on the enum key as well as // on the key OR value. 17:56
let me try to demo.l.. 17:57
i'll post a gist, too much for m 18:00
gfldex tbrowder: multi sub MAIN(*@input, VideoType :t(:$videotype) = movie, Bool :$verbose) { 21:21
tbrowder: whereby enum VideoType <movie screencast>; 21:22
tbrowder gfldx: roger, thnx 21:23
gfldex tbrowder: in case you need more ideas, here is the whole script gist.github.com/gfldex/0497452da51...272e88be98 21:25
tbrowder ah, the given $videotype block shows exactly a cool way to use the enum, thanks 21:29
canbenshanlo is there a take-while-like method in raku? [3,5,1,2,3].take_while(&:odd?) => [3,5,1] 23:52
ugexe grep + unique 23:57
m: sub odd ($i) { $i !%% 2 }; say [3,5,1,2,3].grep(&odd).unique;
camelia (3 5 1)
canbenshanlo but this still evalutes the whole list, right? 23:59