🦋 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.
00:01 _jrjsmrtn left
guifa codesections: you move too fast 00:02
I'm in the middle of typing up a like two page justification :-)
codesections ha, sorry :)
00:02 reportable6 left 00:04 reportable6 joined 00:29 RaycatWhoDat joined, holly_ joined
RaycatWhoDat If I wanted to create different syntax for named captures, how would I do that in Raku? 00:29
i.e. I would like to declare something like m:g/ ^ $<firstName>=.+ ' ' $<lastName>=.+ $ / as m:g/ ^ @firstName ' ' @lastName $ / 00:30
Or some sort of syntax where I can just use a container name and Raku knows to bind whatever matches that to those containers 00:31
guifa You mean something like m:g/ ^$<first>=@first $/ ? 00:44
my @first = <John Sally Bob>; say "John" ~~ / $<first>=@first /
evalable6 「John」
first => 「John」
guifa codesections: my treatise is posted ;-) 00:45
codesections: and updated to fix a few things 00:52
RaycatWhoDat guifa, not exactly. I mean, capturing everything that part of the match into a variable named such 00:57
github.com/RayMPerry/kitchen-sink/...-parse.txr 00:58
So, on line 4, given a line of a CSV file, it will take the longest match of characters and bind it to `first_name` to be used later 00:59
So, I was wondering if there was anything that could do that. If there isn't, how hard would it be to implement? 01:00
guifa If you need to use it in the regex itself, not too bad: 01:01
m: 'abcdefc' ~~ / $<foo>='c' .*? $<foo> /; say $/
camelia 「cdefc」
foo => 「c」
guifa but if you want to use it outside of the regex, you'd need to create a regex slang
And … that's hard :-) 01:02
RaycatWhoDat Gotcha 01:04
guifa also codesections given our previous discussion on infix:<eqv> 01:18
m: my $a = Date.new: :2021year, :1month, :1day, :formatter{'A'}; my $b = $a.clone: :formatter{'B'}; say $a eqv $b; 01:19
camelia True
guifa but they have different formatter attributes :-)
01:29 evalable6 left, linkable6 left 01:30 evalable6 joined 01:31 linkable6 joined 01:32 RaycatWhoDat left
codesections guifa: that seems like an excellent example of why &[eqv] shouldn't work that way. 01:46
guifa ah but where it gets more interesting is
m: my $a = Date.new: :2021year, :1month, :1day, :formatter{'A'}; my $b = $a.clone: :formatter{'B'}; say $a.raku; say $b.raku
camelia Date.new(2021,1,1)
codesections m: my $a = Date.new: :2021year, :1month, :1day, :formatter{'A'}; say $a.^attributes.map({.has_accessor}) 01:47
camelia (True True True True True)
codesections I get why the .raku output is simplified (and agree that it should be). But two objects with different public attributes shouldn't be eqv 01:48
(I don't really think they should be with different private attributes, but I see the counter argument)
guifa To be fair, I don't think the formatter for Datish is really designed to be public 01:49
codesections it seems like a public, read-only attribute to me 01:50
(e.g., set via .new, updateable via .clone, viewable with an accessor ) 01:51
m: my $dt = Date.new: '2015-12-31', :formatter{sprintf "%02d/%02d/%04d", .month, .day, .year }; say Date.new('0000-01-01').formatter.($dt) 01:55
camelia Impossible coercion from 'Date' into 'Callable': no acceptable coercion method found
in block <unit> at <tmp> line 1
codesections m: my $dt = Date.new: '2015-12-31', :formatter{sprintf "%02d/%02d/%04d", .month, .day, .year }; my $b Date.new('0000-01-01'); say $b.formatter.($dt) 01:56
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3%02d/%04d", .month, .day, .year }; my $b7⏏5 Date.new('0000-01-01'); say $b.formatte
expecting any of:
infix stopper
codesections m: my $dt = Date.new: '2015-12-31', :formatter{sprintf "%02d/%02d/%04d", .month, .day, .year }; my $b = Date.new('0000-01-01'); say $b.formatter.($dt)
camelia Impossible coercion from 'Date' into 'Callable': no acceptable coercion method found
in block <unit> at <tmp> line 1
codesections ohh, b/c it's a Callable:U 01:57
m: my $dt = Date.new: '2015-12-31', :formatter{sprintf "%02d/%02d/%04d", .month, .day, .year }; my $b = Date.new('0000-01-01'); say $dt.formatter($b)
camelia Too many positionals passed; expected 1 argument but got 2
in block <unit> at <tmp> line 1
codesections m: my $dt = Date.new: '2015-12-31', :formatter{sprintf "%02d/%02d/%04d", .month, .day, .year }; my $b = Date.new('0000-01-01'); say $dt.formatter.($b)
camelia 01/01/0000
guifa ^^ why I think .fmt("%m/%d%Y" would be better ;-) 02:16
codesections Fair. Though, bikeshedding a bit, I wonder if it should be .date-fmt or something and also exposed as a sub. e.g., multi date-fmt(Str $fmt, Date $date) {...}; multi date-fmt(Str $fmt, Str $date-str) {...} 02:21
then you could do something like date-fmt("%m/%d/%Y", '2021-07-17') 02:22
(and that would avoid confusion with the other .fmt methods, which all use printf fmt string) 02:23
02:32 evalable6 left, linkable6 left, linkable6 joined 02:34 evalable6 joined
guifa Yeah, I thought about that. THe nice thing is that's a decision that can be made between writing the code and integrating it to the code base :-) 02:36
Also the one format code that's driving me made is N (for fractional seconds). It's an extension whose width clips it (unlike all the others), which basically requires special casing and destroys the elegance of my implementation =/ 02:40
elcaro some sloppy date parser/formatter I wrote a while ago: github.com/0racle/p6-dately 03:30
just playing with some ideas, but, yeah i would like some strptime/strftime functions 03:31
i've pulled them in via NativeCall somewhere
I'm no NativeCall export, so I think it's not perfect... lemme see if I can dig it up
03:34 linkable6 left, evalable6 left
elcaro NativeCall strftime/strptime: gist.github.com/0racle/67c4e9e8f51...1ac2162f3c 03:35
03:35 evalable6 joined, linkable6 joined
guifa elcaro: not too different in concept from what I've got (using a hash for all the different formatters), in particular 03:48
I avoided the grammar though to ramp up the speed 03:49
lemme get my posted onto Github 03:51
04:00 holly_ left
guifa github.com/alabamenhu/DateTimeFmt/...imeFmt.pm6 04:04
elcaro / codesections ^^ my first stab at a mostly NQP strftime. 04:07
04:14 tejr left, tejr joined
moon-child vrurg: in vrurg.github.io/arfb-publication/0...ject-mop/, the way you describe integers as working in raku actually predates c++ by at least a decade, having first appeared in smalltalk and lisp. (And actually raku's 'meta object protocol' is taken from common lisp.) And the way you describe integers as working in c++ comes from simula, which originated in the early 1960s. 04:24
I think it would be better to change the c++ reference to simula (with maybe a reference to c++, since people may not be familiar with simula), and mention the common lisp influence
04:29 Doc_Holliwood joined 04:47 RandalSchwartz left
elcaro guifa: I'll take your lib for a spin when I have time. Looks good. 05:19
05:25 jrjsmrtn joined 05:34 luk joined, luk left 05:35 luk123 joined 05:37 luk123 left 05:40 luk123 joined
luk123 weekly: raku tag on stackoverflow has now reached 500 watchers 05:40
notable6 luk123, Noted! (weekly)
05:40 luk123 left 06:02 reportable6 left 06:03 reportable6 joined 06:06 xinming left 06:17 m6locks left 06:26 ufobat_ joined, Doc_Holliwood left 06:42 abraxxa left, abraxxa joined 06:44 stoned75 joined 06:48 chrysanthematic joined 07:00 Sgeo left 07:07 chrysanthematic left 07:23 miriam_ joined 07:32 tejr left, tejr joined 07:34 xinming joined 07:35 tejr left 07:37 tejr joined 07:40 miriam_ left 08:25 frost joined 08:29 miriam_ joined 08:34 Doc_Holliwood joined 08:37 miriam_ left 09:06 MoC joined 09:15 MoC left 09:24 sono left 09:35 linkable6 left 09:37 linkable6 joined, MoC joined 09:51 abraxxa left 11:05 Doc_Holliwood left 11:12 frost left 11:31 linkable6 left 11:34 linkable6 joined 12:02 reportable6 left 12:03 squashable6 left, reportable6 joined 12:05 squashable6 joined 12:12 Xliff joined 12:30 marekh joined
Altreus When I start a github issue in Raku/vim-raku it says "If it's not related to highlighting or folding" ... 12:33
vim-raku doesn't appear to implement folding at all
at least I can't find anything that will fold
I feel like I shouldn't be opening an issue about implementing folding if someone's already mentioned it in the issue template 12:35
12:48 suman joined 12:57 suman left
vrurg moon-child: that section is not a historical introspection but rather outlines the path language development took. 13:27
13:27 suman joined
suman m: for 1..4 {say $_} 13:29
camelia 1
suman I thought this would also work 13:30
m: for 4..1 {say $_}
camelia ( no output )
[Coke] m: dd 1..4; dd 4..1
camelia 1..4
lizmat m: for 4 ... 1 { .say }
camelia 4
lizmat .. only goes up, ... also goes down 13:31
suman Hmm I see
13:32 RandalSchwartz joined
[Coke] docs for .. point to docs.raku.org/type/Range which mentions the ordering in the 5th paragraph. 13:32
weird that doc categories show .. as infix, but ... as routine 13:33
[Coke] wonders if the naming of ... was because ".., but moreso" 13:34
any pointers on using irssi to connect via TLS to libera? just changing the port gives an unable to connect, but no details about the actual error 13:39
13:42 Doc_Holliwood joined
moritz you need /connect -tls 13:44
moritz hopes he's not Captain Obvious 13:45
[Coke] no, I think the docs I've found assume you know way more about IRC than I do. :)
s/you know/one knows/
[Coke] gives up and will just connect unsecurely, he guesses. 13:47
13:52 [Coke] left, [Coke] joined
[Coke] (ok, closer with wiki.archlinux.org/title/Irssi, now I'm at least getting an error related to the certs) 13:54
13:56 jess left 13:57 linkable6 left, linkable6 joined 13:58 vrurg left
codesections m: &[...].candidates.say 14:04
camelia (&infix:<...> &infix:<...>)
codesections yeah, that seems like a doc error; ... is an infix 14:05
14:05 Kaiepi left 14:13 marekh left, Kaiepi joined 14:21 vrurg joined 14:33 mareksh joined 14:39 ufobat__ joined 14:42 ufobat_ left
gfldex lolibloggedalittle: gfldex.wordpress.com/2021/06/18/despotting/ 14:53
Altreus o hello 15:00
I see you're using the module I cannot find the time for
You're not wrong, it is fairly spotty :D 15:01
15:01 Sgeo joined 15:02 suman left 15:03 Doc_Holliwood left
Altreus gfldex: Many classes that are typically represented as a Str ... I take from your example you mean in the sense that a Channel is usually represented as its name? 15:03
a user is represented as @user#1234 15:04
[Coke] codesections: there's probabaly already a ticket for mis-categorized things in general, but having a specific one to fix isn't a bad thing.
Altreus gfldex: I don't mind adding methods that return the string you would use to represent the thing in a message 15:05
That might not be a terrible idea
I'm not sure I'd go as far as to make it stringify itself because I find that magic always trips me up at some point 15:06
I know kawaii_ had to construct messages manually to make the bot actually link to channels or highlight people
15:15 mareksh is now known as supersecant
Altreus that could be another thing I do whenever I get around to the dev stream 15:16
15:26 Doc_Holliwood joined 16:16 lizmat left, lizmat joined 16:44 Doc_Holliwood left 17:10 cognominal left 17:26 Doc_Holliwood joined 18:02 reportable6 left 18:03 reportable6 joined 18:30 RandalSchwartz left 18:31 ufobat__ left 18:53 stoned75 left 19:01 b2gills left 19:02 b2gills joined, tejr left 19:03 tejr joined, gfldex left 19:16 chrysanthematic joined 19:30 gfldex joined 19:41 chrysanthematic left 19:56 chrysanthematic joined 20:03 chrysanthematic left, chrysanthematic joined, chrysanthematic left 20:04 chrysanthematic joined 20:07 MoC left 20:36 RandalSchwartz joined 21:13 supersecant left, mareksh joined 21:14 mareksh is now known as supersecant 21:23 gordonfish- joined 21:25 gordonfish left 21:37 antononcube joined
Xliff How can I write a subset with multiple conditions? 21:39
I've tried "our subset NonGLibPositional is Any where { $_ ~~ Positional && $_ ~~ (GLib::Array, GArray).any }" but this errors out with an LTA 21:40
21:41 tejr left
Xliff m: class A {}; class B {}; our subset NonGLibPositional is Any where { $_ ~~ A && $_ ~~ B } 21:42
camelia 5===SORRY!5=== Error while compiling <tmp>
No such method 'add_parent' for invocant of type
at <tmp>:1
Xliff m: class A {}; class B {}; our subset NonGLibPositional is Mu where { $_ ~~ A && $_ ~~ B }
camelia 5===SORRY!5=== Error while compiling <tmp>
No such method 'add_parent' for invocant of type
at <tmp>:1
lucs I've got something like this in my notes: subset Foo of Any where * ~~ Bar | Moo | Meow;
Xliff lucs++ # Let me try that
21:43 tejr joined
Xliff Actually, that only catches the exclusive case. What about the inclusive? 21:43
lucs s/|/&/ ?
Xliff And the block form doesn't take kindly to *
lucs: Two logicals, inclusive AND exclusive.
Your conditional only does the inclusive
Hmmm... maybe two subsets? 21:44
lucs ... where { $_ ~~ A & B } ?
... where { $_ ~~ A & (B | C) } ? 21:46
21:46 antononcube left
Xliff Pisslb.e 21:46
* Possible.. (lol)
lucs :)
Xliff Nope. Using two subsets, as well as lucs' last two suggestions both result in the same error. 21:47
lucs :(
Paging the experts!
guifa isn't it "of Any" not "is Any"? 21:48
m: class A {}; class B {}; our subset NonGLibPositional of Any where { $_ ~~ A && $_ ~~ B }
camelia ( no output )
Xliff guifa++ 21:49
lucs guifa++ Careful reading :)
guifa you can also do
m: class A {}; class B {}; our subset NonGLibPositional of Any where Positional & (A|B)
camelia ( no output )
lucs takes more notes! 21:50
guifa Also, "of Any" is redudant IIRC 21:51
codesections bisect: my token paren { '(\' <tok> \')' }; my token tok { <paren>? foo }; say "(foo)foo" ~~ /<tok>/; 21:59
bisectable6 codesections, Will bisect the whole range automagically because no endpoints were provided, hang tight
codesections, ¦6c (54 commits): «「foo」␤ tok => 「foo」␤» 22:00
codesections, Nothing to bisect!
22:01 Doc_Holliwood left 22:07 sono joined 22:23 chrysanthematic left 22:32 melezhik joined
melezhik . 22:32
releasable6 melezhik, I cannot recognize this command. See wiki for some examples: github.com/Raku/whateverable/wiki/Releasable
melezhik releasable6: status
. 22:33
22:37 supersecant left 22:43 chrysanthematic joined 22:44 [Coke] left, [Coke] joined
Geth doc: coke self-assigned Create a helper module for testing github.com/Raku/doc/issues/1751
a29ac07008 | Coke++ | 2 files

Part of #1751
23:20 chrysanthematic left 23:25 chrysanthematic joined
23:33 linkable6 left 23:34 chrysanthematic left 23:36 linkable6 joined