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.
00:00 hexology left, yjh left, deadmarshal_ left, lucs left, elcaro left, sjn left, sjn joined 00:02 hexology joined 00:05 lucs joined, elcaro joined 00:06 deadmarshal_ joined 03:15 kjp left 04:22 MasterDuke left 07:13 deoac left 07:54 dakkar joined 08:04 Manifest0 joined 08:21 tea3po joined 08:22 tea3po left, tea3po joined 08:24 teatwo left 08:35 ab5tract left, ab5tract joined
lizmat And yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2023/09/11/2023-37-issuing/ 12:05
12:56 deoac joined 14:16 camelia left 14:36 camelia joined 15:14 deoac left 15:30 deoac joined 16:36 dakkar left 17:21 deoac left 17:50 jgaz left
timemelon I'm trying to pass a list to a function and I think I'm messing up the implicit parenthesizing somehow 18:01
I have sub f(List:D @ints) { # ... }
and say f (1, 1, 2, 2, 2, 3);
I'm getting the error Type check failed in binding to parameter '@ints'; expected Positional[List] but got List ((1, 1, 2, 2, 2, 3)) 18:02
where am I going wrong? 18:03
lakmatiol @timemelonSee docs.raku.org/language/traps#Typed...parameters 18:15
timemelon ah thanks 18:20
so the type of an @ variable refers to the type of each element
lakmatiol yes 18:23
19:06 MasterDuke joined
nemokosch anyway, there is "no way" a List:U could get there 19:06
or at least it's controversial whether it should be allowed or not 19:07
@timemelon what languages have you used before, if I may? 19:09
timemelon my big ones are c, haskell, and apl 19:10
nemokosch great, I know no APL and have a very basic clue of what Haskell looks like... 19:11
I just wanted to say that something that has this @ sigil in front will violate a lot of ideas you may have about what "a variable" is
leomehraban I have this grammer: grammar Rix{ token TOP{ <statement>*%%';' } token statement{ [<proc_call> | <expr>] } token proc_call{ '.'<identifier> '['<expr>*%%',' ']' } token identifier{ \w+ } token expr{ '+' } }. However, when I do say(Rix.parse(".print[+];"));, it just says Nil. however, when I give it ".print[];", without the plus, it gives the expected result. 19:12
I'm still a bit confused with regexes, so it's very likely that I made some error, but I can't find it.
MasterDuke leomehraban: moritz is the grammar/regex expert, but you might be interested in docs.raku.org/language/regexes#Til...structures to make your parsing of '[' <...> ']' easier 19:24
nemokosch what is this %% ? 19:31
> To also match trailing delimiters ( a, or a,a, ), you can use %% instead of %. 19:32
gotcha
antononcube %% is the same as % -- as far as I can tell. I have seen it other's people code.
And, yes, I was puzzled by it too. 19:33
scullucs %% allows a trailing separator, while % does not. 19:42
Er, like @nemokosch mentioned. 19:43
antononcube @lucs Agh, good point!
nemokosch @leomehraban don't @ me at this but I think there is a phenomenon when a quantifier asterisk hard-locks to an empty match 19:44
also, does %% allow or mandate a trailing separator? 19:45
if it mandates one, the parsing should fail by all means
scullucs I believe it allows, not mandates.
(But who cares about my beliefs, better test 🙂 ) 19:46
nemokosch adding the comma after the plus did not help so that's definitely a hint
that wasn't the main issue 19:47
yes, there you go
<expr>+%%',' does work
MasterDuke docs.raku.org/language/regexes#Mod...ier:_%,_%% isn't explicit about whether the trailing separator is optional or required 19:48
nemokosch maybe it's worth an issue
design.raku.org/S05.html says: 19:49
If you wish to allow the match to end after either side, use %% instead. Therefore / <ident>+ %% ',' / can match any of foo foo, foo,bar foo,bar, foo,bar,baz foo,bar,baz
I can just edit this one, rest assured 19:52
19:58 Manifest0 left
@leomehraban let me assume that you ultimately want this to work. I can't tell you why - apparently - %% hard-locks to an empty match when that's an available option but without using it, it's simple to write something that does work 20:03
token proc_call{ '.'<identifier> '[' [<expr>','?]* ']' }
it can also work by simply changing [<proc_call> | <expr>] to [<proc_call> || <expr>] 20:11
20:22 teatwo joined 20:25 tea3po left 20:40 deoac joined 21:14 deoac left