🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
Xliff Ah. 00:00
m: sub b(:$a) { $a.gist.say }; b(a => 'a', a => 'b'); 00:32
camelia b
Xliff m: sub b(:@a) { $a.gist.say }; b(a => 'a', a => 'b');
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared. Did you mean '@a'?
at <tmp>:1
------> 3sub b(:@a) { 7⏏5$a.gist.say }; b(a => 'a', a => 'b');
Xliff m: sub b(:$a) { $a.gist.say }; b(a => 'a', a => 'b');
camelia b
jnthn "latest named arg wins" is specified behavior, if you're curious :) 00:47
Mostly useful in cases like foo(a => 'default', b => 'default', |%overrides) 00:48
Xliff jnthn: Does next work with while? 00:51
jnthn++: Ah! Good to know.
Nevermind. 00:52
Xliff $_ = rx/abc/; my $a = 'abcabc'; say $a ~~ $_ 01:06
evalable6 「abc」
Xliff m: my $a = '^ LastBuildResults'; say "LastBuildResults" ~~ /<{ $a }>/ 01:20
camelia 「LastBuildResults」
Xliff m: my $a = '^ LastBuildResults'; say "LastBuildResults.0" ~~ /<{ $a }>/
camelia 「LastBuildResults」
Xliff m: my $a = '^ LastBuildResults'; say "LastBuildResults.0" ~~ rx/<{ $a }>/ 01:27
camelia 「LastBuildResults」
Xliff m: my $a = '^ LastBuildResults'; say "LastBuildResults.0" ~~ rx/ <{ $a }> /
camelia 「LastBuildResults」
Xliff m: $_ = rx/ <{ $a }> /; my $a = '^ LastBuildResults'; say "LastBuildResults.0" ~~ $_ 01:29
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared
at <tmp>:1
------> 3$_ = rx/ <{ 7⏏5$a }> /; my $a = '^ LastBuildResults
Xliff m: my $a = '^ LastBuildResults'; $_ = rx/ <{ $a }> /; say "LastBuildResults.0" ~~ $_
camelia 「LastBuildResults」
Xliff "/".tr( '/' => '\/' ).say 01:35
m: "/".tr( '/' => '\/' ).say
camelia No such method 'tr' for invocant of type 'Str'. Did you mean any of these?
Str
tc

in block <unit> at <tmp> line 1
Xliff m: my $a = "/"; $a ~~ tr/ '/' / '\/'; $a.say 01:36
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3my $a = "/"; $a ~~ tr/ '/' /7⏏5 '\/'; $a.say
expecting any of:
infix
infix stopper
statement end
statement …
Xliff m: my $a = "/"; $a ~~ tr/ '/' / '\/'/; $a.say
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3my $a = "/"; $a ~~ tr/ '/' /7⏏5 '\/'/; $a.say
expecting any of:
infix
infix stopper
statement end
statement…
Xliff m: "/".trans( '/' => '\/' ).say 01:37
camelia \
Xliff m: "/".trans( '/' => '\\\/' ).say
camelia \
Xliff m: "/".trans( '/' => '\\/' ).say
camelia \
Xliff m: "/".trans( ['/'] => ['\\/'] ).say
camelia \/
Xliff m: my $a = 'A-b.json'; my $rx = rx/ <{ $a }> /; 04:07
camelia ( no output )
Xliff m: my $a = 'A-b.json'; my $rx = rx/ <{ $a }> /; say $a ~~ $rx
camelia 5===SORRY!5===
Unrecognized regex metacharacter - (must be quoted to match literally)
at /home/camelia/EVAL_0:1
------> 3anon regex { A7⏏5-b.json}
Malformed regex
at /home/camelia/EVAL_0:1
------> 3anon regex { A-7⏏5b.json…
Xliff m: my $a = '<[ A-b ]>.json'; my $rx = rx/ <{ $a }> /; say $a ~~ $rx
camelia 5===SORRY!5=== Error while compiling /home/camelia/EVAL_0
Unsupported use of - as character range; in Perl 6 please use .. for range, for explicit - in character class, escape it or place it as the first or last thing
at /home/camelia/EVAL_0:1…
Xliff m: my $a = '<[ A..b ]>.json'; my $rx = rx/ <{ $a }> /; say $a ~~ $rx 04:07
camelia Nil
Xliff m: my $a = '<[ A..b ]>.json'; my $rx = rx/ <{ $a }> /; say "A.json" ~~ $rx 04:08
camelia 「A.json」
Xliff m: my $a = "<[ A..b ]>\.json'; my $rx = rx/ <{ $a }> /; say "A.json" ~~ $rx 04:09
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$rx' is not declared
at <tmp>:1
------> 3my $a = "<[ A..b ]>\.json'; my 7⏏5$rx = rx/ <{ $a }> /; say "A.json" ~~ $r
Xliff m: my $a = "<[ A..b ]>\n.json"; my $rx = rx/ <{ $a }> /; say "A.json" ~~ $rx
camelia 「A.json」
Xliff .seen MadcapJake 04:49
tellable6 Xliff, I saw MadcapJake 2016-12-02T06:23:08Z in #perl6: <MadcapJake> well I'm gonna fiddle with this laptop some more and then hit the hay. Glad to be back! See you this weekend!
Xliff :(
Hope he's ok...
guifa Xliff: my google fu (—> Linked In) says he’s currently doing okay. But started a new job right around then 05:04
Xliff guifa++ # Thanks! 05:22
my @a = ((1, 2), (3, 4), (5, 6)); @a.flat.say 05:25
evalable6 ((1 2) (3 4) (5 6))
Xliff my @a = ((1, 2), (3, 4), (5, 6)); |(@a.flat).say 05:26
evalable6 ((1 2) (3 4) (5 6))
Xliff my @a = ((1, 2), (3, 4), (5, 6)); @a[0].flat.say
evalable6 (1 2)
Xliff my @a = ((1, 2), (3, 4), (5, 6)); @a[0].say 05:27
evalable6 (1 2)
Xliff my @a = ((1, 2), (3, 4), (5, 6)); @a[2..3].flat.say 05:28
evalable6 ((5 6) (Any))
Xliff my @a = ((1, 2), (3, 4), (5, 6)); @a[1..2].flat.say
evalable6 ((3 4) (5 6)) 05:29
Xliff my @a = ((1, 2), (3, 4), (5, 6)); |@a[1..2].flat.say
evalable6 ((3 4) (5 6))
Xliff my @a = ((1, 2), (3, 4), (5, 6)); |@a[1..2].map( *.flat).flat.say
evalable6 (3 4 5 6)
Xliff m: ((("a", "b"), "c"), "d").flat 05:30
camelia ( no output )
Xliff m: ((("a", "b"), "c"), "d").flat.say
camelia (a b c d)
Xliff my @a = ((1, 2), (3, 4), (5, 6)); @a.flat.say
evalable6 ((1 2) (3 4) (5 6))
Xliff m: my @a = (((1, 2), 3), (3, 4), (5, 6)); @a.flat.say
camelia (((1 2) 3) (3 4) (5 6))
Xliff I thought flattening was recursive. 05:31
my @a = ((1, 2), (3, 4), (5, 6)); |@a[1..2].map( *.flat).flat.say
evalable6 (3 4 5 6)
Xliff m: say flat ((1, 2), (3, 4), (5, 6));
camelia (1 2 3 4 5 6)
Xliff my @a = ((1, 2), (3, 4), (5, 6)); flat @a
m: my @a = ((1, 2), (3, 4), (5, 6)); flat @a
camelia ( no output )
Xliff m: my @a = ((1, 2), (3, 4), (5, 6)); say flat @a
camelia ((1 2) (3 4) (5 6))
Xliff m: my @a = ((1, 2), (3, 4), (5, 6)); say (flat @a) 05:32
camelia ((1 2) (3 4) (5 6))
Xliff m: my @a = (((1, 2), 3), (3, 4), (5, 6)); @a.List.flat.say
camelia (1 2 3 3 4 5 6)
scimon Morning 09:14
lizmat scimon o/ 09:19
scimon Right. Tweaked my draft for the Advent. Now to polish my slides for tonights talk at the BCS. Full house... kinda scary. 09:20
lizmat scimon++ :-) 09:25
sena_kun scimon, good luck! 09:26
scimon Thanks 09:27
scimon Possible target for a squashathon. The Faq. docs.raku.org/language/faq 10:22
AlexDaniel weekly: joke of the day: “What's the difference between Raku, Rakudo and Raku?” ( docs.raku.org/language/faq ) 10:23
notable6 AlexDaniel, Noted! (weekly)
scimon Yeah... that one made me giggle. 10:30
AlexDaniel weekly: and more “Why is Raku called Perl?” 10:35
notable6 AlexDaniel, Noted! (weekly)
AlexDaniel weekly: Answer: “it was Larry's choice under Rule 1” 10:36
notable6 AlexDaniel, Noted! (weekly)
AlexDaniel weekly: For a weeklie after this one, Raku FAQ squashathon: github.com/rakudo/rakudo/wiki/Mont...Squash-Day 10:40
notable6 AlexDaniel, Noted! (weekly)
AlexDaniel scimon: :)
rba :-) 10:45
discord6 <huyna> if i have some regex like: my regex dump { [abc|def|ghi] }, i use this usually but in some cases i want to use the dump regex to match string without 'def', if we have a way to do this? 10:55
huyna if i have some regex like: my regex dump { [abc|def|ghi] }, i use this usually but in some cases i want to use the dump regex to match string without 'def', if we have a way to do this? 10:57
jnthn Give it a parameter and assert against that?
my regex dump(:$allow-def = True) { abc | <?{ $allow-def }> def | ghi } 10:58
Or some such
huyna wow so regex can also receive parameters 10:59
jnthn Yes, it's just like a method, except with a regex body rather than a main language body :)
huyna this will make my regex more flexible, thank you jnthn 11:00
Geth ¦ problem-solving: bbkr assigned to JJ Issue "Path to Raku" is missing change of linux module namespaces github.com/perl6/problem-solving/issues/130 12:20
SmokeMachine scimon: I’ve sent you a msg... 12:34
tbrowder scimon++ 12:55
thanks to scimon, we have a place to put links to gists (or other location) of draft advent articles 12:56
enter or make a PR for github.com/perl6/advent/blob/maste...019/drafts
unless you're an admin, i don't think you can see draft articles on WP 12:57
moritz editor role is enough 13:05
tbrowder thnx 13:13
Doc_Holliwood m: ².WHAT.say 13:41
camelia (Int)
Doc_Holliwood m: say 2 - ² 13:42
camelia 0
Doc_Holliwood where is the magic? 13:42
m: 2² 13:43
camelia ( no output )
Doc_Holliwood m: 2².say
camelia 4
jnthn I don't think there's any magic at all, it's just falling out of the standard parsing rules
AlexDaniel u: ²⅓ 13:44
unicodable6 AlexDaniel, U+00B2 SUPERSCRIPT TWO [No] (²)
AlexDaniel, U+2153 VULGAR FRACTION ONE THIRD [No] (⅓)
Doc_Holliwood somewhere something must be actively distinguishing
AlexDaniel so any No has a numeric value
jnthn Well, the parser knows when it's looking for a term and when it's looking for a postfix 13:45
AlexDaniel you can use these unicode characters (that are No) as numeric literals
and yeah, what jnthn said :)
jnthn It can't be looking for a postfix if it didn't yet see a term
AlexDaniel we had a few tickets about this, people find it very surprising, but the parser doesn't
Doc_Holliwood so ² is sometimes an int and sometimes its a postfix depending on context?
tobs by the same rule, it can distinguish between multiplication and whatever star 13:46
AlexDaniel well, similarly, yes
m: say (* * *)(2, 8)
camelia 16
jnthn Doc_Holliwood: I guess, though only in the same sense that "+" in +$x is the numify operator, but in $a + $b it's the infix addition operator. 13:47
tobs m: say 2²⁰ 13:48
camelia 1048576
jnthn In general, the parser is always quite clear about what category of thing it would like to see next. 13:49
AlexDaniel m: 2 2 13:51
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 0327⏏5 2
expecting any of:
infix
infix stopper
statement end
statement modifier
statement modifier…
AlexDaniel m: * 2 13:52
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3*7⏏5 2
expecting any of:
infix
infix stopper
statement end
statement modifier
statement modifier …
AlexDaniel m: × 2
camelia 5===SORRY!5=== Error while compiling <tmp>
Preceding context expects a term, but found infix × instead.
at <tmp>:1
------> 3×7⏏5 2
AlexDaniel the error messages make it quite transparent :)
Doc_Holliwood I'm just trying to wrap my head around the latest SO question. but it makes sense to me now. if ² ist a postfix, but X requires an infix. so X² cant DWTHAM 13:53
in order for say 1, 3, 5, 7, 9 X² to be 1 , 25, etc you would need to change how X works 13:56
jnthn m: say (1, 3, 5, 7, 9)>>² 13:57
camelia (1 9 25 49 81)
jnthn Just use something that expects a postfix op :)
Doc_Holliwood I am so going to post this :D 13:58
Doc_Holliwood I think what surprise people is that ² has a numeric value at all 14:10
Doc_Holliwood on it's own i mean. 14:10
its
Kaiepi m: sub foo { callframe(1).name }; sub bar { foo }; bar 14:14
camelia No such method 'name' for invocant of type 'CallFrame'. Did you mean any of these?
none
note
take

in sub foo at <tmp> line 1
in sub bar at <tmp> line 1
in block <unit> at <tmp> line 1
Kaiepi m: sub foo { callframe(1).code.name }; sub bar { foo }; bar
camelia ( no output )
Kaiepi m: sub foo { callframe(1).code.name }; sub bar { foo }; say bar
camelia bar
Kaiepi is there a way you can get the caller of a function that's more clear than this? 14:14
jnthn More clear in what sense? 14:16
I'not sure there even is another way.
guifa Kapiei: Nope, unless something changed. I was trying to do that to make a hash only be editable by itself
It’s probably not even particularly accurate (I mean, it is, but in a DWIM sense) either, as sometimes you’ll get intermediate objects / subs in the callframe 14:18
Kaiepi i was thinking something like a &?CALLER variable
vrurg_ jnthn: There is another way – Backtrace. :) 14:19
jnthn Oh, right
Kaiepi: That'd make no sense at all, given caller is a dynamic property, but &?FOO things are compile-time symbols :)
Kaiepi ah 14:27
&*CALLER then
jnthn Except one could actually declare that, so it'd be ambiguous :) 14:32
IMO, the current way is short enough relative to how often one would wish to do this
Kaiepi m: role Foo { has $.a; has $.b; has $.c; has $.d; }; class Bar does Foo { }; class Baz does Foo { }; class Qux does Foo { my enum Type <bar baz>; has Type:D $.type is required; proto method new(Foo:D $foo) { my $*a = $foo.a; my $*b = $foo.b; my $*c = $foo.c; my $*d = $foo.d; {*} }; multi method new(Bar:D $bar) { self.bless: :$*a, :$*b, :$*c, :$*d, type => bar }; multi method new(Baz:D $baz) { self.bless: :$*a, :$*b, :$*c, :$*d, type => baz } }; say Qux.new: 15:40
Bar.new: :1a, :2b, :3c, :4d
camelia Too few positionals passed; expected 2 arguments but got 1
in method new at <tmp> line 1
in block <unit> at <tmp> line 1
Kaiepi argh
m: role Foo { has $.a; has $.b; has $.c; }; class Bar does Foo { }; class Baz does Foo { }; class Qux does Foo { my enum Type <bar baz>; has Type:D $.type is required; proto method new(Foo:D $foo) { my $*a = $foo.a; my $*b = $foo.b; my $*c = $foo.c; {*} }; multi method new(Bar:D $bar) { self.bless: :$*a, :$*b, :$*c, type => bar }; multi method new(Baz:D $baz) { self.bless: :$*a, :$*b, :$*c, type => baz } }; say Qux.new: Bar.new: :1a, :2b, :3c 15:41
camelia Qux.new(type => Type::bar, a => 1, b => 2, c => 3)
Kaiepi not the most practical example of it, but you can get rid of a lot of boilerplate in constructors if you make them multis and use dynamic variables in the proto for it 15:42
actually wait, wouldn't using submethod BUILD make more sense for cases like this? 16:01
jmerelo releasable6: status 16:17
tellable6 2019-11-19T23:21:58Z #raku <tbrowder> jmerelo gist of draft advent article is available, see yr github issue for the comment with it
2019-11-20T18:28:11Z #raku <AlexDaniel> jmerelo: why is there a separate raku advent blog? Why not use the existing one?
2019-11-20T18:56:55Z #raku <tyil> jmerelo I've scheduled my advent blog posts
releasable6 jmerelo, Next release will happen when it's ready. There are no known blockers. 248 out of 479 commits logged (⚠ 9 warnings)
jmerelo, Details: gist.github.com/0007c3bf2017c8a86b...93a1fe2373
jmerelo .seen AlexDaniel
tellable6 jmerelo, I saw AlexDaniel 2019-11-21T13:52:37Z in #raku: <AlexDaniel> the error messages make it quite transparent :)
AlexDaniel o/
jmerelo Hi AlexDaniel
Long story short: I don't have privileges to change the name, the person who owns it didn't want to change it. 16:18
AlexDaniel really?? 16:19
jmerelo AlexDaniel: It's a good reason, I guess: let's not lose all the incoming links.
AlexDaniel ok… whatever
jmerelo Yep, we'll have to make do...
finanalyst jmerelo: hi 16:31
.seen jmerelo 16:32
tellable6 finanalyst, I saw jmerelo 2019-11-21T16:19:44Z in #raku: <jmerelo> Yep, we'll have to make do...
Kaiepi would creating custom package declarators with EXPORTHOW::DECLARE be a good topic for an advent calendar article? 16:34
finanalyst I'm trying to grok the classes in CompUnit/Repository. Nine classes. Is there a link/code/comment to indicate the need/use-case for them? 16:35
Kaiepi docs/module_management.md finanalyst ? 16:39
finanalyst Kaiepi: I've read it once already, and reading it again. But no indication about the subclasses in CompUnit/Repository 16:41
Kaiepi hm, idk then
finanalyst I have the feeling some of the classes are not actually used now, or were stubs during design.
So the question arises as to whether they need to be documented
jmerelo Hi, finanalyst ! 16:42
finanalyst They are: AbsolutePath.pm6, FileSystem, Installable, Installation, Locally, NQP, Perl5, Spec, Unknonw 16:43
jmerelo: trying to grok CompUnit classes.
jmerelo Just came back. finanalyst, they are definitely used. Did you try and do a GitHub search for them? Sometimes you find them in unexpected places...
finanalyst jmerelo: just tried a search on CompUnit/Repository/AbsolutePath for all github. No mentions. 16:49
Also tried CompUnit::Repository::AbsolutePath, no finds
But CompUnit::Repository yields one result 16:50
misreading results, I need to look at "code" results, not overview 16:51
jmerelo finanalyst: they should be at least tested... 16:53
finanalyst jmerelo: I have now found some results, but still no indication about how they are used. Looking at the code for these classes, there does not seem to be much difference between some of them 16:54
jmerelo finanalyst: from what I know, they are different ways to specify a CompUnit. For instance, when you "use" a NQP class, you are using the NQP form above. 16:57
finanalyst: but, well, I do have like 12 tabs open in my firefox for 18 months already until I get around to it... So it's not easy. 16:58
finanalyst jmerelo: IN docs.module_management.md, I read: Distribution 17:03
To be more fully defined, but consists of the metadata from a META6.info and a way to reach any resources declared within it.
Is there a fuller definition of 'distribution'?
I presume 'META6.info' is 'META6.json' that comes with a 'module'? 17:06
jmerelo finanalyst: there's the docs for Distribution, I guess docs.raku.org/type/Distribution 17:13
El_Che lo
finanalyst jmerelo: I have read that doc. To be honest, its even more confusing! It discusses a role without saying what a Distribution is 17:20
jmerelo finanalyst: please also raise an issue about it... 17:24
finanalyst: a Distribution is also mentioned in the documentation about META6.json 17:25
finanalyst jmerelo: I'm trying to write a doc to clarify it. 17:25
jmerelo finanalyst: but well, you've found the Catch-22 of documenting stuff. It's not documented, so it's difficult to understand what it does to document it. 17:26
finanalyst jmerelo: but the person who wrote the classes should still have some memory about why they were written. 17:27
When did the distinction between Distribution classes and CompUnit classes occur? 17:28
they seem to be similar
jmerelo finanalyst: I sometimes go through commit comments and issues they refer to understand the context
finanalyst jmerelo: that's a lead. 17:30
jmerelo finanalyst: AFAIU, CompUnits:: tell the program how should it load and work with them. For instance, FileSystem.
tbrowder jmerelo: \o/ 17:46
does anyone know how to upload a text file into a draft article on wordpress? 17:47
jmerelo tbrowder: other than copy and paste? 17:49
tbrowder: but I really don't know. They provide the editor, which you can switch to code if you want. 17:50
tbrowder i see they have an api that may help (yep, copy paste is not my cup of tea, old fumble fingers sometimes messes things up) 17:51
since the consensus last year or so was to keep using wp, a good raku tool to aid publishing advents would be a good community project imho 17:53
jmerelo tbrowder: it sure would :-)
hythm finanalyst, there is an old advent post about Compunit here (if you havnt seent it already ) perl6advent.wordpress.com/2016/12/...ained-ish/ 17:57
tellable6 2019-11-17T14:44:46Z #raku <Xliff_> hythm: I'm awake.
2019-11-17T15:08:03Z #raku <Xliff_> hythm: Pull the latest code, I've made those types of parameters optional. They are only there as out params, anyways. So now: $sc.get-color($state) will return a GdkRGBA value, which is a CStruct.
finanalyst hythm: thanx 17:58
hythm there is also a nice pdf called Module Loading in Perl6 by niner
finanalyst hythm: where is the pdf? 17:59
I have his talk on Module loading
hythm yes its the pdf basically of the talk, i dont have the link for the moment, but its in niner.name website 18:00
finanalyst hythm: I created a pod6 file based on the talk. A first draft is a PR in the doc/ repository. There are issues with it because I wrote is as a sort of tutorial, but it's not 18:02
tbrowder ref wp api: looks like there is an existing javascript client to model from. there is a set of apis to post and publish articles. 18:05
hythm finanalyst, this is the link of the pdf niner.name/talks/A%20look%20behind%...0Perl%206/
tbrowder google summer of code project? 18:06
or part of one?
finanalyst hythm: that is the same content as the talk and the odp document. 18:07
hythm: Advent Calendar link you sent is also v good. 18:08
hythm thanks Xliff, I used the .get-color method after update and works great 18:20
Xliff .seen salortiz 18:34
tellable6 Xliff, I haven't seen salortiz around, did you mean sortiz?
Xliff .seen sortiz 18:35
tellable6 Xliff, I saw sortiz 2019-10-14T20:28:20Z in #raku-dev: <sortiz> Thank you
cpan-raku New module released to CPAN! LibXML (0.1.11) by 03WARRINGD 19:43
lizmat weekly: www.i-programmer.info/news/222-per...orial.html 20:46
notable6 lizmat, Noted! (weekly)