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. |
|||
13:32
frost left
13:35
frost joined
15:47
jgaz joined
16:07
frost left
16:08
Heptite joined
16:37
ab5tract left
16:53
ab5tract joined
17:09
avuserow left
17:31
tg57 joined,
Guest8418 joined
17:32
avuserow joined
17:37
MasterDuke left
17:57
Guest8418 left,
tg_57 joined
18:12
tg_57 left
18:33
tg57 left
|
|||
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 | |
18:50
MasterDuke joined
|
|||
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 | |
20:12
NemokoschKiwi joined,
NemokoschKiwi left
21:22
tg57 joined
21:44
jgaz left
22:42
ab5tract left
23:14
tg57 left
|