01:03
Heptite joined
01:32
jgaz left
01:59
Manifest0 left
03:59
Heptite left
06:27
teatwo joined
06:30
teatime left
10:17
Manifest0 joined
19:32
avuserow joined
22:46
Heptite joined
|
|||
renormalist | I don't find it on my own. Using a grep's success in a boolean way? my $found-it = $file.lines.grep:{ /SOME \s* STRING/ }; | 23:05 | |
ab5tract | you can use ‘so’ or ‘?’ on an expression to produce a boolean | 23:08 | |
m: say so 55; say ? 0; | |||
camelia | True False |
||
ab5tract | m: say so []; say ? (0) | 23:09 | |
camelia | False False |
||
renormalist | The ? works, thanks. | ||
ab5tract | single arg rule strikes again | ||
renormalist | Is that an operator for that purpose? Never read about it yet. | 23:10 | |
ab5tract | Yeah it’s a prefix operator | ||
? is to ‘so’ as && is to ‘and’ | |||
renormalist | so also works, I have heard that but didn't know it is a prefix op | ||
ab5tract | Mostly interchangeable but with an important distinction in precedence level | 23:11 | |
renormalist | Let me find where it is documented, brb | 23:12 | |
docs.raku.org/language/operators#prefix_so - m'kay, "Evaluates its argument in Boolean context", quite what I was looking for, ok. | 23:13 | ||
The ? is more my readability style though, but I get the precedence thing, like in Perl and/or vs &&/||. | 23:14 | ||
Ok, I guess that was the answer I was searching, thanks again. :-) | |||
ab5tract | m: my $s = ? 0 || 55; dd :$s | 23:21 | |
camelia | :s(55) | ||
ab5tract | m: my $s = so 0 || 55; dd :$s | ||
camelia | :s(Bool::True) | ||
ab5tract | The other distinction is that so has a method variant but ? does not | 23:23 | |
renormalist | that means I would prefer actually the "so" to less need of parens on its right side, too bad for my preference of "?" but so be it. (no pun intended) | 23:24 | |
ab5tract | I personally tend towards so because something like ?$!foo starts to look intentionally malicious to my eyes but TMTOWTDI for exactly this kind of difference in opinion | ||
True. Sometimes ? saves you from a set of parens and sometimes it forces you to them on you | 23:28 | ||
renormalist | I see the opinion, ack. Yet not what in particular makes that expression malicious | ||
$!foo is an internal class member, right? | |||
object member | |||
ab5tract | It’s any class member variable, actually | ||
When declaring, it marks it as internal | 23:29 | ||
But I never use $.foo inside of method bodies | |||
renormalist | (I mean it te oter way around with the parens. I would prefer the ? but need so to have less parens on remaining line. Not?) | ||
ab5tract | (And yeah, object member or instance variable) | 23:31 | |
renormalist | so with ?$!foo you also mean ? as this boolean evaluator which would look malicious? Or is there some actual golfing in that expression? Just want to understand what you mean. | 23:32 | |
ab5tract | The intentionally malicious thing is just in reference to the complaints about similarities to line noise | ||
renormalist | ok, then I get it | ||
ok, I think that's it for tonight. Will get some sleep. Good night. | 23:33 | ||
ab5tract | Cheers! |