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.
SmokeMachine m: sub a(@b where *.are ~~ Int) {}; a [1,2,3]; a [1,2,”a”] # falsifian 00:34
camelia Constraint type check failed in binding to parameter '@b'; expected anonymous constraint to be met but got Array ([1, 2, 3])
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
SmokeMachine m: say [1,2,3].are 00:35
camelia (Int)
SmokeMachine m: sub a(@b where { .are } ~~ Int) {}; a [1,2,3]; a [1,2,”a”] # falsifian 00:36
camelia Constraint type check failed in binding to parameter '@b'; expected anonymous constraint to be met but got Array ([1, 2, 3])
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
SmokeMachine m: sub a(@b where { .are ~~ Int }) {}; a [1,2,3]; a [1,2,”a”] # falsifian 00:37
camelia Constraint type check failed in binding to parameter '@b'; expected anonymous constraint to be met but got Array ([1, 2, "a"])
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
falsifian I think the constraint is elementwise. 00:41
01:42 Kaiepi left
Nemokosch is are v6.e? 02:06
02:30 razetime joined
chicken hm when i use is copy on $/ the make doesn't seem to assign the .made in the current scope or something idk ```pl 02:35
grammar Code {
token TOP {
^ [<expression> \n?]* $
}
rule expression {
<number> | <func-line>
}
token func-line {
<[₀₁₂₃₄₅₆₇₈₉]>
}
token number {
\d+
}
}
class Parse {
method TOP($/) {
make $<expression>>>.made
hm when i use is copy on $/ the make doesn't seem to assign the .made in the current scope or something idk ```pl 02:36
grammar Code {
token TOP {
^ [<expression> \n?]* $
}
rule expression {
<number> | <func-line>
}
token func-line {
<[₀₁₂₃₄₅₆₇₈₉]>
}
token number {
\d+
}
}
class Parse {
method TOP($/) {
make $<expression>>>.made
hm when i use is copy on $/ the make doesn't seem to assign the .made in the correct scope or something idk ```pl 02:37
grammar Code {
token TOP {
^ [<expression> \n?]* $
}
rule expression {
<number> | <func-line>
}
token func-line {
<[₀₁₂₃₄₅₆₇₈₉]>
}
token number {
\d+
}
}
class Parse {
method TOP($/) {
make $<expression>>>.made
02:37 discord-raku-bot left, discord-raku-bot joined 02:40 razetime left
huh and for some reason when i try this ```pl 02:40
method func-line($/ is copy) {
make (0..0).map({
my $res = Code.parse("1", actions => Parse).made;
say "res $res";
$res
});
}
``````
res 1
[([1]) 5]
```
03:13 MasterDuke joined 04:34 razetime joined 05:31 Heptite left 06:27 Kaiepi joined 11:01 Kaiepi left
Nemokosch <@435939911455997952> be warned that unfortunately these messages are sent to an IRC channel as well and the way they show up is probably horrifying 11:23
it's generally a better idea to send anything long with some pastebin kinda service, e.g Github gists 11:24
You might know that $/ is a variable set at all matchings - probably .parse sets it as well 11:29
I think the most straightforward solution is to break free from $/ 11:30
docs.raku.org/routine/make 11:31
once you are doing matchings inside of parsing (which I'm not sure is a good idea in the first place), it's better to specify the parameter with some other name and call .make on that 11:32
11:35 discord-raku-bot left, discord-raku-bot joined 12:46 Kaiepi joined
chicken hm yeah that does seem to work a bit better 13:57
14:57 Heptite joined 15:48 guifa left 15:49 guifa joined 17:41 razetime left 19:26 Heptite left 21:17 Heptite joined, deoac joined 22:10 deoac left 22:37 deoac joined 23:43 deoac left