🦋 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 | |
20:05
MoC left
20:07
morte_``` joined
|
|||
MasterDuke | complaining about Pod::To::Text? | 20:07 | |
vrurg | Aha | ||
Same on 2021.05. I give up... | 20:08 | ||
MasterDuke | # expected out: "ababc\n" | ||
# got err: "\x[1B]===\x[1B]SORRY!\x[1B]===\x[1B] Error while compiling /tmp/getout-2137719-640515.code\nCould not find Pod::To::Text in: <.........> | |||
vrurg | Exactly. | 20:09 | |
MasterDuke | i had a bunch of deserialization segfaults and such recently, which i fixed by nuking my ~/.raku/precomp directory. i thought it would also fix that, but sadly not | 20:10 | |
vrurg | Since it fails for past rakudo releases I think it's something in moar/nqp since they remain at the latest version. | 20:11 | |
20:11
_ed joined
|
|||
Doc_Holliwood | is there another way to enforce eagerness but the keyword? | 20:13 | |
context: twitter.com/HrBollermann/status/14...2368778246 | 20:14 | ||
guifa | Okay, the best I can come up with the unimatch issue is this commit | 20:15 | |
github.com/rakudo/rakudo/commit/63...6f3d0b30e8 | |||
That lines up timewise with there being a problem. It notes a bug fix in MoarVM, so maybe there's a mismatch between MVM and Rakudo versions that are causing the issue | |||
codesections | guifa: isn't that the one commitable returned earlier? | 20:16 | |
guifa | Nope. In order you get 2020.11 = OK, 2020.12 = OK, 2021.02 = NOK | 20:17 | |
codesections | hmm, well I was looking at that commit by following *some* link from ^^^ | 20:18 | |
guifa | unless I'm misreading the output from MasterDuke 's query | ||
MasterDuke | bisectable6 found that commit | 20:20 | |
"MasterDuke, (2021-01-18) github.com/rakudo/rakudo/commit/63...e03a25ce7" | |||
AlexDaniel | easy test I like to do | ||
guifa totally missed that link. There were so many haha | 20:21 | ||
AlexDaniel | c: 6306f1e0^,6306f1e0 say 'Ⅴ'.unimatch('5', 'Numeric_Value') | ||
committable6 | AlexDaniel, ¦6306f1e0^: «True» ¦6306f1e: «False» | ||
20:25
_ed left
20:44
_ed joined
|
|||
moon-child | m: sub f { say $x; my $x = 5 }; f() | 20:54 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$x' is not declared at <tmp>:1 ------> 3sub f { say 7⏏5$x; my $x = 5 }; f() |
||
20:54
jdporter joined
|
|||
moon-child | m: sub f { EVAL 'say $x'; my $x = 5 }; f() | 20:54 | |
camelia | (Any) | ||
moon-child | ^^ bug? | ||
jdporter | what were you expecting? | 20:56 | |
moon-child | an error | 20:57 | |
21:01
jdporter left
21:02
hazeleiez joined,
hazeleiez left,
hazeleiez joined
21:05
hazeleiez left
21:18
sono joined
|
|||
ugexe | m: say $::("x"); my Int $x = 5; | 21:21 | |
camelia | (Int) | ||
ugexe | m: say $::("x"); BEGIN my Int $x = 5; | ||
camelia | 5 | ||
21:28
abraxxa-home left
21:40
morte_``` left
21:41
morte_` joined
21:49
_ed left
21:50
morte_` left,
morte_``` joined
21:56
_ed joined
21:58
morte_``` left
22:10
_ed left
22:18
_ed joined
|
|||
JRaspass | What's a good way to get errno via Nativecall under musl and glibc, cglobal ("c", v6), "errno", int32 only works for glibc, I was hoping I could leave out the library name like you can for the native trait but so far no joy. | 22:19 | |
moon-child | I'm actually surprised that worked at all | 22:22 | |
JRaspass | Oh? How are you meant to check what the error is after a syscall then? | 22:23 | |
moon-child | sub __errno_location returns Pointer[int32] is native { ... } | ||
(should work for glibc and musl, not for other platforms) | 22:24 | ||
JRaspass googles what that is, fwiw the errno example is in the docs | |||
here docs.raku.org/language/nativecall#..._variables | |||
moon-child | because errno is tls, and tls wasn't historically in spec. So non-gnu compilers couldn't handle a header with something like __thread int errno. So instead it was implemented as a function | ||
that example should probably be changed, because it is not at all portable | 22:27 | ||
JRaspass | Huzzah, your native sub with this calling convention seems to work: strerror(__errno_location.deref) | 22:28 | |
many thanks | 22:30 | ||
22:31
_ed left
22:35
_ed joined
22:39
_ed left
22:41
melezhik left
22:43
rassoc joined
|
|||
rassoc | say, do we have something like ruby's swapcase in the stdlib? "AbCd".swapcase => "aBcD" | 22:45 | |
guifa | rassoc: I actually was just looking at that a few days ago and … no | 22:46 | |
rassoc | ah, a shame, but thanks for the quick response! | ||
codesections | not as a method, but you can do it with a regex of the same length as .swapcase | 22:47 | |
rassoc | let me check the docs | 22:48 | |
[Coke] | first time building? what's the error? | 22:50 | |
22:51
_ed joined
|
|||
codesections | hmm, actually, maybe that's not quite as nice as I was thinking... | 22:51 | |
22:55
_ed left
|
|||
rassoc | not really finding anything in the docs that does what i want. will just juggle some .ords since i only have to support ascii, i think | 22:56 | |
alright, have a good one! | |||
codesections | rassoc: oh, I see it | 22:57 | |
m: say 'AbCd'.trans: /<:Lu>/ => $/.lc, /<:!Lu>/ => $/.uc, :g | 22:58 | ||
camelia | Use of Nil.lc coerced to empty string in block <unit> at <tmp> line 1 Use of Nil.uc coerced to empty string in block <unit> at <tmp> line 1 |
||
codesections | m: say 'AbCd'.trans: [/<:Lu>/, /<:!Lu>/] => [$/.uc, $/.lc], :g | 22:59 | |
camelia | Use of Nil.uc coerced to empty string in block <unit> at <tmp> line 1 Use of Nil.lc coerced to empty string in block <unit> at <tmp> line 1 |
||
codesections | hmm? | ||
m: say 'AbCd'.trans: /<:Lu>/ => $/.lc, :g | |||
camelia | Use of Nil.lc coerced to empty string bd in block <unit> at <tmp> line 1 |
||
codesections | m: say 'AbCd'.trans: /<:Lu>/ => $/.lc | 23:00 | |
camelia | Use of Nil.lc coerced to empty string bd in block <unit> at <tmp> line 1 |
||
23:00
slu left
|
|||
codesections | hm, that's working locally. Odd! | 23:01 | |
moon-child | codesections: for me, 'AbCd'.trans: /<:Lu>/ => $/.lc, /<:!Lu>/ => $/.uc, :g evaluates to aAaA | ||
codesections | ? hmmm | 23:02 | |
moon-child | but, hmm, only at the repl. In a file it doesn't | ||
nor raku -e | |||
codesections | oh! I think .trans doesn't set $/, so we're both getting incorrect results based on what we have as our prior match | 23:03 | |
in the REPL | |||
moon-child | oh, I see | 23:04 | |
(also, raku has strict evaluation, so arguments are evaluated ahead of time, so they wouldn't get the new $/ even if trans did set it) | |||
guifa | Yeah, and trans wasn't designed to work with callable. | ||
moon-child | would be cool if trans could take functions, so you could say 'AbCd'.trans: /<:Lu>/ => &lc | 23:05 | |
codesections | moon-child: oh, that's what it is. .trans is setting it, but for the _next_ call (in the REPL) | ||
23:08
_ed joined
|
|||
codesections | so is something like this ugly beast really the best we can do? vvvv | 23:08 | |
m: say 'AbCd'.comb».&{/<:Lu>/ ?? .lc !! .uc}.join | |||
camelia | aBcD | ||
guifa | I mean, I had | 23:09 | |
m: my &swapcase = {.comb.map({my \c=.uniprop;c eq'Ll'??.uc!!c eq'Lu'??.lc!!$_ }).join}; say "aBcdÈfGhî".&swapcase | |||
camelia | AbCDèFgHÎ | ||
rassoc | there is this also: | 23:12 | |
23:12
_ed left
|
|||
rassoc | m: say 'AbCd'.trans: [['a'..'z'], ['A'..'Z']] => [['A'..'Z'], ['a'..'z']] | 23:12 | |
camelia | aBcD | ||
rassoc | any golfing ideas? | ||
guifa | rassoc: that won't work for all alphabetic input though | ||
codesections's is probably the most golfed we can get, if you take out the spaces | 23:13 | ||
moon-child | 'AbCd'.trans: .trans: (my @x = [['a'..'z'], ['A'..'Z']]) => @x.reverse | ||
s/.trans: // | |||
guifa | m: my &swapcase = {.comb.map({/<:Lu>/??.lc!!.uc}).join}; say "aBcdÈfGhî".&swapcase | 23:16 | |
camelia | AbCDèFgHÎ | ||
guifa | Then you can just use $your-string.&swapcase | ||
moon-child | or just swapcase $your-string | 23:17 | |
rassoc | m: my &swapcase = {.comb.map({/<:Lu>/??.lc!!.uc}).join}; say "aB!".&swapcase | 23:18 | |
camelia | Ab! | ||
rassoc | sweet! might use that when dealing with non-ascii stuff. thanks! | ||
m: my &swapcase = {.comb.map({/<:Lu>/??.lc!!.uc}).join}; say "aBß".&swapcase | 23:19 | ||
camelia | AbSS | ||
rassoc | slick! | ||
guifa | Note that it's based on Unicode's mapping, so case isn't per se reversible | ||
23:20
sono left
|
|||
rassoc | that's alright, behaves just like ruby's swapcase as far as i can tell | 23:21 | |
23:25
m6502 joined
23:50
_ed joined
|
|||
codesections | guifa: it just occurred to me that the way Raku could solve ^^^^ is to add a '#' flag to .subst, following `date`s clean design | 23:52 | |
tonyo | m: say S:g/ $<lc> = <:Lu> || $<uc> = <:!Lu> /{$<lc>??$<lc>.lc!!$/.uc}/ given "AbCd" | ||
camelia | aBcD | ||
codesections | the fact that you save the char into a $<lc> capture if it's upper case really bugs me :D | 23:53 |