This channel is intended for people just starting with the Raku Programming Language ( Logs are available at
Set by lizmat on 8 June 2022.
01:08 MasterDuke left 02:10 teatwo joined 02:13 tea3po left 02:15 teatwo left, teatwo joined 03:19 lmz joined 05:13 Heptite left 08:45 Fritz joined
Fritz Could somebody explain to me what this regex exactly does? 08:47
`/^ '?if' \h+ <option=.ident> \h* $/`
In particular, I don't understand the `<option=.ident>` part and could't find `.ident` in the Raku documentation.
08:47 Fritz is now known as fritz
Nemokosch what is the context here? 08:54
Mediocre anyone knows why part 2 is not available here ? 08:59
fritz ```
given $content {
                when /^ '?if' \h+ [$<negate>='!']? <option=.ident> \h* $/ {
                    my $enabled = $<negate> ?? .not !! .so given %options{~$<option>};
I am trying to understand how this code works (in order to extend it).
Nemokosch @Mediocre does part 2 even exist? I'm not sure Andrew Shitov could continue with it 09:00
2 y ago ouch ( i think he could not ) but it was pretty nice
Nemokosch he couldn't receive funding for it any further that's for sure 09:01
he was planning to continue nevertheless but life can get in the way I guess
fritz: 09:02
Mediocre i understand that well
Nemokosch the dot apparently says "don't introduce a named capture" 09:04
Mediocre huh?
Nemokosch so <option=.ident> basically renames the capture from ident to option 09:05
fritz Ah, cool. So afterwards it can be accessed as `$<option>` in the line below. What does the `~` do in `~$<option>`? 09:06
Nemokosch string conversion
fritz Ok, that's what I thought, just don't know why this is needed. 09:07
Nemokosch $/ is a (potentially nested) match object, $<option> is short for $/<option>, a match object in itself
fritz Thanks very much!
Nemokosch I'm not 100% sure how hash keys stringify; could be that they use .Str just like the infix ~ 09:08
there is only one way to know that... 😼 09:10 so apparently it does also stringify by .Str 09:16
the key
so yes, strictly speaking, the ~ is not needed
are you reading up on Roast? 09:20
Mediocre how does this even work you chatting to frank 09:26
lizmat Nemokosch re " he couldn't receive funding for it any further that's for sure" afaik, it was not a matter of funding 09:28
Nemokosch "it" being?
lizmat part 2 of the course ? 09:30
Nemokosch I wouldn't know what it was a "matter of", to be honest. I seem to recall that the funding was over and Andrew was like "screw that, I'm gonna do it regardless" 09:34
09:58 fritz left
snufkin @Mediocre is pretty good. It's not quite as in-depth but covers more. 11:15
11:16 lmz left
Mediocre thank you i will check it 11:20
11:40 Heptite joined
is there a way to change how this works ? 11:52
nvm 11:53
12:16 Fritz joined
Anton Antonov @Mediocre Well, it seems that you can ChatGPT to get correct Raku code generated for “simple” tasks. But YMMV. 12:21
Mediocre yes for simple stuff 12:22
Anton Antonov See examples here :
@Mediocre Ah, ok, it seems you tried it.
Mediocre today i will be finishing up more of the docs for raku hopefuly this week i can get an okay understanding of syntax and concepts
no not in raku but in other languages like js and php 12:23
but generally from my experience gpt gets confused the more complex the task and the less info the internet has about the topic
Anton Antonov Well is Raku has a lot smaller footprint on the Web that JavaScript and PHP, so, again, YMMV.
Mediocre well yes but u said it did it ( which is amazing ) considering how limited the fed data would be compared to other languages 12:24
Anton Antonov @Mediocre Good to know observations like this. I have experimented with ChatGPT’s code generation that much.
Mediocre ( but limited and accurate data can also be an advantage) to large scale bad data
Anton Antonov Yeah, that is generally correct in Machine Learning (ML), But the Large Language Models (LLMs) created and employed by OpenAI should make that problem much rare to manifest. 12:26
Mediocre there is a limit to what we can do even large scale will face issues ( if the majority of the data is in 1 word crap ) the result is limited to the data 12:27
no matter the scale unless they make it the ai test and repeat based on success condition (but then we are back to humans defining that success condition ) 12:28
Anton Antonov I am getting more impressed by LLMs lately, but generally speaking LLMs are just hallucinating, so I do not trust them much.
Mediocre so the way i view it is this 12:30
ai like any field is not magic and sorcery everything must be based on logic and principals and we are bound by them some stuff can simply not be changed 12:31
so the world limitations will show itself within the code at some point ( even if the syfy people reject this view to a point of anger ) in the end we can only do what is possible
13:35 Fritz left 14:10 tea3po joined 14:12 tea3po left, tea3po joined 14:13 teatwo left 14:15 Heptite left 14:27 tea3po left, tea3po joined 15:53 Heptite joined 16:07 Util joined 16:44 Fritz joined
Fritz Why does 16:45
my %options := {:A, :!B, :!C}; my $enabled = 'A ?or B ?or C'.split(' ?or ').reduce({ %options{$^a} || %options{$^b}}); say $enabled.raku;
give `Bool::False` and not `Bool::True`?
`raku -e 'my %options := {:A, :!B, :!C}; my $enabled = "A ?or B ?or C".split(" ?or ").reduce({ %options{$^a} || %options{$^b}}); say $enabled.raku;'`` 16:48
Sorry about my failing quoting ... 16:49
16:52 Fritz left
Mediocre what does this mean? 16:57
nvm i understood it now
we can have multiple defaults on this? 17:02
Nahita Fritz: the .reduce call boils down to this if you agree: (%options{"A"} || %options{"B"}) || %options{"C"} 17:03
if you trace that, i think it will tell the answer 17:04
17:05 habere-et-disper joined 17:32 MasterDuke joined
Mediocre this says vscode cant find location 18:50
Nemokosch hmm, isn't it rather like %options{(%options{"A"} || %options{"B"})} || %options{"C"} ? 18:52
Nahita yes sorry deleted it 19:15
the directory VSCode executes the command is perhaps different than the file's location 19:23
maybe try "Open Folder" or something from the menu above under File
not sure how you're running the command
19:24 ab5tract joined 19:30 ab5tract left
Mediocre its the same 19:51
ctrl + ` it opens console the file is the same directory also i can use cd to navigate to the folder
it's just that command for some reason don't work ( even when i rename the file to the exact file i have)
/dev/null dont work
Nahita any error message or something? 19:52
20:55 habere-et-disper left 21:03 habere-et-disper joined
habere-et-disper pairup pairs adjacent items. what's the recommended way to pair up items on either end of a list, ie. first with last, second with second-last, and so on (assuming a list/array of even size) ? 21:06
Nemokosch not gonna lie this feels a bit esoteric for me but there you go... 21:15
m: <alpha beta gamma delta epsilon zeta> andthen $_ Z .reverse andthen .[^*/2] andthen .say 21:16
Raku eval ((alpha zeta) (beta epsilon) (gamma delta))
Nemokosch i.e zip it with its reverse and take the first half of the elements 21:17
habere-et-disper Thanks Nemokosch! That's what I had. Seems weird to reverse a duplicate and zip half of it. 21:21
Nemokosch you can always kinda comfort yourself by saying that Z generates the elements lazily 21:22
you can also type out the loop and do the math, of course
m: my @vals = <alpha beta gamma delta epsilon zeta>; say (@vals[$, *-1-$] for ^@vals); 21:24
Raku eval ((alpha zeta) (beta epsilon) (gamma delta) (delta gamma) (epsilon beta) (zeta alpha))
Nemokosch oh right, divide that by two, again
m: my @vals = <alpha beta gamma delta epsilon zeta>; say (@vals[$, *-1-$] for ^@vals/2);
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Unsupported use of $] variable; in Raku please use $*RAKU.version or $*RAKU.compiler.version at /home/glot/main.raku:1 ------> elta epsilon zeta>; say (@vals[$, *-1-$]⏏ for ^@vals/2);
Nemokosch discord ate up the underscores...
m: my @vals = <alpha beta gamma delta epsilon zeta>; say (@vals[$, *-1-$] for ^@vals/2); 21:25
Raku eval ((alpha zeta) (beta epsilon) (gamma delta))
habere-et-disper Yes, I saw and tested Z's laziness -- a comfort indeed. Thank you for the alternative. Interesting. 21:29
21:36 Fritz joined 21:50 Fritz left 22:29 habere-et-disper left