This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
00:03 jetchisel left
lizmat ++ to go fro False to True and -- to go from True to False 00:58
guifa_ m: sub toggle (Bool $b is rw) { $b = !$b }; my $a = True; toggle $a; say $a; 02:24
camelia False
02:50 razetime joined 03:41 razetime left 04:56 razetime joined 05:10 deoac left
Nemokosch m: my $a = True; $a ^^= True; say $a; 07:02
Come on...
> Note that the semantics of this operator may not be what you assume: infix ^^ flips to the first true value it finds and then flips to Nil forever after the second, no matter how many more true values there are. 07:11
b-but... why 07:13
anyway, I found a workaround for xor... 07:15
m: my Bool() $a = True; $a +^= True; say $a;
kjp The boolean exclusive-or operator is ?^, so "$a ?^= True" sdoes what you want. 07:16
Kaiepi i wasn't aware `^^` existed 07:17
...or that
i want to like `?&`/`?|` but
m:```
say 1 && say 2;
say 3 ?& say 4;
```
hold on a sec 07:19
oh right i need the shortcircuit
m:```
say 0 && say 2;
say 0 ?& say 4;
```
Nemokosch m: my $a = True; $a ?^= True; say $a;
kjp: nice, thank you
<@210313526928080896> Say always returns True iirc 07:25
Kaiepi ik that, the point's that `?&` isn't thunking the rhs like `&&` so `0 ?&` evaluates the rhs before shortcircuiting w/ a falsey lhs, unlike `&&` 07:29
Nemokosch oh right 07:31
but what is wrong with &&? 07:33
Kaiepi nothing
Nemokosch with ^^, there was something painfully obvious wrong
Kaiepi it's `?&` i'm annoyed by
Nemokosch okay but I'm trying to say that you don't need that operator badly
not even `True ^^ True` and `False ^^ False`yield the same result 07:34
I found this: stackoverflow.com/questions/968834...rt-circuit 07:35
I haven't actually checked but I suspected bitwise operators don't tend to short-circuit 07:36
let me assume OP is right about that 😄
Anyway... to be honest, it doesn't hurt if Raku sometimes respects widely accepted conventions... 07:39
"if it's not broken, don't fix it" 07:40
08:09 razetime left 08:31 razetime joined 09:13 frost joined 10:50 frost left 11:34 Wonner joined 11:35 Wonner left 14:34 deoac joined 14:38 jgaz joined 15:18 jgaz left 16:15 jgaz joined 16:22 jgaz left 17:45 razetime left
Anton Antonov Does anyone here have a favorite _long_ Raku post at StackOverflow ? 19:42
Does anyone here have a favorite and _long_ Raku post at StackOverflow ? 19:43
(Needed for testing...)