🦋 Welcome to the former MAIN() IRC channel of the Raku Programming Language (raku.org). This channel has moved to Libera (irc.libera.chat #raku) Set by lizmat on 23 May 2021. |
|||
codesections | github.com/rakudo/rakudo/issues/4423 | 00:00 | |
(I already mentioned your other find in the Grammar) | |||
thanks for all your help, btw | |||
raydiak | from that line, it looks intentional. the fact that it's being called from a rule called "variable" kinda suggests otherwise, though. *shrug* it'll be interesting to see what the experts say. codesections++ good find either way | 00:01 | |
of course, always glad to share what I know. thanks for taking me on a little adventure :D | 00:02 | ||
00:02
reportable6 left
00:03
reportable6 joined
|
|||
raydiak | I can't very easily trace it down just from reading the source either. too many dynamic vars and code mixed into the pattern matching for me to keep track of. I do some cheating with --target=parse | 00:05 | |
00:30
bd3i joined
00:35
dpk left,
dpk joined
00:37
nine left,
nine joined
01:37
quotable6 left,
benchable6 left,
linkable6 left,
committable6 left,
notable6 left,
squashable6 left,
nativecallable6 left,
unicodable6 left,
reportable6 left,
coverable6 left,
bloatable6 left,
shareable6 left,
releasable6 left,
tellable6 left,
sourceable6 left,
greppable6 left,
statisfiable6 left,
bisectable6 left,
evalable6 left
01:38
sourceable6 joined,
committable6 joined,
unicodable6 joined,
evalable6 joined,
notable6 joined
01:39
quotable6 joined,
reportable6 joined,
tellable6 joined,
nativecallable6 joined,
benchable6 joined
01:40
bisectable6 joined,
statisfiable6 joined,
linkable6 joined,
shareable6 joined,
bloatable6 joined,
squashable6 joined
01:41
releasable6 joined,
coverable6 joined,
greppable6 joined
|
|||
lucs | Any special reason why the bots keep getting reset? | 01:48 | |
02:11
nine left,
camelia left
02:12
camelia joined,
nine joined
02:15
Doc_Holliwood left
02:23
_ed joined
|
|||
_ed | is this an OK place for Raku beginners to ask questions? | 02:24 | |
lucs | Yes | ||
And welcome :) | |||
_ed | thank you! | 02:25 | |
playing around with some Raku examples | 02:26 | ||
why does this work: | |||
my @x = '.'.IO | |||
@x.pop.dir.WHAT | |||
but not | |||
'.'.IO.pop.dir.WHAT | |||
(tested those in my repl) | 02:27 | ||
lucs | (on the phone, back in a few minutes, if no one else answers) | 02:28 | |
codesections | m: say '.'.IO.WHAT; my @a = '.'.IO; say @a.WHAT | 02:29 | |
camelia | (Path) (Array) |
||
codesections | _ed: the @ sigil indicates that you want to store a Positional thing, so it coerces the Path to an Array. Arrays have a .pop method, but Paths don't | 02:30 | |
02:33
_ed left
|
|||
lucs | Hmm... My understanding is different: The assignment to @a places the Path instance as the first array element. | 02:33 | |
codesections | (also, this is the right place for questions, but it's not the perfect time - many of the channel regulars are in Europe, where its ~4:30am. That's not (at all!) to discourage questions, but just to say that you might not get as many responses as at a different time) | 02:34 | |
lucs | Uh, _ed left, just saying :/ | 02:35 | |
codesections | lucs: yeah, that's a better way of putting it | ||
Oh, thanks -- I have join/part notifications turned off | |||
02:36
_ed joined
|
|||
lucs | _ed is back! | 02:36 | |
_ed | sorry, my internet's been kinda flaky today | ||
lucs | codesections: Please repeat your comment? | ||
_ed | interesting. --didn't realize `@a = something` wraps somethings in an array. | 02:37 | |
codesections | _ed: the @ sigil indicates that you want to store a Positional thing, so it stores the Path in an Array. Arrays have a .pop method, but Paths don't | ||
lucs | Not that one, the other one :) | ||
codesections | Oh, this? (also, this is the right place for questions, but it's not the perfect time - many of the channel regulars are in Europe, where its ~4:30am. That's not (at all!) to discourage questions, but just to say that you might not get as many responses as at a different time) | ||
lucs | I guess both are OK :) | 02:38 | |
_ed: That was for you. | |||
_ed | oh dang. wake 'em up. this is important. lol | ||
codesections | But as lucs pointed out, I shouldn't have said that @ 'coerces' the Path -- it stores it in an Array | 02:39 | |
_ed | ah. i see | ||
I can't tell for certain from the topic -- this channel is logged, but those logs aren't publicly available? | 02:40 | ||
codesections | no, they are: colabti.org/irclogger/irclogger_lo...2021-06-22 | ||
moon-child | logs should be publicly available | ||
lucs | They are, the link used to be in the topic (I think). | 02:41 | |
codesections | (We might be moving where we keep them soon, but they'll still be public) | ||
moon-child | most channels are at least privately logged. Many people keep logs | ||
lucs | codesections: Is that right? Why the move? | ||
I'm asking because another channel here (#marpa) uses the same logger, wondering if we should worry. | 02:43 | ||
_ed | thanks all! my raku playtime is over for this evening. l8r | ||
02:43
_ed left
|
|||
codesections | I haven't followed it all that closely. I know Liz is working on a new log site, and but I don't recall exactly why | 02:43 | |
moon-child | used to be logs.liz.nl, seems to be down right now? | 02:44 | |
lucs | codesections: Okay, thanks. | ||
moon-child | codesections: could just be generally wanting to have control over the logging. I think that's reasonable (though not reason to be concerned about the existing logger) | ||
lucs | Fair enough. | 02:45 | |
codesections | oh, there was this r/rakulang post: www.reddit.com/r/rakulang/comments...where_how/ | ||
and here's the problem-solving issue: github.com/Raku/problem-solving/issues/280 | 02:46 | ||
lucs | Nice | ||
moon-child | (aside: marpa looks very interesting) | 02:48 | |
lucs | Yep, certainly worth a look. | 02:49 | |
03:43
linkable6 left,
evalable6 left
03:44
evalable6 joined
03:45
linkable6 joined
03:48
Sisyphus joined
04:00
frost joined
04:06
lucerne joined
|
|||
Sisyphus | Hi there, I'm trying to understand why '.say'...:EVAL prints "(LoweredAwayLexical)". I'd expect it to either print ".say" or "(Any)" | 04:26 | |
04:28
jmcgnh left
04:30
jmcgnh joined
04:32
jmcgnh left
04:33
jmcgnh joined
04:42
jmcgnh left
04:45
bd3i left,
jmcgnh joined
04:50
Doc_Holliwood joined
04:54
jmcgnh left
05:00
jmcgnh joined,
jmcgnh left
05:03
jmcgnh joined
05:07
jmcgnh left
05:10
jmcgnh joined
|
|||
moritz | m: $_ = 42; EVAL '.say' | 05:10 | |
camelia | 42 | ||
05:12
lucerne left
05:13
lucerne joined
|
|||
moon-child | m: say infix:<...>('.say', :EVAL) | 05:17 | |
camelia | (.say) | ||
moon-child | m: say infix:<...>('.say') | ||
camelia | (.say) | ||
moon-child | Sisyphus: ^^^ | 05:18 | |
it just ignores the :EVAL | |||
loweredawaylexical I think is an optimizer artefact? Not sure | 05:20 | ||
m: my $x = ('.say' ... :EVAL) | 05:24 | ||
camelia | ( no output ) | ||
Sisyphus | I see. tricky | 05:25 | |
moon-child | m: my $x = ('.say' ^... :EVAL) | 05:26 | |
camelia | (LoweredAwayLexical) | ||
06:03
reportable6 left
06:04
reportable6 joined
06:23
ufobat_ joined
06:24
holyghost joined
06:32
abraxxa joined
06:36
abraxxa left
06:37
abraxxa joined
06:42
lucerne left
07:05
Sgeo left
07:29
xinming_ joined
07:32
xinming left
07:37
lucerne joined
07:45
lucerne left,
lucerne joined
08:03
lucerne left
08:05
dakkar joined
08:13
Sisyphus left
|
|||
demostanis[m] | Is there an easy way of doing `(1, 2) magic (2, 3) => (3, 5)`? | 08:23 | |
moritz | m: say (1, 2) Z+ (2, 3) | 08:25 | |
camelia | (3 5) | ||
moritz | m: say (1, 2) X+ (2, 3) | ||
camelia | (3 4 4 5) | ||
demostanis[m] | I almost found myself, thanks | ||
moon-child | m: say (1,2) »+« (2,3) | 08:26 | |
camelia | (3 5) | ||
moon-child | hyperoperators for the win! | ||
demostanis[m] | How does it work? | ||
moon-child | m: say (1,2) >>+>> 2 #texas variants; also more flexible | 08:27 | |
camelia | (3 4) | ||
moon-child | demostanis[m]: docs docs.raku.org/language/operators#i..._operators | ||
demostanis[m] | $c = (2,3) | 08:37 | |
(2 3) | |||
> $c Z+ (1,3) | |||
What does that mean? | |||
demostanis[m] < libera.ems.host/_matrix/media/r0/d...essage.txt > | 08:38 | ||
holyghost | m: (2,3) Z+ (1,3) | ||
camelia | Potential difficulties: Useless use of Z+ in sink context at <tmp>:1 ------> 3(2,3) 7⏏5Z+ (1,3) |
||
demostanis[m] | I get that same result, but not when I use a variable | ||
m: my $c = (2,3); $c Z+ (1,3) | |||
camelia | Potential difficulties: Useless use of Z+ in sink context at <tmp>:1 ------> 3my $c = (2,3); $c 7⏏5Z+ (1,3) |
||
moon-child | docs.raku.org/language/operators#Z...taoperator | 08:39 | |
demostanis[m] | m: my $c = (2,3); say $c Z+ (1,3) | ||
camelia | (3) | ||
holyghost | Z links 2 lists | ||
moon-child | demostanis[m]: you want to use @ for arrays | ||
m: my @c = (2,3); say @c Z+ (1,3) | |||
camelia | (3 6) | ||
holyghost | and + is the operator | ||
demostanis[m] | I really suck in Raku lol | 08:40 | |
moon-child | you don't suck, you're learning | ||
dakkar | m: my $c = (2,3); say @$c Z+ (1,3) | ||
camelia | (3 6) | ||
dakkar | demostanis[m]: also that | ||
demostanis[m] | What does @$ mean? | ||
dakkar | short version: a `$` variable is "a single thing" | ||
holyghost | $c in list context | 08:41 | |
moon-child | @$x means 'use the variable named $x, but pretend it was declared as @x' | ||
dakkar | m: my $c = (2,3); say $c.raku; say (@$c).raku | ||
camelia | $(2, 3) (2, 3) |
||
dakkar | notice that `$` in front of the first line of output, which means "consider the following to be a single thing" | ||
(I'm not good at explaining this…) | 08:42 | ||
demostanis[m] | Don't worry I understoood | ||
moon-child | demostanis[m]: more on sigils here docs.raku.org/language/variables#Sigils | ||
($ and @ are sigils) | 08:43 | ||
09:13
evalable6 left,
linkable6 left,
holyghost left
09:14
lucerne joined,
evalable6 joined,
linkable6 joined
09:36
lucerne left
10:36
evalable6 left,
linkable6 left
10:38
linkable6 joined
10:39
evalable6 joined
11:32
sono left
|
|||
demostanis[m] | pastebin.com/raw/PzuDf1wy I don't understand why my code doesn't work. It looks like it's not seeing that 'cid' is in the gathered list. | 11:56 | |
lizmat | and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2021/06/22/2021-...all-steps/ | 11:57 | |
with apologies for being 1 day late | 11:58 | ||
12:02
reportable6 left
12:04
RandalSchwartz left
|
|||
moritz | lizmat++ | 12:04 | |
12:05
reportable6 joined
12:07
holyghost joined
12:10
frost left
12:41
holyghost left
|
|||
dakkar | demostanis[m]: those `.say` are confusinc your code, sorry | 13:16 | |
m: 1 ∈ gather { take 1; take 2 } | |||
camelia | WARNINGS for <tmp>: Useless use of "∈" in expression "1 ∈ gather { take 1; take 2 }" in sink context (line 1) |
||
dakkar | m: say 1 ∈ gather { take 1; take 2 } | ||
camelia | True | ||
dakkar | m: say 1 ∈ gather { take 1; take 2 }.say | ||
camelia | (1 2) False |
||
dakkar | demostanis[m]: that's because you're checking if 'cid' is in *the return value of `say`* | 13:17 | |
and that's not what you mean | |||
remove the inner `.say`, and it should work | |||
13:28
holyghost joined
|
|||
holyghost | I'm a bit more afk the following approx. 2 weeks as of RL etc. There's Game::Decision which now has 3-4 API methods and AI::NLP will be on hold now. HAND. | 13:29 | |
13:29
holyghost left
|
|||
demostanis[m] | <dakkar "demostanis: that's because you'r"> I already tried, it does the same | 13:41 | |
dakkar | demostanis[m]: ok, you *also* miss a loop | 13:43 | |
demostanis[m] | Where? | 13:44 | |
dakkar | inside the inner gather | 13:45 | |
that `if` runs only once | |||
demostanis[m] | That's what it's supposed to do? | ||
dakkar | sorry, yes, sort of, I had mis-read the regex | ||
demostanis[m] | It's saying 'cid' is not in the gathered list | 13:47 | |
dakkar | pastebin.com/Q5cR03A7 | 13:48 | |
you were taking the stringification of a match containing multiple sub-matches | 13:49 | ||
so instead of <<hcl eyr pid>>, you were taking 'hcl eyr pid' | |||
so the ∈ failed | 13:50 | ||
demostanis[m] | Oh rightt. | ||
dakkar | `take $_ for $0.list>>.Str` works (there may well be a prettier way to do that) | ||
13:54
frost joined
|
|||
demostanis[m] | What does ~$0 exactly do? Why does it convert a match to all matches? | 13:54 | |
It seems like it does | 13:55 | ||
moritz | the ~ just converts the $0 to a string | 13:57 | |
and $0 is the same as $/[0], so the first positional capture of a match object | |||
dakkar | m: say '123' ~~ /(\d)+/ | 14:00 | |
camelia | 「123」 0 => 「1」 0 => 「2」 0 => 「3」 |
||
dakkar | if a match is repeated, it will contain a list of sub-matches | ||
tbrowder | raydiak: pls let us know when you can access docs.raku.org (i just tried and still no joy) | 14:07 | |
MasterDuke | coincidentally, just a couple minutes ago i got an email from sky saying they don't have docs.raku.org on their block list, so i removed my account exception and yeah, i can get there now (couldn't yesterday without the exception) | 14:11 | |
14:17
Sgeo joined
14:20
frost left
|
|||
demostanis[m] | pastebin.com/4JgyStVW | 14:30 | |
What does `The iterator of this Seq is already in use/consumed by another Seq | |||
(you might solve this by adding .cache on usages of the Seq, or | |||
by assigning the Seq into an array) | |||
` mean? | |||
14:41
pragma- left
|
|||
moritz | demostanis[m]: you can only iterate (or index into, or count the elements of) a sequence once | 14:54 | |
if you try to to it twice, you'll get that error message | 14:55 | ||
m: my \seq = gather { take 1; take 2; take 3 }; .say for seq; .say for seq | |||
camelia | 1 The iterator of this Seq is already in use/consumed by another Seq (you might solve this by adding .cache on usages of the Seq, or by assigning the Seq into an array) in block <unit> at <tmp> line 1 2 3 |
||
moritz | m: my \seq = gather { take 1; take 2; take 3 }; .say for seq.cache; .say for seq | ||
camelia | 1 2 3 1 2 3 |
||
14:59
morte_ joined
15:01
morte_` joined,
morte_` left,
morte_` joined
15:04
morte_ left
15:06
morte_` is now known as morte_
|
|||
demostanis[m] | Thanks, I didn't know. Why those restrictions? | 15:09 | |
dakkar | demostanis[m]: because, in principle, Seq are lazy and infinitely long | 15:10 | |
also because, if they were generated with a gather/take, to scan them again would require running the code again (with all its side-effects &c, which is usually a bad idea) | 15:11 | ||
if you want to treat a Seq like a list or an array, you can (as the error message says) call `.cache` on it, or assign it to an array | 15:12 | ||
15:13
Doc_Holliwood left
|
|||
dakkar | demostanis[m]: additional confusing detail„ | 15:13 | |
the bit of your code that triggers that error is the `all` | 15:14 | ||
15:14
Doc_Holliwood joined
|
|||
dakkar | `all(<1 2 3>) ∈ @something` is the same as `all( 1 ∈ @something, 2 ∈ @something, 3 ∈ @something )` | 15:14 | |
(roughly) | |||
so your code is trying to go through the result of the inner `gather` more than once | 15:15 | ||
which produces the error message | |||
demostanis[m] | Ah I get it now. Could the error message be improved? | ||
dakkar | maybe? I'm pretty sure suggestions are always welcome | ||
to solve your problem, I think the simplest way is to do `my @keys = gather { ... }; take $i if all(...) ∈ @keys;` | 15:16 | ||
demostanis[m] | At least to say the subroutine that throws the error, not just the line | ||
dakkar | (or not use the inner `gather` at all) | ||
15:16
morte_` joined
|
|||
dakkar | demostanis[m]: you have no subroutines | 15:17 | |
demostanis[m] | the all? | ||
dakkar | ah, ok… I *think* that's very complicated to do, but feel free to open an issue on github about it | 15:18 | |
but generally, sequences and gather/take are used when you don't know the size of the input, like when reading files or sockets | 15:19 | ||
in your case, you have fixed input sizes, just use `for` loops | |||
(yes, I know this is not generally applicable, and that understanding the various concept is valuable in itself) | 15:20 | ||
15:21
morte_ left
|
|||
Altreus | m: sub xp-for-lvl($lvl) { 5 * ($lvl ^ 2) + (50 * $lvl) + 100 }; xp-for-lvl(1) | 15:39 | |
camelia | ( no output ) | ||
Altreus | m: sub xp-for-lvl($lvl) { 5 * ($lvl ^ 2) + (50 * $lvl) + 100 }; xp-for-lvl(1).say | ||
camelia | one(155, 160) | ||
Altreus | why does this return a one()? | ||
dakkar | because ^ is not the power operator | 15:40 | |
Altreus | oh :D | ||
thanks | |||
dakkar | (it's the infix version of `one`; it's spelled like that because it's semantically similar to the xor operator, which is historically written as ^, blame C, or maybe BCPL) | 15:42 | |
dakkar learns a lot by looking at other people's code and mistakes | 15:44 | ||
Altreus learns a lot by making them | 15:45 | ||
16:10
_________ is now known as noodly,
noodly is now known as __________
16:11
__________ is now known as _________
|
|||
ptc wonders what the new libera "two week two hour rule" will mean for lurkers... | 16:13 | ||
dakkar | ptc: it says "accounts that are older than two weeks but were last used within two hours of registration< | 16:14 | |
so as I registered more than two weeks ago, but I used my account today (by logging in), I'm not going to get expired | 16:15 | ||
ptc | yeah, but also if one is going to be offline for a longer period of time, then one has to contact the staff... | ||
jast | yeah, everyone who used their account beyond the first two hours after registering is not affected by the new rule | ||
ptc | does that mean that one can't go on holiday for e.g. 4 weeks? | ||
dakkar | ptc: no, it does not mean that | ||
jast | the normal expire time (if you're not affected by the new rule) is 10 weeks | ||
ptc | jast: ah, ok. I'd read that differently | ||
jast: cool, thanks for the explanation :-) | 16:16 | ||
so... I'm guessing I'm ok now? | |||
jast | new rule is designed specifically to get rid of squatters | ||
Altreus | You have to contact staff if you register a nick, log in within 2 hours, and then immediately leave on holiday :P | ||
ptc | yeah, that's what it looks like. | ||
Altreus: :-D | 16:17 | ||
Altreus | of course if you're back within 2 weeks that's fine too | ||
I wonder what "used" means, cos if they hadn't had network issues I doubt I would have logged in since I registered | |||
jast | it's all in the explanation | 16:18 | |
"used" basically means you're signed in with it | |||
Altreus | It defines used but it also fails to define it | ||
jast | I only know a single IRC network that ever got this wrong | 16:19 | |
there, if someone from the auto-op list didn't rejoin a channel every two weeks, the channel would get dropped | |||
ptc | I only read the diff mentioned in the github.io link and hence lacked the rest of the context. I've just read the rest and it makes much more sense now. | ||
thanks for everyone's help! | |||
Altreus | ah, here's me thinking the link would be relevant in isolation | 16:22 | |
jast | you can expand the view to get the rest of the info, but it's not shown fully by default | 16:28 | |
Altreus | It's a me-problem, not bothering to see if my question is answered in the things I'm not seeing | ||
16:35
dakkar left
16:44
Eddward joined
17:05
morte_``` joined
17:09
morte_` left
17:12
jess left
17:14
bd3i joined
17:21
melezhik joined
17:28
tadzik is now known as ts
17:29
ts is now known as t,
t is now known as Guest1648,
Guest1648 is now known as tadzik
17:54
bd3i left
18:01
ufobat__ joined
18:03
reportable6 left
18:04
reportable6 joined,
ufobat_ left
18:11
xinming_ is now known as xinming
|
|||
sjn | heya folks. | 18:15 | |
Do we have a short name for modules.raku.org? "MRO" seems kinda confusing to me. :-) | |||
lizmat | raku.land ? | 18:24 | |
tellable6 | hey lizmat, you have a message: gist.github.com/156ec6da6b5d710af5...75ba3ae57d | ||
SmokeMachine | Hi you all! How can I do a regex that accepts and opening "stuff" and its closing pair? | 18:27 | |
ugexe | '<' ~ '>' ? | 18:28 | |
SmokeMachine | I mean any opening | 18:29 | |
ugexe | im not sure there is any concept of what the opposite pair is in unicode | 18:30 | |
codesections | There is, actually, for a number of pair | 18:31 | |
S/pair/pairs/ | |||
SmokeMachine | something like: my %pairs = "<" => ">", "[" => "]", "(" => ")", "{" => "}"; /{ %pairs.keys } ~ { %pairs{ $0 } } [ something ]/; but better (I don't know if that works) | 18:32 | |
ugexe | i dont think you can get around creating your own mapping | ||
codesections | hold on, I'm pretty sure you can. I went down a rabbit hole about this a while back… | 18:34 | |
SmokeMachine | I feel like that should be native... shouldn't it? | 18:36 | |
(and easy) | |||
ugexe | depends, what is the opposite of L? | ||
18:37
abraxxa-home joined
|
|||
ugexe | any solution would certainly be specific to a certain type of character | 18:37 | |
SmokeMachine | I mean, it should exist a list of openings and closings (and a closing for each opening) | ||
I mean, like #`<...>, #`(...), #`{{{...}}}, etc... we already have it on our source code... | 18:38 | ||
ugexe | those arent three things are not the same so it wouldnt surprise me to find there is no mechanism used to determine the closing character from the opening character | 18:42 | |
well for a comment they might be the same, but generally not | |||
SmokeMachine | I feel like doing that on a regex should be easy... shouldn't it? | 18:43 | |
codesections | got it! | ||
ugexe | probably | ||
SmokeMachine | codesections: how? | 18:44 | |
codesections | no, I mean I figured out how to do it | ||
m: my regex R { :my $mirror; . {$mirror = $/.uniprop('Bidi_Mirroring_Glyph')} .* (.) <?{$mirror eq $0 }> }; say '()' ~~ /<R>/; | |||
camelia | 「()」 R => 「()」 0 => 「)」 |
||
codesections | m: my regex R { :my $mirror; . {$mirror = $/.uniprop('Bidi_Mirroring_Glyph')} .* (.) <?{$mirror eq $0 }> }; say '(>' ~~ /<R>/; | ||
camelia | Nil | ||
SmokeMachine | m: my regex R { :my $mirror; . {$mirror = $/.uniprop('Bidi_Mirroring_Glyph')} .* (.) <?{$mirror eq $0 }> }; say '<>' ~~ /<R>/; say '[]'~~/<R>/ | 18:46 | |
camelia | 「<>」 R => 「<>」 0 => 「>」 「[]」 R => 「[]」 0 => 「]」 |
||
ugexe | does it work with ~ ? | ||
SmokeMachine | it seems to: | 18:48 | |
m: m: my regex R { :my $mirror; . {$mirror = $/.uniprop("Bidi_Mirroring_Glyph")} ~ [(.) <?{$mirror eq $0 }>] .*? }; say "<>" ~~ /<R>/; say "[]"~~/<R>/ | |||
camelia | 「<>」 R => 「<>」 0 => 「>」 「[]」 R => 「[]」 0 => 「]」 |
||
ugexe | it feels like `$mirror = $/.uniprop("Bidi_Mirroring_Glyph")` shouldnt be needed if the first character was captured | 18:49 | |
SmokeMachine | don't you feel that should be easier? | ||
ugexe | SmokeMachine: that captures the brackets along with the text | 18:50 | |
codesections | ugexe: yeah, that seems right. That was just a proof of concept/me remembering how it went | ||
SmokeMachine | m: my regex R { :my $mirror; . {$mirror = $/.uniprop("Bidi_Mirroring_Glyph")} ~ $mirror .*? }; say "<>" ~~ /<R>/; say "[]"~~/<R>/ | 18:51 | |
camelia | 「<>」 R => 「<>」 「[]」 R => 「[]」 |
||
ugexe | m: my regex R { :my $mirror; . {$mirror = $/.uniprop("Bidi_Mirroring_Glyph")} ~ $mirror .*? }; say "[foo]"~~/<R>/ | 18:52 | |
camelia | 「[foo]」 R => 「[foo]」 |
||
ugexe | there is no 'foo' match | ||
just [foo] | |||
SmokeMachine | m: my regex R { :my $mirror; . {$mirror = $/.uniprop("Bidi_Mirroring_Glyph")} ~ $mirror $<content>=.*? }; say $<content> if "[foo]"~~/<R>/ | 18:53 | |
camelia | Nil | ||
SmokeMachine | m: my regex R { :my $mirror; [. {$mirror = $/.uniprop("Bidi_Mirroring_Glyph")}] ~ $mirror $<content>=.*? }; say "[foo]"~~/<R>/ | 18:54 | |
camelia | 「[foo]」 R => 「[foo]」 content => 「foo」 |
||
ugexe | oh yeah | ||
the big problem with this is handling escaped characters | |||
github.com/ugexe/zef/blob/602c54f1...akumod#L18 this attempts to handle escaped characters | 18:55 | ||
SmokeMachine | m: my regex R { :my $mirror; [. {$mirror = $/.uniprop("Bidi_Mirroring_Glyph")}] ~ [<!after \\>$mirror] $<content>=.*? }; say "[foo]" ~~ /<R>/; say "[foo\[bar\]]" ~~ /<R>/ | 18:56 | |
camelia | 「[foo]」 R => 「[foo]」 content => 「foo」 「[foo[bar]」 R => 「[foo[bar]」 content => 「foo[bar」 |
||
ugexe | use an unbalanced closing brakcet | ||
m: my regex R { :my $mirror; [. {$mirror = $/.uniprop("Bidi_Mirroring_Glyph")}] ~ [<!after \\>$mirror] $<content>=.*? }; say "[foo]" ~~ /<R>/; say "[f\]oo]" ~~ /<R>/ | 18:57 | ||
camelia | 「[foo]」 R => 「[foo]」 content => 「foo」 「[f]」 R => 「[f]」 content => 「f」 |
||
ugexe | that should be f\]oo | ||
s/should/what you probably want/ | |||
codesections | you could always keep a count of nesting depth | 18:59 | |
(and maybe use <~~> instead of ~) | |||
ugexe | '<' ~ '>' [<( [[ <!before \>|\<|\\> . ]+?]* %% ['\\' . ]+ )>] | ||
without the auto-closing-bracket stuff its possible like this | |||
19:03
MoC joined
19:09
MoC left
|
|||
guifa | Note that a Bidi mirroring glyph is separate/distinct to the idea of the opening and closing . Bidi only says "you can use this glyph when in RTL mode". „ for instance, is used as an opening quotation mark (whose closing pair is ” ), but has no Bidi mirror glyph (AFAICT) because there's only a single reversed comma | 19:27 | |
⹁⹁ doesn't exist as a single character | 19:28 | ||
19:28
morte_``` left
|
|||
codesections | guifa, maybe you know: why doesn't this work: | 19:28 | |
m: say unimatch '[', 'Bidi_Mirroring_Glyph', ']' | 19:29 | ||
camelia | False | ||
codesections | m: say uniprop '[', 'Bidi_Mirroring_Glyph' # even though | ||
camelia | ] | ||
codesections | m: say '[' ~~ / <:Bidi_Mirroring_Glyph<]>> / # what I really want | 19:31 | |
camelia | Nil | ||
guifa | hmm | ||
lemme do some tests | |||
codesections | guifa++ don't spend long on it – it's not something I have a use for atm; just something that's been bugging me for the paste few months | 19:33 | |
S/paste/past/ | |||
19:34
MoC joined
|
|||
codesections | er, I guess I wrote that blog post in September. So for the past ~9 months… | 19:35 | |
guifa | codesections: it's simple, the order's not what you expected ;-) | ||
say unimatch '[', ']', 'Bidi_Mirroring_Glyph'; | |||
evalable6 | False | ||
guifa | say unimatch '[', 'x', 'Bidi_Mirroring_Glyph'; | 19:36 | |
evalable6 | False | ||
codesections | I was about to say that I thought I'd tried that :) | ||
19:37
_ed joined
|
|||
guifa | remember though, verticality is not mirrored — the bidi mirror glyph is really just for display engines to use as a fallback for a poorly encoded font | 19:37 | |
so | 19:38 | ||
m: say unimatch '「', '」', 'Bidi_Mirroring_Glyph' | |||
camelia | Error encoding ASCII string: could not encode codepoint 65379 in block <unit> at <tmp> line 1 |
||
guifa raises eyebrow | |||
19:38
ufobat__ left
|
|||
guifa | and huh, they did make that the mirrored form, weird. That feels weird to me | 19:39 | |
19:42
sono joined
|
|||
codesections | m: say unimatch ['{'], '}', 'Bidi_Mirroring_Glyph' # aha! ...but odd | 19:43 | |
camelia | True | ||
19:43
sono left
|
|||
codesections | er | 19:43 | |
m: say unimatch ['{'], 'X', 'Bidi_Mirroring_Glyph' # aha! ...but odd | |||
camelia | True | ||
codesections | nvmd.. | ||
guifa | m: (uniprop $_, 'Bidi_Mirroring_Glyph' for <「 」 ⸢ ¿ ? „ , “ ⁅ ‹ ⁈〖 〗 ”> ).join.say | 19:46 | |
camelia | 」「⸣⁆›〖 | ||
guifa | ^^don't trust it to much, I guess is what I'm saying ;-) | 19:47 | |
codesections | fair | ||
m: say 'Ⅴ'.unimatch('5', 'Numeric_Value'); | 19:48 | ||
camelia | False | ||
codesections | bisectable6: 'Ⅴ'.unimatch('5', 'Numeric_Value'); | ||
bisectable6 | codesections, Will bisect the whole range automagically because no endpoints were provided, hang tight | ||
codesections, ¦6c (55 commits): «» | |||
codesections, Nothing to bisect! | |||
codesections | I thought that used to work… | ||
guifa | weird, I get True for that | 19:50 | |
tio.run/##K0gtyjH7/784sVJB/VHrEnW9...JUdU3r//8B | 19:51 | ||
guifa is at office so using TIO | |||
MasterDuke | i get false | ||
committable6: releases say 'Ⅴ'.unimatch('5', 'Numeric_Value') | |||
committable6 | MasterDuke, gist.github.com/9e942e5046db1d3a7c...5b38e5bd16 | 19:52 | |
guifa wonders if unicode made adjustments ? | |||
codesections | those are non-continuous ranges… | 19:53 | |
MasterDuke | bisectable6: old=2020.12 new=2021.02.1 say 'Ⅴ'.unimatch('5', 'Numeric_Value') | ||
bisectable6 | MasterDuke, Bisecting by output (old=2020.12 new=2021.02.1) because on both starting points the exit code is 0 | ||
MasterDuke, bisect log: gist.github.com/88f4e219f585581d01...103ea52b72 | |||
MasterDuke, (2021-01-18) github.com/rakudo/rakudo/commit/63...de03a25ce7 | |||
MasterDuke | hm, yeah, i thought it was supposed to show contiguous ranges | 19:54 | |
guifa | codesections: it's three distinct ranges, two false with a true in between. Likely the 2015-2016 period was before that property was accessible and/or before it was added to UCD | ||
codesections | makes sense | ||
MasterDuke | yeah, but i thought it should show a false range, true range, false range | 19:55 | |
codesections | yeah, which must be a regression from the commit it returned | ||
AlexDaniel | Committable doesn't, but bisectable does | 19:56 | |
bisectable6: say 'Ⅴ'.unimatch('5', 'Numeric_Value') | |||
bisectable6 | AlexDaniel, Will bisect the whole range automagically because no endpoints were provided, hang tight | ||
AlexDaniel | Let's try | ||
guifa | Yeah, false (not coded into Raku), true (made available in Raku), and false (some interesting reason) | ||
bisectable6 | AlexDaniel, Output on all releases: gist.github.com/b821ff40a5053f46df...5f1cb7848d | ||
AlexDaniel, bisect log: gist.github.com/a81b4d6fa42e37af0f...37807d6520 | |||
AlexDaniel, Output on all releases and bisected commits: gist.github.com/d1e15a891c0dcf618d...589252c983 | |||
MasterDuke | ah, nice | 19:57 | |
AlexDaniel | Ok, not nice... Didn't exactly work | ||
guifa | And of course, Unicode's website is currently down for some reason so I can't go peaking at what may have changed | ||
AlexDaniel | But good effort, thank you, bisectable | ||
guifa | (Properties are subject to change between releases) | 19:58 | |
19:58
_ed left
|
|||
codesections | guifa: but if that's the explanation, then there's a bug with uniprop, since it still shows the same values | 19:59 | |
guifa | github.com/rakudo/rakudo/blob/10c3...2021.02.md | 20:03 | |
vrurg | Am I the only one for whom t/spec/S26-documentation/02-paragraph.t fails to pass? Weirdly enough, the test last changed in 2020 and somehow it currently fails on 2021.06 too. | 20:05 |
|