🦋 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.
00:13 pecastro left 00:15 xelxebar left, tejr left 00:17 redhands_001 left
coldpress guifa: thanks again, that's very helpful. I just wish the Raku docs mentioned the more common term "scan", instead of "triangular reduce" 00:21
00:22 tejr joined, xelxebar joined 00:32 frost-lab joined
guifa never knew that it was called a scan until reading the article 01:00
I efinitely would have related scan with something else
01:01 guifa left 01:25 wamba left 01:26 wamba joined 01:30 lucasb left 01:37 BenGoldberg joined, klapperl_ joined 01:39 klapperl left 01:40 MasterDuke left 01:51 jmchael left 01:57 wamba left
coldpress guifa: fair enough 02:00
tellable6 coldpress, I'll pass your message to guifa
02:07 Black_Ribbon joined
tbrowder .tell jmerelo "you da man!" 02:16
tellable6 tbrowder, I'll pass your message to jmerelo
03:07 evalable6 left, linkable6 left, tellable6 left, tellable6 joined 03:10 linkable6 joined, evalable6 joined 03:28 leont left
moon-child m: print [\-] ^6 04:17
camelia 0 -1 -3 -6 -10 -15
04:22 maggotbrain joined 04:29 guifa2 joined
coldpress today's advent of raku is cute and I love it 04:48
05:29 evalable6 left, linkable6 left 05:31 linkable6 joined 05:32 evalable6 joined 05:35 jcallen left 05:36 hobbs left
notandinus oof raku is coming too much in my way today 05:36
how do i make a list mutable? 05:37
i'm taking it from a file with IO.lines.map(*.comb.cache)
it is a list within a list 05:38
05:39 jcallen joined 05:40 hobbs joined, hobbs left, hobbs joined 05:45 Ben_Goldberg joined, BenGoldberg left, Ben_Goldberg is now known as BenGoldberg 05:47 rindolf joined
notandinus i just added .Array to the map and it works fine 05:56
06:14 jmerelo joined
coldpress notandinus: are you doing AoC? 06:15
06:15 ufobat joined
guifa2 Lists are unmutable, Arrays are mutable. 06:15
tellable6 2020-12-11T02:00:53Z #raku <coldpress> guifa: fair enough
guifa2 coldpress: I kind of regret not giving my article thisyear more of a Christmas theme 06:24
But tbrowder++ for today's advent calendar post
notandinus coldpress: yeah 06:28
i feel i would've finished earlier if i knew about lists and arrays
guifa2 Basically, Lists/Maps are unmutables, and Arrays/Hashes are the mutable equivalents 06:29
(Lists/Maps also don't containerize, and that's technically the difference — if you add a scalar container to a List, that particular item *is* mutable) 06:30
06:53 aluaces joined
notandinus i see, i'll read up on it 06:58
coldpress: i'm andinus on advent-of-raku repository that you have 06:59
i have my own repo so i add solutions at once after a few days 07:00
07:02 BenGoldberg left, Ben_Goldberg joined, Ben_Goldberg is now known as BenGoldberg
notandinus is there a shorthand for "if $x and $x == 1" ? 07:04
coldpress notandinus: I'm wondering how mutable arrays solve today's AoC. I thought the solution requires immutable arrays
notandinus coldpress: you need to change the seat position to occupied/unoccupied right?
coldpress yes, but you need to change all of them at once 07:05
so mutating only one element in the array of seats will give you the wrong result
notandinus yeah, my solution is very messy. what i did was to copy the input in other array (@hi) and check if seat is occupied/unoccupied with @hi and reflect the changes in @input
^ loop this again till @hi eq @input 07:06
my part 2 is still running, been 7 minutes since i started it.
coldpress oh, right, the other array has to be mutable 07:07
jmerelo notandinus: Well, $x == 1 will do pretty much the same. You can precede it with "with $x" if you want.
tellable6 2020-12-10T23:23:36Z #raku <tbrowder> jmerelo the latest source is here: github.com/tbrowder/advent2020/blo...dvent.html
2020-12-10T23:25:14Z #raku <tbrowder> jmerelo same title: Santa Claus TWEAKs with a Class
2020-12-11T02:16:52Z #raku <tbrowder> jmerelo "you da man!"
coldpress just realized I have a huge performance penalty with a 2D array
notandinus jmerelo: how would you use it in postfix, like so "say 'hi' if $x and $x == 1"? 07:08
coldpress: i see, 2d array meaning @input[$y][$x] thing? 07:09
07:09 parabolize left
notandinus m: my $x; say 'hi' if $x == 1; 07:11
camelia Use of uninitialized value of type Any in numeric context
in block <unit> at <tmp> line 1
notandinus m: my $x; say 'hi' if $x and $x == 1;
camelia ( no output )
notandinus ^ this thing i want to shorten
07:22 guifa2 left, guifa2 joined
guifa2 'and' has an extremely low precedence 07:23
so you have
(say 'hi' if $x) and ($x == 1) 07:24
coldpress: lizmat improved performance on 2D arrays a lot if you're building from source -- 60x improvements I believe she said
notandinus ah i see, that's why it wasn't working 07:25
guifa2 && has higher
no-n and has low blood pressure
it needs to eat something salty
notandinus guifa2: what would be a better way to write:
m: say 'hi' if ($x and $x == 1) 07:26
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$x' is not declared
at <tmp>:1
------> 3say 'hi' if (7⏏5$x and $x == 1)
guifa2 m: my $x; say 'hi' if $x && $x == 1
camelia ( no output )
notandinus ^ yeah this, is there something that shortens 'if $x && $x == 1' to 'something $x == 1' ?
guifa2 Unfortuantely precedence of with is too high to use "if $x == 1 with $x" 07:29
If you're going to use it a lot
notandinus i see, i think i'll just use && then, i thought there will be something in base 07:30
issue is that you'll have to change the variable at 2 places
guifa2 sub infix:<=?=> (\a, \b) { a && a == b }; my $x; my $y = 1; say "hi" if $x =?= 1; say "hello" if $y =?= 1;
evalable6 hello
guifa2 is afk 07:32
notandinus i see, this is nice, thanks
jmerelo guifa2: cool 07:34
07:40 patrickb joined 07:52 sena_kun joined, webstrand left 07:54 domidumont joined 08:01 wamba joined 08:07 sjm_uk joined
coldpress guifa2: thanks for letting me know, I'll just do a 1D array for now 08:07
08:09 pecastro joined 08:11 stoned75 joined 08:14 pecastro left 08:24 Sgeo left 08:30 BenGoldberg left 08:32 BenGoldberg joined 08:35 stoned75 left 08:36 abraxxa left 08:37 abraxxa joined 08:51 stoned75 joined 09:06 BenGoldberg left 09:07 Altai-man joined 09:09 BenGoldberg joined 09:10 sena_kun left 09:11 pecastro joined
guifa2 notandinus: oh, I thought of another way you could do it 09:12
Can't believe I didn't think of it sooner
my $x; say "hi" if $x ~~ 1
m: my $x; say "hi" if $x ~~ 1; $x = 1; say "hi" if $x ~~ 1 09:13
camelia hi
notandinus guifa2: ah i see, that's nice thanks 09:14
guifa2 ~~ is the smartmatcher, the idea is each class will do what makes the most sense (not sure if you've come across it too much yet) 09:16
notandinus ~~ was discouraged in perl so i don't use it much 09:20
so @t ~~ @h will do what i want? 09:21
09:21 poga left
notandinus m: my @t = ^2; my @h = 0, 1, 2; say @t ~~ @h; 09:21
camelia False
notandinus m: my @t = ^2; my @h = ^2; say @t ~~ @h; 09:22
camelia True
notandinus m: my @t = ^2; my @h = 0, 1; say @t ~~ @h; 09:23
camelia True
notandinus m: my @t = ^2; my @h = 1,0; say @t ~~ @h;
camelia False
notandinus oh nice
i saw a literate programming article for raku with ob-raku, does anyone have a link for it? can't find it 09:25
ah i found it, was on raku-advent blog raku-advent.blog/2020/12/03/day-3-...with-raku/ 09:29
guifa2 notandinus: yeah, smartmatching definitely had some issues in perl 09:33
notandinus guifa2: will ~~ have speed penatly ? 09:35
guifa2 notandinus: probably minimal 09:36
it might involve a single extra method call
$a ~~ $b is the same as doing $b.ACCEPTS($a)
ACCEPTS(Any:D: Any:U) is, I believe always false 09:37
moon-child you can also use 09:38
m: my $x; say 'a' if $x eqv 3; $x = 3; print 'b' if $x eqv 3;
camelia b
guifa2 ACCEPTS(Numeric:D $a: Numeric:D $b) is probably just defined as { $a == $b }
moon-child which has the (arguable advantage that) 09:39
which has the (arguable) advantage that
m: say <a b c> ~~ 3, <a b c> eqv 3
camelia TrueFalse
09:41 BenGoldberg left
guifa2 moon-child++ 09:41
09:41 BenGoldberg joined
notandinus i see, i'll use eqv then, it also works on lists 09:44
m: say ^2
camelia ^2
notandinus m: my @t = ^2; my @p = ^2; say @t eqv @p
camelia True
moon-child m: say (^2).eager 09:46
camelia (0 1)
moon-child m: say (^2).eager eqv ^2 09:47
camelia False
moon-child gotta be careful
notandinus yeah it says that on docs, 09:49
m: say (^2).eager ~~ (^2)
camelia True
notandinus hmm i see
09:50 lizmat_ joined
moon-child you can also use eq, although if you're worried about performance that's probably an even worse idea 09:50
09:53 lizmat left 10:10 BenGoldberg left
notandinus is Int and int different? 10:31
i was reading this raku-advent.blog/2020/12/10/day-10...formances/ and they call int as Native type and Int as explicit object type, what's the difference?? 10:32
tadzik Int is an int in a scalar container, which allows you to modify it 10:41
(as in: modify its contents rather than reassign it) 10:42
...or something like that :P My Raku's a bit rusty these days, I may be messing something up
10:42 brtastic1 joined 10:45 brtastic1 is now known as brtastic 10:46 asymptotically joined 10:49 lizmat_ is now known as lizmat 10:56 literal_ is now known as literal
jmerelo tadzik notandinus int is a native container, which is mapped to the architecture int. Int is a Raku int, which has infinite precision. Both are containers, unlike the intxx, which don't, as tadzik says. 10:59
11:01 brtastic left
tadzik ah, I almost got it :P 11:02
lizmat except that native ints are only conceptual containers, they don't actually have a container, they're essentially just memory somewhere
with objects pointing to them 11:03
m: sub a(\a) { say a.VAR.name }; my $i = 42; a $i # a proper container with a name 11:06
camelia $i
lizmat m: sub a(\a) { say a.VAR.name }; my int $i = 42; a $i # NOT a container
camelia No such method 'name' for invocant of type 'Int'. Did you mean any of
these: 'base', 'none', 'note', 'Num'?
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
11:13 squashable6 left
jmerelo lizmat: ah. But a container by any other NAME... 11:14
11:14 squashable6 joined
jmerelo lizmat: sorry, couldn't help it. 11:14
coldpress damn, I think the biggest overhead in today's AoC is using functional programming to calculate the neighbors' indices 11:21
guifa2 Also, working with native ints can sometimes be tricky. I would recommend against using them unless you reach a point where speed is worth the extra trouble of strict typing and and dealing with some of the other oddities of native ints 11:33
11:37 guifa2 left
lizmat what guifa2 said 11:47
tbrowder hi, diff subject: wordpress, advent, Pod::To::HTML, question: 11:50
does anyone have a mustache template, css, etc. setup for Pod::To::HTML that would do nicely on the raku advent wordpress site? 11:53
11:53 ufobat_ joined 11:56 ufobat left 11:59 leont joined 12:00 cgfbee joined
notandinus coldpress: can you share your solution for today's AoC ? 12:14
12:20 abraxxa left 12:21 asymptotically left 12:24 asymptotically joined 12:26 Altai-man left, Altai-man joined 12:27 jmchael joined, squashable6 left 12:30 squashable6 joined 12:35 wamba left
tadzik I can show you mine, but it's in Rust :) 12:39
notandinus sure, i just want to see how others solved it, mine is too slow 12:44
12:47 orinthe9 joined 12:48 orinthe left, orinthe9 is now known as orinthe
notandinus will hashes be better for memoization ? 12:52
compared to arrays
12:52 frost-lab left
lizmat notandinus: if your lookup key can be in integer, then yes 13:03
notandinus i see, also how do i do the deepcopy thing?
tadzik notandinus: git.tadzik.net/tadzik/aoc2020/src/...n/day11.rs 13:05
I don't uses any sort of memoization in there, fwiw
the first two functions in there are the interesting bits
notandinus yeah i was talking about memoization in relation to yesterday's puzzle 13:06
tadzik I now see that I could actually refactor it to use raycasting in both cases, just shorter in the first
oh, I solved it in a very hacky way D:
git.tadzik.net/tadzik/aoc2020/src/...y10.rs#L33 13:07
13:08 sena_kun joined
[Coke] wonders what the origins of .rotor are. 13:09
13:10 Altai-man left
[Coke] m: say (1..50).rotor(1,2=>-1,3=>-2, :partial) 13:10
camelia ((1) (2 3) (3 4 5) (4) (5 6) (6 7 8) (7) (8 9) (9 10 11) (10) (11 12) (12 13 14) (13) (14 15) (15 16 17) (16) (17 18) (18 19 20) (19) (20 21) (21 22 23) (22) (23 24) (24 25 26) (25) (26 27) (27 28 29) (28) (29 30) (30 31 32) (31) (32 33) (33 34 35) (3…
lizmat [Coke]: you mean the name?
[Coke] name & functionality. first time I'd seen it was Raku 13:11
I find it a useful tool for solving certain types of problems, but never would have thought to put it in the toolbox. 13:12
is it from Enigma? 13:13
lizmat first commit mentioning " rotor" is a29614c54bb5e96
linkable6 (2015-04-23) github.com/rakudo/rakudo/commit/a29614c54b shim in .rotor(Pair) for transition to gapishness
lizmat well, that's an association that I have as well
(linking it to the Enigma machine)
13:18 sacomo joined 13:31 brtastic1 joined 13:34 brtastic1 is now known as brtastic 13:48 orinthe2 joined 13:49 orinthe left, orinthe2 is now known as orinthe
notandinus can i compile raku script like it does with the modules? 13:54
moritz last I tried it, you could compile it, but then couldn't run the result :/ 13:56
notandinus i see, i wanted to see how much faster it becomes 13:57
tadzik a common hack is putting it all in the module and just importing that in a file 14:07
the startup will get faster, but I don't think it will improve the actual runtime
14:09 brtastic left 14:19 Sgeo joined 14:21 brtastic joined 14:39 jmerelo left 14:42 codesect` joined 14:44 brtastic left, hal99999 joined 14:47 codesections left
notandinus how could i count the number of '#' characters in an array of arrays? 14:49
i know i could always loop over it, are there better ways? 14:50
14:51 orinthe4 joined
lizmat join them and then .comb('#').elems ? 14:51
14:51 cpan-raku left 14:52 cpan-raku joined, cpan-raku left, cpan-raku joined, orinthe left, orinthe4 is now known as orinthe
notandinus lizmat: thanks, direct .comb('#).elems also works fine 14:55
14:55 hal99999 left
notandinus m: my @a = (1, 3), (1, 2); say @a.comb(1).elems; 14:55
camelia 7
tadzik huh
notandinus m: my @a = (1, 3), (1, 2); say @a.comb(1)
camelia (1 3 1 2)
notandinus hmm 14:56
maybe it works fine with strings
lizmat notandinus: yeah, but that may actually get a warning in the future :)
notandinus m: my @a = ('#', 'l'), ('#'); say @a.comb('#').elems;
camelia 2
lizmat see: github.com/rakudo/rakudo/issues/4098
notandinus lizmat: i see, i'll join them before then
tadzik what's it doing with ints?
14:57 hal99999 joined
notandinus yeah what is it doing with ints? is it treating 1 as true or something? 14:57
lizmat it's stringifying the ints before applying the .comb
14:58 ggoebel left
notandinus m: my @a = (1, 3), (1, 2); say @a.comb('1') 14:58
camelia (1 1)
notandinus i see 14:59
what is RSC? 15:00
tyil Raku Steering Council
notandinus so it steers the way raku goes? 15:01
i see,nvm 15:02
tyil we discuss (and optionally vote) on things if the community can't reach concensus 15:03
notandinus i see, thanks 15:05
15:14 brtastic joined 15:17 brtastic left 15:18 brtastic joined
notandinus is 7% time spent of GC fine? 15:32
it says 1250 collections occured + 7 full collections 15:33
lizmat that feels... not very optimal 15:35
but it all really depends
15:41 parabolize joined
notandinus if there is an array that i declare on every subroutine call, should i make it a global var so that the over head of creating the array doesnt slow down my program? 15:43
the array is same for all function calls
or is there another way to do this? 15:44
tyil notandinus: there's always another way to do it :)
notandinus maybe this causes high GC calls thing
i see, how could i do it? global variables are bad right? 15:45
tyil I generally avoid them, yes
can you show your code?
tadzik a state variable may help you 15:46
those are probably smart enough to only be allocated once, for obvious reasons :) Though it probably wouldn't be a state per se in your case
notandinus here: it's AoC day-11 part 1, i'll add part 2 code later on
i see, i'll checkout state thing 15:47
tyil I presume you're talking about my @directions?
notandinus tyil: right
can that be causing high GC calls? 15:48
tyil yeah, iirc it's just making it `state @directions` to use a state variable instead, alternatively you can declare my @directions outside of the sub, and pass it as an argument
notandinus: I don't know the core well enough to make a statement on whether it'll improve the GC situation
lizmat if the @directions array is lexically visiible for the sub, you don't need to pass it as an argument 15:49
notandinus i see, thanks, i'll profile it again & see if there's any improvements 15:50
tyil lizmat: that would require it being a global variable here, right?
lizmat m: my @foo = ^10; sub a($value) { @foo.push($value) }; a 42; dd @foo
camelia Array @foo = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 42]
notandinus oh i see, thats nice
lizmat I would consider an "our" variable a global one, as it would be accessible from other scopes by name 15:51
notandinus but i'm writing the code under sub MAIN, does that change anything?
lizmat the above @foo is just a lexical at the "global" level if you will
but it could well be within another scope, as long as the sub lives inside that scope 15:52
tadzik if you don't want it to really be global then there's a Perl 5 trick that could come in handy...
lizmat m: { my @foo = ^10; sub a($value) { @foo.push($value) }; a 42; dd @foo }
camelia Array @foo = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 42]
notandinus red call frames = bad and green call frames = good right? talking about the profiler
lizmat yeah, read means unoptimized
tadzik m: { my @not-global; our sub foo { @not-global.gist.say } }; foo
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
foo used at line 1
tadzik oh, that's not a thing anymore? :(
notandinus ttm.sh/dCU.png and what is Scalar and BootHash here?
lizmat BOOThashes are the implicit *%_ that method calls have, usually 15:53
the Scalar allocations are just that: you seem to create a lot of variables
or elements in an array or hash :-) 15:54
notandinus i see, yeah i change it a lot of times, does that count too?
changing hash would be faster than changing array right?
ttm.sh/dCl.png 15:55
lizmat well, changing the value of an element in a hash requires a hash lookup
which is inherently more expensive than indexing into an array
tadzik indexing arrays may be one of the only things faster than indexing hashes ;)
notandinus i clicked on Scalar view allocations and it shows this ^, i'm not using any push statement
i see, 15:56
lizmat hmmm... odd... Array.push should optimize
notandinus is that push interal raku thing? because i'm not doing any pushing 15:58
lizmat ah?
tadzik you are growing your @changed array by adding things to it, which presumably does pushes under the hood
lizmat guess I do need to look at your code :)
tadzik I wonder if cloning it first and then editing it later would perform better
notandinus tyil: the state thing made the whole thing faster
tadzik: i'll test that 15:59
The profiled code ran for 410946.37ms. Of this, 36202.65ms were spent on garbage collection (that's 8.81%).
tadzik though it's probably not a continous blob in memory, so it may turn out similar
notandinus ^ state thing
The profiled code ran for 600864.29ms. Of this, 47310.08ms were spent on garbage collection (that's 7.87%).
without state thing ^
tadzik oh wow, it's taking its sweet time, innit
notandinus GC went from 1248 to 1220 16:00
lizmat notandinus: my Int ($x-max, $y-max) = (@seats[0].end, @seats.end); looks like dead code to me ?
notandinus lizmat: ah dead as in i should move it out of the loop right?
makes sense 16:01
lizmat you're setting $x-max and $y-max but not using it ?
notandinus i'm using it in line 15 and 18 16:02
lizmat I meant inside of adjecent-occupied sub
notandinus oh right that is dead for now, i think i added it for part 2 16:03
lizmat also: I would separate the x and Y directions into separate "global" arrays 16:04
actually, you know the size of the matrix, right ?
notandinus yeah, it's fixed
also, i just put it outside the subs to make it global right? 16:05
i did tha
lizmat yeah
you could actually think of using a 1 dim array for this
notandinus also just by doing the 'state' thing number of red frame calls decreased by half 16:06
lizmat: i see, i'lll checkout dim arrays
lizmat then the check for adjacentness would be a single integer value
and if you'd make the array allow for an empty slot at each side of the "line" 16:07
you wouldn't even need to test boundaries
16:08 brtastic left
notandinus hmm i searched for dim array in docs, didn't find it, can you link to what it is? 16:09
16:09 brtastic joined
tadzik I think lizmat means a one dimensional array: (1, 2, 3, 4, 5, 6) rather than ((1, 2, 3), (4, 5, 6)) 16:09
but then you need to calculate what your offsets need to be depending on the number of elements in each row 16:10
notandinus ah i see, yeah ^ 16:11
lizmat yeah, but they'd just depend on the dimensions
notandinus is there a way to get it 2 by 2?
tadzik 2 by 2?
notandinus lizmat: so you're saying i do it my @dimensions = ( -1, 0, -1, +1 ..) etc?
tadzik the element directly above would be offset by $row-length rather than by (0, -1) 16:12
notandinus tadzik: i mean if i can iterate over 2 elems of array instead of only 1 then i can make it a dim array
tadzik (if we're thinking about the same thing)
notandinus i get it, so you want me to make the whole thing dim array?
so i just remove the .comb thing? 16:13
makes sense
lizmat he... reminds me of the days I was working on a DoD maze :-) 16:14
notandinus whats DoD maze? 16:15
wow making it global array completed the thing in just 4m instead of 6min
i'll profile it to see what changed
lizmat basically a game where you walk around in a maze and encounter dragons and other monsters 16:16
notandinus ttm.sh/dCo.png
m6locks nethack ftw 16:17
notandinus this is allocations thing when i changed it to state ^
all red became green + yellow
lizmat yup, and you got rid of the dead code in the sub >
notandinus lizmat: i see, nice
tadzik notandinus: well, to be honest, I'm not sure if a 1-dim array (the 1 is crucial: all arrays have dimensions, your have two so far :)) would actually make it faster
it could be an interesting experiment thoughu :)
notandinus lizmat: dead code is there in this profile, next profile won't have dead code
i profiled this before you told me of that 16:18
tadzik: i see, i'll test it
m6locks 1 dim array of 8, the top 3, the one left, the one right, the bottom 3, then sum elements to see if >3 16:20
notandinus yeah i'll do that after this profile completes, 16:21
16:22 orinthe left
notandinus wait, does profiling slow down raku? 16:22
tadzik oooh, I thought you meant the entire thing as a one-dim array
notandinus without profiling it took 3 min, with it took 6min
tadzik I'm confused, I'll now shut up :D 16:23
notandinus: yeah, it does have an overhead
notandinus tadzik: yeah 1 dmin array of entire thing right?
tadzik it needs to spend some time counting all these stats :)
notandinus wait, i too understood that
tadzik notandinus: I'm not sure what's the idea anymore :D
notandinus m6locks: you mean 1 dmin array of the whole thing right?
tony-o .tell patrickb sent you an email
tellable6 tony-o, I'll pass your message to patrickb
16:25 cpan-raku left, cpan-raku joined, cpan-raku left, cpan-raku joined
m6locks notandinus: yes, if the whole thing is the 3x3 square to be checked 16:26
notandinus ok making @directions global made 1095 gc calls
red calls increased by a bit
16:26 orinthe joined
notandinus tadzik: see, it's the whole thing 16:26
m6locks: yeah that 16:27
however the overall frame calls decreased
hmm and allocations decreased by lot 16:28
i'll now implement 1 dim array thing
16:31 ufobat_ left 16:33 orinthe6 joined 16:35 orinthe left, orinthe6 is now known as orinthe 16:36 kensanata joined 16:47 jmerelo joined
notandinus ok i finally implemented 1 dim thing 16:51
here is the code: paste.debian.net/hidden/80478d0f/ 16:52
anything that should be changed on first glance?
woah the code is lot faster, it completed in 1m 23s 16:53
tadzik wow, nice :)
notandinus i'm profiling it now
codesect` is there a decent way to dwim in this code:
m: my @a[2;2] = (1,2;3,4); my @b[2;2] = (4,5;6,7); @a «+» @b # want [[5,7], [9,11]]
camelia Potential difficulties:
Useless use of «+» in sink context
at <tmp>:1
------> 3= (1,2;3,4); my @b[2;2] = (4,5;6,7); @a 7⏏5«+» @b # want [[5,7], [9,11]]
codesect` m: my @a[2;2] = (1,2;3,4); my @b[2;2] = (4,5;6,7); say @a «+» @b # want [[5,7], [9,11]]
camelia Type check failed in binding to parameter '@dims'; expected Positional but got Any (Any)
in block <unit> at <tmp> line 1
codesect` that is, to use «+» or similar to add each element of shaped arrays 16:54
tadzik notandinus: I wonder if passing arrays to adjacent-occupied() like you do isn't making a copy of them each time: probably a shallow copy, but still. It could give you some wins if you pass it, um, differently, but my raku knowledge eludes me now and I don't know what to suggest you 16:55
but from what I see, you only use @directions in adjacent-occupied(), not in MAIN(). So you could try making it global and using that global in the adjacent-occupied(), just to see if there'll be some savings 16:56
notandinus tadzik: to compute @directions, i need $row-length which is bound to MAIN sub
tadzik notandinus: oh, right
notandinus should i make both global?
tadzik well, you won't know the value until main runs :) 16:57
that's a silly idea after all
notandinus i see, yeah, can i make @directions global from whitin main sub?
tadzik but I don't remember the name or the syntax for this "pass by reference" thing that I have in mind, for the lack of a better term
well, you could define your own sub inside the main sub
notandinus oh wait, or should i just put adjacent-thigng in main sub?
tadzik and then it'll have access to its locals, yes
notandinus hah i'll do that then 16:58
tadzik not sure if it's worth it, but maybe worth trying :)