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.
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
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