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.
01:42 kjp left, razetime joined 01:51 MasterDuke joined 02:01 kjp joined 03:50 razetime left 03:51 razetime joined 04:14 razetime left 04:32 razetime joined 05:25 siavash joined 07:25 camelia left 07:47 ab5tract joined 07:48 camelia joined 07:52 siavash left 07:53 siavash joined 07:56 dakkar joined 07:59 ab5tract left 08:04 ab5tract joined 08:14 tea3po left, tea3po joined 08:24 ab5tract left 08:38 ab5tract joined 08:47 ab5tract left 08:50 razetime left 10:15 ab5tract joined 10:58 ab5tract left 11:16 ab5tract joined 11:37 ab5tract left 12:37 siavash left 13:21 ab5tract joined 13:49 ab5tract left 15:02 ab5tract joined 15:17 ab5tract left 15:29 ab5tract joined 15:39 ab5tract left 15:52 ab5tract joined 16:15 razetime joined 16:33 ab5tract left 16:34 dakkar left 17:42 razetime left 17:55 ab5tract joined 18:00 ab5tract left 18:24 ab5tract joined 18:39 ab5tract left
jgaz Apparently the precedence of = is too loose for the ?? ternary operator? Why is that? I was able to "fix" it with `<test> ?? ($foo = val) !! ($bar = val)`, but I'm not sure that's optimal either. 18:42
nemokosch isn't that the normal way? I can't think of a language where you'd need to write variable = (condition ? aValue : bValue), with the parens 18:44
jgaz I don't think I have to do that in Perl, I can check...
nemokosch the ternary operator is not for side effects, after all 18:46
the true irony is, though, that your example can be rewritten without parens, if you want to golf it so badly: 18:48
jgaz Okay, so I can make it work, but the precidence is wrong if I have an equals. It silently fails to do the right thing.
nemokosch <test> ?? $foo !! $bar = val
jgaz Silent failure is Perl 5. 18:49
hmm... okay.
nemokosch I would say it looks weird but it seems to do the "set one of the variables to val, depending on the test" thing
jgaz I will say, at least Raku gives me a warning that there is a precidence issue. 18:52
IDK if it's code golf exactly, but yeah, I like to do as much as I can on one line as reasonably possible. 18:53
This is especially true on a return line.
nemokosch If you are okay with repeating val, I'd definitely prefer an if-else 18:55
if not, then maybe (<test> ?? $foo !! $bar) = val, with the parens for readability
jgaz Hmm... I'll play with that. 18:57
19:14 ab5tract joined 19:48 ab5tract left 20:13 teatwo joined 20:16 tea3po left 22:26 MasterDuke left