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.
nHail I'm calling this on a list which may or may not have an even number of elements: .map:{$^a~$^b~' '}. Is there a way I can tell it a fallback value for $^b in case there is an odd number? 18:38
rf One sec nHail I think I did this exact thing once 18:54
I did this with .map: sub ($a, $b = 'fallback') { $a ~ $b }; 19:03
nHail: ^
nHail Ah, thanks. 19:04
lizmat -> $a, $b? { ... }
rf ^ that is nicer!
lizmat doesn't need to be a sub
although a default may be better if you're concatenating
-> $a, $b = '' { ... }
rf -> $a, $b? { $a ~ ($b // 'abc') }; 19:05
nHail Tried this, says $a is not defined 19:09
might be something else though
Got it now, thanks! 19:15
rf Awesome! 20:01