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:03 Manifest0 left 03:00 Heptite joined 04:06 rf left 04:29 Heptite left
shmup a test fails for me when i zef install rakudoc 05:33
www.google.com/search?hl=en&q=...%20package 05:34
er
Testing [FAIL]: rakudoc:ver<0.2.4>:auth<github:Raku>:api<1>
05:45 deoac left 06:47 tea3po joined 06:50 teatwo left 06:53 tea3po left, tea3po joined 07:09 tea3po left 07:10 tea3po joined 08:30 habere-et-disper joined
habere-et-disper Is there a difference between: 08:32
sub foo ( +@bar ) { ... }
sub foo ( *@bar ) { ... }
The both seem to slurp and take numeric and non-numeric variable arguments.
?
The/They 08:33
They both seem to take zero or more arguments too.
08:41 teatime joined 08:43 teatwo joined
Nahita hi *@args version flattens the arguments 08:43
e.g., f (3, (4, 5)) will give different results
the "+" one makes @args to be [3, (4, 5)] 08:44
the "*" one makes it to be [3, 4, 5]
08:44 tea3po left
as an aside, "**" forwards as is, i.e., makes it [(3, (4, 5)),] 08:45
08:46 teatime left
habere-et-disper Thanks ! 08:50
08:54 guessed joined
Nahita np. by the way, after your message "I thought it -Ofun to see forgiven!" 4 months ago, i managed to make this work use Slang::Forgiven; forgiven "yeS".comb -> $char { when / <.upper> / { put "$char shouts" } when / <.lower> / { put "i like $char" } default { put "$char is from others" } } 08:55
thanks
08:56 guessed left
habere-et-disper I was just trying to do this again... you read my mind! :D 08:56
08:57 guessed joined
Nahita :) 08:59
habere-et-disper Installing must have Slang::Forgiven ! :D 09:05
Original idea came from user deoac while mentoring on exercism. 09:07
Nahita oh thanks 09:08
didn't know that, will mention it
habere-et-disper Thanks! I will try and let them know about it. I suppose it was naive to think this could all be done with: 09:32
sub infix:<forgiven> ( ... ) { ... } 09:33
(I meant prefix.) 09:43
Nahita oh that's a different perspective... maybe with these new RakuAST things, it could work... 09:44
10:48 guessed left 10:53 Manifest0 joined 11:20 n1to joined 12:20 n1to left 13:05 Heptite joined 13:25 habere-et-disper left 14:40 rf joined 16:59 yoreei joined
yoreei Hello everyone! I have an interesting situation with && short-circuiting. Here is a minimal working example: 17:05
```
my @ARR;
False && $VAR = Nil.Int;
```
This snippet compiles file (as expected), but gives a runtime error (no expected by me). The error is:
```
Use of Nil.Int coerced to empty string
Ā  in block <unit> at ./raku.raku line 114
Cannot modify an immutable Bool (False)
Ā  in block <unit> at ./raku.raku line 114
```
My intuition: $VAR = Nil.Int is indeed problematic, but should never be reached by the interpreter because of "False &&"
What is interesting is that
```
False && Nil.Int;
False && say "unreachable"Ā  && $VAR = Nil.Int;
False && my $VAR = Nil.Int;
rf use and instead of && 17:08
It is evaluating like (False && $VAR) = Nil.Int;
m: my $var; False and $var = Nil; 17:09
camelia ( no output )
rf m: my $var; False && $var = Nil;
camelia Cannot modify an immutable Bool (False)
in block <unit> at <tmp> line 1
17:10 yoreei left 17:31 yoreei joined
Nemokosch Makes sense 18:01
rf m: my $var = 123; $var && False = Nil; 18:03
camelia Cannot modify an immutable Bool (False)
in block <unit> at <tmp> line 1
rf m: my $var = 123; $var and False = Nil;
camelia Cannot modify an immutable Bool (False)
in block <unit> at <tmp> line 1
rf m: my $var = Nil; $var and False = Nil;
camelia ( no output )
yoreei does not make sense to me. Why is anything after && executed? 18:14
Nemokosch Because you didn't use parens 18:15
However, at the end of the day, it's probably better to stay away from using operators in the place of control structures 18:16
yoreei I think I understand. The implicit parens are: 18:19
(False && $VAR) = Nil.Int;
so I was trying to assign to False
Thank you all! 18:20
18:20 rf left
Nemokosch rf carry ^^ 18:21
Operators have at least 3 properties that can affect order of execution: precedence, associativity and evaluation of operands (e.g. short-circuiting) 18:23
18:24 yoreei left 18:36 rf joined 18:48 tea3po joined 18:49 tea3po left 18:50 tea3po joined 18:52 teatwo left 19:04 ab5tract joined 19:57 yoreei joined 20:00 yoreei left 20:41 snonux left, snonux joined 21:18 rf left, rf_ joined 21:32 rf_ left 21:33 rf joined 22:49 seekr left 23:02 seekr joined