🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:23 topnep left 00:26 topnep joined 00:41 Sgeo joined 01:04 yewscion joined 01:09 yewscion left 01:35 leah2 left 01:46 kylese left, kylese joined 01:55 leah2 joined 02:15 kylese left, kylese joined 02:23 yewscion joined 02:27 yewscion left 02:56 yewscion joined 03:01 yewscion left 03:45 kylese left 03:49 kylese joined 06:43 topnep left 06:45 topnep joined 07:07 Sgeo left 07:14 Aedil joined 07:22 librasteve_ joined 07:47 Aedil left 07:51 Aedil joined
patrickb Xliff: I'm mostly on sourcehut as well ( sr.ht/~patrickb/ ). What's your nick? 07:59
07:59 disbot1 left, disbot1 joined 08:12 dakkar joined
[Coke] waves from a train 08:24
08:31 topnep_ joined
Xliff_ patrickb: xliff, of course! ;) 08:32
08:32 lichtkind joined 08:34 topnep left
Xliff_ Good morning. 08:53
In this example: token a { 'A' }; token b { 'b' }; regexp ab { <a>+<b>* }; 08:54
What would be the easiest way to get each of the above to run an associated sub?
Kinda like a Grammar with an Action class that does not need to match the whole string, and can match multiple times in said string (so no... not subparse) 08:55
Text::Subparser looks to be too specific for what I need. 08:58
lizmat m: my token a { "A" { say "hi" } }; say "fAo" ~~ / <a> / 09:01
tellable6 2025-06-04T20:30:35Z #raku-dev <japhb> lizmat Several terminal-related questions for you in #mugs
camelia hi
「A」
a => 「A」
lizmat m: my token a { "A" { say "hi" } }; say "fAo" ~~ / <.a> /
camelia No such method 'a' for invocant of type 'Match'. Did you mean 'at'?
in block <unit> at <tmp> line 1
lizmat heh
Xliff_ m: my token a { "A" }; &a.^name.say 09:04
camelia Regex
dakkar m: my token a { "A" { say "hi" } }; say "fAo" ~~ / <a> / # this works 09:05
camelia hi
「A」
a => 「A」
lizmat m: say " a" ~~ / <ws> / # this also captures "ws" 09:06
camelia 「 」
ws => 「 」
lizmat m: say " a" ~~ / <.ws> / # this doesn't
camelia 「 」
lizmat I sorta expected the same behaviour for <.a>
dakkar outside of a grammar? 09:07
lizmat well, wouldn't that makes sense?
dakkar hmm. the invocant for that `.` is a Match, which doesn't have a `a` method 09:08
Xliff_ Regexp objects aren't called like normal subs, are they? CAN they be?
dakkar (that's what the error message said)
lizmat dakkar: yeah, I got that :-)
dakkar hmm
Xliff_ m: my token a { 'A'+ }; &a("AA").say 09:09
camelia No such method '!cursor_start' for string 'AA'. Did you try to call a
token / rule / regex directly?
in regex a at <tmp> line 1
in block <unit> at <tmp> line 1
lizmat anyways, looks like RakuAST has a compile-time issue with: my token a { "A" }; say "foo" ~~ / <.a> /
Cannot stringify object of type QAST::Var
dakkar aha! docs.raku.org/language/regexes#Subrules 09:10
> If no capture is desired, a leading dot or ampersand will suppress it: <.named-regex> if it is a method declared in the same class or grammar, <&named-regex> for a regex declared in the same lexical context.
m: my token a { "A" { say "hi" } }; say "fAo" ~~ / <&a> /
camelia hi
「A」
lizmat TIL
Xliff_ So what would wrapping a Regex look like? 09:13
dakkar m: my token a { 'A' }; my $b = &a.wrap( -> |x { say 'wrapped'; callsame }); 'AA' ~~ /<a>+/ 09:19
camelia wrapped
wrapped
wrapped
dakkar something like that?
Xliff_ dakkar: Something like that... 09:26
m: my token a { 'A' }; my $b = &a.wrap( -> |x { my $r = callsame; say "wrapped"; $r }); 'AA' ~~ /<a>+/
camelia wrapped
P6opaque: no such attribute '$!pos' on type Match in a Scalar when trying to get a value
in block <unit> at <tmp> line 1
Xliff_ So why didn't that work? 09:27
m: my token a { 'A' }; my $b = &a.wrap( sub (|) { my $r = callsame; say "wrapped"; $r }); 'AA' ~~ /<a>+/
camelia wrapped
wrapped
wrapped
Xliff_ Ah! Wanted a sub 09:28
m: my token a { 'A' }; my $b = &a.wrap( sub (|) { my $r = callsame; say $r.^name.say; $r }); 'AA' ~~ /<a>+/
camelia Match
True
Match
True
Match
True
Xliff_ m: my token a { 'A' }; my $b = &a.wrap( sub (|) { my $r = callsame; $r.^name.say; $r }); 'AA' ~~ /<a>+/
camelia Match
Match
Match
Xliff_ m: my token a { 'A' }; my $b = &a.wrap( sub (|) { my $r = callsame; $r.^name.say; $r }); 'B' ~~ /<a>+/
camelia Match
Match
Xliff_ m: my token a { 'A' }; my $b = &a.wrap( sub (|) { my $r = callsame; $r.gist.say; $r.^name.say; $r }); 'B' ~~ /<a>+/ 09:29
camelia #<failed match>
Match
#<failed match>
Match
Xliff_ m: my token a { 'A' }; my $b = &a.wrap( sub (|) { my $r = callsame; $r.defined.say; $r }); 'B' ~~ /<a>+/
camelia True
True
Xliff_ m: my token a { 'A' }; my $b = &a.wrap( sub (|) { my $r = callsame; $r.so.say; $r }); 'B' ~~ /<a>+/ 09:31
camelia False
False
10:29 dakkar left 10:33 dakkar joined 10:35 topnep_ left 10:36 topnep joined 12:07 yewscion joined 12:11 yewscion left 12:40 topnep left 12:42 topnep joined 12:52 yewscion joined 12:57 yewscion left 13:17 apac left 14:31 nine left, camelia left 14:36 camelia joined 14:39 apac joined 14:40 nine joined 14:46 Sgeo joined 15:14 camelia left, nine left 15:19 camelia joined 15:23 nine joined 15:54 bisectable6 left 16:07 bisectable6 joined 16:12 leedo left 16:13 lizmat left 16:17 leedo joined, lizmat joined 16:18 zostay left 16:22 zostay joined 16:30 dakkar left 17:35 Guest71 joined
Guest71 hi 17:35
anyone?
SmokeMachine Hi! 17:39
Guest71 For the raku is used?
What is the raku used for?* 17:40
17:54 Guest71 left
librasteve hi 18:10
I use it for web sites 18:11
others use for LLM promots
Guest71: thanks for asking ... how did you hear about raku? 18:12
..... 18:36
i like it quiet 18:38
means that the minions are busy coding 18:39
antononcube Raku LLM functionalities are pretty good -- they provide uniform way of interacting with many LLM-providers and their different models. Raku chatbooks are one of the best ways to interact with LLMs in and merge them with other computations. 18:40
(The other "best way" is to use Wolfram Language chatbooks.) 18:41
BTW, the corresponding Python LLM functionalities I programmed work too, but only with OpenAI / ChatGPT. Google's PaLM and Gemini change(d) to much I have not had time to make the updates of corresponding Python packages. 18:43
Back to Raku -- I find it fairly good of certain exploratory data analysis if the datasets a relatively small, say, less than 50k rows. 18:45
18:46 stanrifkin joined
librasteve how would youcharacterise raku in one sentence 18:46
antononcube Using a the LLM prompt "SloganGenerate" or not? 18:47
librasteve I already have the AI answer 18:48
antononcube Hm... of course.
librasteve "Raku: Do more, your way." 18:50
thank god for AI
antononcube "Raku: Seamless SLM and LLM interaction, powerful chatbooks, and smooth data exploration." 18:51
SLM == Small Language Models (i.e. DSLs and grammars.)
librasteve okaay - DSLLM 18:53
not to be confused with DSLAM
antononcube Digital Subscriber Line Access Multiplexer? 18:54
librasteve yup 18:55
cornerstone of ADSL
(I said NOT to be confused)
antononcube It would have never come to my mind... 18:56
librasteve &afk
19:10 arkiuat joined 20:16 Aedil left 21:06 arkiuat left 21:08 arkiuat joined 21:21 librasteve_ left 21:36 yewscion joined 21:46 yewscion left 22:03 yewscion joined 22:12 yewscion left 22:45 stanrifkin left 22:50 lichtkind left 22:57 arkiuat left 23:27 Xliff_ left