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. |
|||
02:21
tea3po left,
tea3po joined
02:33
teatwo joined
02:36
tea3po left
10:05
KOTP left
10:07
KOTP joined
10:21
lizmat_ joined
10:25
lizmat left,
lizmat_ left,
lizmat joined
10:51
lizmat left
10:53
lizmat joined
13:10
ab5tract left
13:49
guifa joined
13:52
guifa_ left
14:24
tea3po joined
14:26
tea3po left
14:27
tea3po joined,
teatwo left
14:59
deadmarshal_ left
15:33
deadmarshal_ joined
|
|||
Anton Antonov | How do you specify Whatever for CLI arguments scripts? Currently, I am using the string "Whatever" or empty string "". | 15:36 | |
lucs | Not sure what you mean. Something like this? sub MAIN ($a, $, $b) { $a + $b} | 17:16 | |
17:24
ab5tract joined
17:38
ab5tract left
|
|||
Anton Antonov | Something like sub MAIN ( Str $a, :$b = Whatever, Str :$c = 3 ) { $b.isa(Whatever) a ~ b !! a ~ $b.raku ~ $c } | 17:39 | |
lucs | Uh, should there be a '??' before the 'a ~ b' there? | 17:44 | |
Anton Antonov | Yes, of course. | 17:59 | |
lucs | Yeah, okay. I'm still not sure what you're after, sorry :/ | 18:07 | |
Nemokosch | It should be * instead of Whatever probably | 18:13 | |
but no idea if that gets parsed via CLI | |||
Anton Antonov | @Nemokosch Yes you got what I am asking. (I never tried using "*" 😲 .) | 18:16 | |
Drudge Sentinel | Is running a MAIN subroutine a normal practice? In my admittedly trivial exercises, when I run a script with a MAIN subroutine it messes with the behavior of things like @*ARGS | 20:07 | |
Nemokosch | why would you use @*ARGS if you can use the signature of MAIN? | 20:20 | |
Drudge Sentinel | it was just mentioned in the exercise text itself: You’ve already used an Array that you haven’t seen. @*ARGS is the collection of Strs that you’ve specified on the command line. Output each element on its own line. | 20:32 | |
I ended up just using $ cat ex6-8.raku for @*ARGS {.say} | 20:33 | ||
I mostly just used it because it was mentioned as what I need to iterate over by the exercise | 20:34 | ||
so i think a more generic application would look something like sub MAIN (*@args) { for @args {.say}; } after reading the command line interface docs in raku | 20:38 | ||
lucs | @Drudge Sentinel You'll probably find this interesting: docs.raku.org/routine/MAIN | 20:40 | |
Drudge Sentinel | yep, was just reading that when I came up with the latter code | 20:41 | |
21:35
guifa left
|