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. |
|||
.vushu | @antononcube no I haven’t yet 😅 | 00:11 | |
02:19
MasterDuke joined
06:28
CIAvash joined
07:53
CIAvash left
14:00
MasterDuke left
15:40
mcmillhj joined
|
|||
mcmillhj | If I have a long expression like `$game-record.comb(/\d+ \s (red|green|blue)/)>>.split(' ')>>.map(-> $quantity, $color { $color => +$quantity }).flat.classify(*.key, :as{ $_.value });` for example. Is there a way I can wrap this across multiple lines in my editor so I can comment on each part of the transformation? | 15:42 | |
nemokosch | >>. is the tough part | 15:44 | |
I wouldn't know it offhand how to kind of reset parsing after that | 15:45 | ||
mcmillhj | I wasn't sure if there was some way to signal there is more in this expression similar to `\` in shell | 15:48 | |
lakmatiol | it does exist and it seems to work $value>>.\ map()>>.\ split()>>.\ ... | 15:50 | |
mcmillhj | :| well not I feel dumb. I left a space between the `.` and `\` so it wasn't working. | 15:51 | |
Thank you! | |||
lakmatiol | raku is quite unpredictable with where whitespace can and can't be,ye | 15:52 | |
nemokosch | eventually, mere . was allowed to be detached | ||
but not even derived operators like .& | 15:53 | ||
makes you wonder | |||
lakmatiol | an mildly janky alternative that doesn't have such unpredictable whitespace is $value andthen $>>.split andthen $>>.map; | 15:54 | |
librasteve | would not pipes ==> be an option? | 15:59 | |
mcmillhj | not sure I follow what you mean. You're saying I can simplify the transformation pipeline? | 16:03 | |
ab5tract | librasteve++ | 16:10 | |
librasteve | my @result = ( <TWO THREE FOUR FIVE SEVEN> »~» " " X~ <FIFTHS SIXTHS EIGHTHS> # (1) Input ==> map( {"VULGAR FRACTION " ~ $^þ } ) # (2) Converts to Unicode name ==> grep({ .uniparse }) # (3) Filters only real names ==> map( { .uniparse} ); # (4) Converts to unicode ); | 16:11 | |
^^ from the docs ... docs.raku.org/routine/%3D%3D%26gt%3B | |||
DarthGandalf | do you mean applying hypering to ==> ? »==>» ? | 16:12 | |
nemokosch | that's the thing with pipes: they are only nice under very specific circumstances | 16:13 | |
librasteve | I am chucking into the mix ... but I have not checked best way to use pipes and hyper (I guess '.hyper' would be a good way) | ||
nemokosch | ==> is basically syntax sugar for pushing a last argument into a function call | 16:15 | |
I think it can also push into an array | 16:16 | ||
librasteve | probably you can write '>>.op.' as another 'map(*.op).' | 16:21 | |
nemokosch | you can most of the time but it's worth knowing that >>. is semantically a deepmap | 16:22 | |
librasteve | fair point | 16:23 | |
DarthGandalf | oh, `deepmap({$_})` looks like what I needed yesterday. I used `from-json(to-json(@foo))` instead >< | 16:26 | |
librasteve | detaching .&fn with <.ws> sounds good to me ... is this a change you have requested? | 16:31 | |
nemokosch | I think it doesn't work | 16:33 | |
some weird parsing path "unlocks" | |||
librasteve | (I guess it maybe hard to cram even more into the syntax parse) | ||
well raku is crammed to the gills with parsing paths that's for sure | |||
16:47
mcmillhj left
17:18
gfldex joined
|