00:02 librasteve_ left 00:15 arkiuat joined 00:20 arkiuat left 00:24 halloy9957 joined 00:48 arkiuat joined 00:54 arkiuat left 00:58 halloy9957 left 01:14 arkiuat joined 01:19 arkiuat left 01:32 arkiuat joined
simon_sibl not quite sure to understand this Precedence issue with ! and :exists, perhaps you meant :!exists?, I understand the !exists but what about the ? at the end ? its like so but at the end ? 03:42
actually the ? isnt part of the syntax but of the sentence, my bad 😆 03:43
04:12 arkiuat left 04:16 arkiuat joined
ab5tract Ah, yeah, that message could definitely be approved. Even some quotes around the suggestion would help here 05:31
05:36 arkiuat left 06:04 arkiuat joined 06:09 arkiuat left 06:40 arkiuat joined 06:44 arkiuat left 07:14 arkiuat joined, DarthGandalf left 07:26 arkiuat left 07:50 arkiuat joined 07:54 librasteve_ joined 07:55 arkiuat left 08:17 arkiuat joined 08:22 arkiuat left 08:53 arkiuat joined 08:58 arkiuat left 09:10 arkiuat joined 09:15 arkiuat left 09:36 arkiuat joined 09:40 arkiuat left 10:10 arkiuat joined 10:15 arkiuat left 10:35 arkiuat joined 10:40 arkiuat left 11:09 arkiuat joined 11:13 arkiuat left 11:20 arkiuat joined 11:24 arkiuat left 11:52 arkiuat joined 11:57 arkiuat left 12:20 arkiuat joined 12:24 arkiuat left 12:46 arkiuat joined 12:51 arkiuat left 13:03 arkiuat joined 13:08 arkiuat left 13:21 arkiuat joined 14:31 swaggboi joined
antononcube What is the most elegant way to swap the values of two hashmap variables? This does not work: (%h1, %h2) = (%h2, %h1). 14:46
jubilatious1_98524 @antononcube does cas help? docs.raku.org/routine/cas 14:49
librasteve probably not (that's calling a specific assmebler instruction)
antononcube Yeah, I was hoping that there is a swap operator or, say. (%h1, %h2) .= reverse might work. 14:51
Didn't know about cas...
librasteve_ m: my $h1 = {:a(0), :b(1)}; my $h2 = {:c(2), :d(3)}; ($h1, $h2) = ($h2, $h1); say $h1; say $h2; 14:52
camelia {c => 2, d => 3}
{a => 0, b => 1}
librasteve_ I think your top idea works if the Hash s are in Scalar containers 14:53
would be better if there’s a clean way to itemize / deitemize (which there probably is, but I have to research it) 14:54
likely best approach it to use a Capture … so sub may be your friend 14:55
antononcube Yeah, I figured it works with $ sigiled variables. But I plan to use the swap over class members that already have % sigil. 14:58
nahita3882 what about :(%h, %g) := (%g, %h); 14:59
signature literal on the left hand side 15:01
librasteve @nahita3882 you are a star! 15:03
antononcube @nahita3882 Thank works! Thanks. 15:09
15:13 stanrifkin joined
.landyacht. Yeah, assignment is a little weird (for me sometimes unintuitive) when it comes to multiple assignment 15:38
Binding does what I would expect more, but it comes with some other consequences in terms of mutability which sometimes I don’t want 15:39
15:40 meadow joined
Basically assignment treats anything @ or % sigiled on the left hand side as slurpy which makes my @a = 1, 2; DWIM but not so much my (@a, @b) = (1, 2), (3, 4); 15:43
@a just slurps the whole LoL 15:44
15:46 human-blip left
Switch to binding and it DWIMs but then you can’t reassign either variable later 15:46
15:47 human-blip joined
Oh, you’re using a signature to get around that - that’s really nice 15:48
ah but that's only going to work when both are declared prior 15:50
or does it? No, it does work, wow
m: my :(@a, @b) := (1, 2), (3, 4); say "a: @a[] / b: @b[]"; 15:51
Raku eval a: 1 2 / b: 3 4
.landyacht. oh but you do still have the immutability problem 15:52
m: my :(@a, @b) := (1, 2), (3, 4); @a = 5, 6;
Raku eval Exit code: 1 Cannot modify an immutable Int (1) in block <unit> at main.raku line 1
.landyacht. the error message being... rather interesting
16:04 meadow left 16:09 meadow joined
arkiuat I was thinking about doing it the old-fashioned way, with a temp hash variable, and only then did it occur to me that swapping two entire hashes is an unusual thing to do 16:27
.landyacht. I would quite like some way to specify slurpiness when doing assignment, similar to how it works in signatures, though I know changing the default behavior now would probably destroy a lot of code… 16:36
17:49 meadow left
ab5tract The current error message does suggest using bind instead of assignment 17:53
m: my :(*@a) = [1,2],[6,7] 17:54
camelia ===SORRY!=== Error while compiling <tmp>
Cannot use assignment when declaring a variable via signature binding.
Did you mean to use binding? If so, use `:=` instead of `=`.
Or did you mean to use list assignment? If so, don't use `:(..…
ab5tract m: my :(*@a) := [1,2],[6,7]; dd @a
camelia [1, 2, 6, 7]
18:22 DarthGandalf joined 22:25 stanrifkin left 22:44 arkiuat left