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:25 deoac left 06:44 ab5tract joined 08:22 tea3po joined 08:25 teatwo left 10:14 Manifest0 joined 13:19 teatwo joined 13:23 tea3po left
jgaz I'm trying to smartmatch something that literally looks like `(foo),d` and, given `$x ~~ / (foo),d /`, no amount of `\` escapes around the usual suspects are helping. 14:26
nemokosch First, if that's all you want, you could really just smartmatch a string, or to *.contains('blabla') for containment 14:27
Second, if you want to include literal strings in a regex, quoting is the best option still, / 'blabla' / 14:29
Third, escaping should work nevertheless so what did you try?
jgaz I tried `\(foo\)\,d`. It didn't work. I even tried / 'literal' / -- or so I recall. Trying the / 'literal' / approach now just works. I must have been more tired than I realized. 14:31
Thanks. Sorry to bother.
wait... no it's not. 14:32
I need more coffee. Let me try a few things.
nemokosch Frankly, both versions must work 14:34
If something is off, the problem must be elsewhere
jgaz yep, it is. I got it to match with a tiny test case. 14:35
I must be doing something else wrong on the same line.
nemokosch What is the line? 🧐
"say the line" 😄 14:36
jgaz I found it I was ~ @array[index] on the same line, as part of the gist method to print object details, and the index didn't exist yet because I'm using test input. 14:44
nemokosch Oops 14:47
jgaz yep
wrong... wrong... wrong... right... beautify
17:19 jgaz left 18:39 guifa__ left 20:20 tea3po joined 20:23 teatwo left 20:28 jgaz joined
Tirifto_ Is it not possible to declare a sub within EVAL? (I’m not trying to export the sub from EVAL into the surrounding scope; I am only trying to declare *and use it* within that same EVAL, but I get an error.) 20:38
m: use MONKEY-SEE-NO-EVAL; EVAL “sub foo(Int $x) { $x × 3 }; say foo 3” 20:39
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$x' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> e MONKEY-SEE-NO-EVAL; EVAL “sub foo(Int ⏏$x) { $x × 3 }; sa…
nemokosch haha, that's not an EVAL problem 20:41
that's a quoting problem
Tirifto_ Ohhhh
Of course
nemokosch double quotes interpolate $-variables, right?
so the quoting chokes before EVAL could get called
Tirifto_ I immediately got what you meant; sorry for the commotion. xD 20:42
21:20 deoac joined
deoac m: "a\n" ~~ / 'a' <!ww>\s* \n / 21:20
camelia ( no output )
deoac m: say "a\n" ~~ / 'a' <!ww>\s* \n /
camelia 「a
deoac m: say "a\n" ~~ / 'a' <.ws> \n /
camelia Nil
deoac Why do these matches give different results?  The docs (docs.raku.org/language/regexes#Pre...r_classes) say they are the same. 21:21
nemokosch because you have an uneven amount of whitespaces in the two regexes 22:22
the first one only demands one whitespace because \s* can match zero-width 22:23
oh, nevermind...
I don't get the table, though
if <ww> is zero-width and \s* can be zero-width, why does the table suggest <ws> is not zero-width? what does it mean? 22:24