🦋 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.
00:03 don joined, don is now known as Guest75570
Guest75570 Hello World 00:04
p6: say 3; 00:06
camelia 3
00:07 Guest75570 left 00:12 patrickz joined 00:16 patrickb left 00:17 patrickz left 00:49 Xliff left 01:05 silug left 01:52 Altai-man_ joined 01:55 sena_kun left 02:08 ufobat_ joined 02:12 ufobat left 02:44 wildtrees left 02:48 jeffythedragonsl joined 03:04 jeffythedragonsl left 03:14 mahmudov left 03:38 AlexDaniel joined, AlexDaniel left, AlexDaniel joined 03:53 guifa2 left, sena_kun joined 03:54 Altai-man_ left 03:57 guifa2 joined 03:59 guifa2 left, guifa2 joined 04:00 liubianshi joined
liubianshi p6: say 3; 04:02
camelia 3
liubianshi p6: say "";
Voldenet p6: say "".uniname 04:03
camelia <private-use-E62B>
Voldenet huh
04:05 liubianshi left 04:06 guifa2 left 04:12 liubianshi joined 04:33 liubianshi left 04:44 guifa_ joined 04:45 guifa left, guifa_ is now known as guifa 05:27 Doc_Holliwould left, Doc_Holliwood left 05:41 abraxxa left 05:42 abraxxa joined 05:52 Altai-man_ joined 05:55 sena_kun left 06:09 jmerelo joined 06:19 liubianshi joined
jmerelo .tell tbrowder apparently raku-advent.blog is already working, but it redirects to the old address 06:20
tellable6 jmerelo, I'll pass your message to tbrowder
06:21 sauvin joined 06:22 sauvin left 06:39 liubianshi left 06:42 sauvin joined 07:04 stoned75 left 07:05 Xliff joined 07:07 Altai-man_ left 07:32 jmerelo left 07:38 wamba joined
no-n I installed vim-raku with Vundle and it does not seem to be doing any highlighting. 07:53
(for .raku files) 07:54
Not sure if it's doing anything at all, but it is installed. 07:55
07:59 domidumont joined 08:34 wamba left 08:48 rindolf joined 09:33 Doc_Holliwood joined, Doc_Holliwould joined 10:00 wamba joined 10:14 kensanata joined 10:17 wamba left 10:35 wamba joined 10:43 kensanata left 10:50 patrickb joined 11:01 mojca left 11:03 mojca joined 11:24 mojca left 11:26 mojca joined 11:29 Merfont left
AlexDaniel no-n: maybe .raku extension is not supported yet? 11:30
11:30 Merfont joined 11:32 Merfont left
moritz no-n: you can do things like try :set filetype=raku 11:37
:syntax on
11:51 Doc_Holliwould left, Doc_Holliwood left, Doc_Holliwood joined, Doc_Holliwould joined 11:57 sena_kun joined 12:22 wamba left 12:58 phogg joined 12:59 phogg left, phogg joined 13:14 wamba joined 13:33 shred_alert joined 13:39 Voldenet left 13:43 Voldenet joined, Voldenet left, Voldenet joined 13:53 Altai-man_ joined 13:54 wamba left 13:55 sena_kun left 13:56 lucasb joined 14:07 Doc_Holliwood left, Doc_Holliwould left 14:23 Tirifto joined, Doc_Holliwould joined, Doc_Holliwood joined 14:24 patrickb left 14:25 Guest78373 left 14:37 kktt007 joined
Tirifto lizmat: I think I get how your mixin example works now, but I’ll probably get a class for my use case, since I’m not sure that ‘:=’ being a compile time operator wouldn’t be a problem. And I also noticed something else in regard to the operator… 14:46
p6: class A {has $.msg is rw = “Meow!”}; role R {method msg () {callsame}}; my $a := A.new; my $b := $a but R; $b.msg.say; $a.msg = “Woof!”; $b.msg.say;
camelia Meow!
jnthn `but` works on a copy; try `does` instead 14:49
Tirifto p6: class A {has $.msg is rw = “Meow!”}; role R {method msg () {callsame}}; my $a := A.new; my $b does R := $a; $b.msg.say; $a.msg = “Woof!”; $b.msg.say; 14:51
camelia Meow!
Tirifto jnthn: Does ‘my $b := $a but R;’ bind $b to a copy of $a which does R, basically? 14:54
jnthn It's like `my $b := $a.clone does R;` 14:55
It really changes the type of the object 14:56
Tirifto Ah, I guess I got the wrong idea about precedence at first. 14:57
jnthn Ah, yes; does and but bind tigheter than := 14:58
Tirifto (I was thinking $b would refer to $a and just get enriched with methods, but it makes sense that the ‘but’ would apply to $a and return something for $b to get bound to…)
Thank you jnthn! 15:00
15:00 guifa2 joined 15:01 holyghost joined 15:25 Ulti joined
Ulti so I just had a bit of a thought experiment on how one might think about Python context managers in Raku... and I suspect there is a hidden phaser GIVEN_ENTER and GIVEN_LEAVE on a class definition 15:33
thats sort of where one might hang it without essentially reimplementing given with some special method names similar to Python 15:34
15:37 abraxxa left 15:47 guifa2 left 15:53 sena_kun joined
Xliff m: my @a = flat('a'..'z', 'A'..'Z', 0..9, '_'); @a.roll(20).say 15:55
camelia (6 2 r 2 n A S 0 z q X I p U t W k h C 0)
Xliff m: my @a = flat('a'..'z', 'A'..'Z', 0..9, '_'); @a.roll(20).join.say
camelia r4tdOpEpHU6n2hH1loPs
Xliff m: my @a = flat('a'..'z', 'A'..'Z', 0..9, '_'); @a.roll(20).join.say
camelia 5xrW_64rgd2x_XhlCZpy
Xliff m: my @a = flat('a'..'z', 'A'..'Z', 0..9, '_'); @a.roll(20).join.say
camelia uFMPs44384Gsg31Q_Jd2
Xliff m: my @a = flat('a'..'z', 'A'..'Z', 0..9, '_'); @a.roll(20).join.say
camelia 6bRYAKhRC4tX2RAF6_aj
15:55 Altai-man_ left 16:00 Guest78373 joined 16:05 Tirifto left 16:06 MasterDuke joined, kktt007 left 16:16 tadzik[m]1 joined, mensvaga joined 17:04 domidumont left 17:24 cpan-raku left 17:25 cpan-raku joined, cpan-raku left, cpan-raku joined 17:36 domidumont joined 17:46 mahmudov joined 17:53 Altai-man_ joined 17:55 sena_kun left 18:20 rbt joined 18:21 pedr0 joined
pedr0 Hi there, I am struggling in defining a simple grammar which given the token "one two three" for instance, parse the token and take the appropriate actions to print "1 2 3" 18:29
Altai-man_ pedr0, hi! Can you provide an example of your grammar so we could help to tweak it?
pedr0 pastebin.com/Cmjbx9SB 18:30
18:30 lil joined
pedr0 I am used to Flex/Bisont/C but I must admit I am pretty new to perl 18:30
lil hello
pedr0 so do not be surprised if it seems completely unreasoable
how do I make the token "ONE" return the numerical value 1 and how do I make use of it > 18:31
Altai-man_ pedr0, 1)rules (tokens regexes as well) are different from tokens in flex/bison, in a way they are not literal, but regexes as well 18:32
and thus you need to call them as well
pedr0, to translate your tree into something else you want to use a thing called "actions"
pedr0, have you read docs.perl6.org/language/grammar_tutorial ?
lil, hi! 18:33
pedr0 wait I just realized I sent you the half backed example
pastebin.com/caDkDJhw 18:34
there should be actions there
Altai-man_ pedr0, I believe you are assuming flex/bison syntax, but it is very different from raku grammars. I'd recommend you to read the tutorial I linked. 18:35
pedr0 sorry about that - I had to strip off some bits from the original file
docs.perl6.org/language/grammar_tu...th_actions 18:37
go at the bottom to that web page and you will find something similar to what I am trying to do, I am not a complete fool ! LoL
lil When I tried to translate all the file extensions in the cro project to .raku, my files were no longer “located”. I changed the database file back to .pm6 and it became located again. Meta6 file changed. To repeat the error, you need to write cro run. Repository github.com/Lenin1917/rakunews 18:38
Altai-man_ pedr0, sure, the task is reasonable, I mean the syntax is wrong. Something that you want will be, let me see...
lil can i fix this problem?
Altai-man_ lil, new extensions are not yet supported _everywhere_ and so there is a transition period taking action. it is not really recommended to jump into new extensions unless you 100% know what you're doing. 18:39
lil (( 18:40
Altai-man_ lil, also, a working extension for raku module is rakumod, while .raku is for scripts.
lil, so it is worth trying out if with rakumod you'll have more success. ;)
lil, by the way, I don't see META6.json in your repo at all, which is... odd to see. kind of valid, but odd. 18:41
lil yay!! it`s works! 18:42
pedr0 I think I am getting completely wrong the action 18:43
Altai-man_ m: grammar Number { token TOP { <scalar> }; token scalar { 'one' | 'two' } }; class Actions { method TOP($/) { make $<scalar>.made; }; method scalar($/) { with $/.Str { when 'one' { make 1 }; when 'two' { make 2 }; } } }; Number.parse('one', actions => Actions).say;
camelia 「one」
scalar => 「one」
Altai-man_ m: grammar Number { token TOP { <scalar> }; token scalar { 'one' | 'two' } }; class Actions { method TOP($/) { make $<scalar>.made; }; method scalar($/) { with $/.Str { when 'one' { make 1 }; when 'two' { make 2 }; } } }; Number.parse('one', actions => Actions).made.say; 18:44
camelia 1
Altai-man_ pedr0, ^ this is a simplified solution for what you want to do
lil, \o/
lil altai-man_ thats why Meta6 in rakunews directory
pedr0 thanks A LOT - let me try to put my head there 18:45
Altai-man_ lil, oh, I am silly, sorry. was also thinking "and there are no service file nor .cro.yml, odd but ok" and somehow didn't notice there is a subdirectory just for this stuff. :) 18:46
maybe because I usually put keep the website repo flat, but that's a matter of preference
s/put// 18:47
pedr0 is it supposed to work if I "inline" the actions in the tokens' definition ? 18:53
without having to define another class for actions
Altai-man_ pedr0, no, it isn't 18:54
that's the difference that confused you, I guess
pedr0 Yeah, am I getting the tutorial completely wrong then ? The last part uses those stuff
Altai-man_ grammars are used simply as a quck way to create parsers which produce parsing trees 18:55
pedr0, where? In "Grammars by example with actions" section you linked to both grammar and an actions class are used
nothing is inlined there
pedr0 the bottom of this link 18:56
are those inlined actions ?
Altai-man_ pedr0, I see what you mean... indeed, it is possible, but so rare I didn't know about this after a couple of years of active raku usage. :S 18:58
sorry for the confusion 18:59
then something like this:
19:00 lil left
Altai-man_ m: grammar Number { token TOP { <scalar> { make $<scalar>.made } }; token scalar { 'one' | 'two' { make $/.Str eq 'one' ?? 1 !! 2 } } }; class Actions { method TOP($/) { make $<scalar>.made; }; Number.parse('one').say; 19:00
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3calar>.made; }; Number.parse('one').say;7⏏5<EOL>
Altai-man_ m: grammar Number { token TOP { <scalar> { make $<scalar>.made } }; token scalar { 'one' | 'two' { make $/.Str eq 'one' ?? 1 !! 2 } } }; Number.parse('one').say;
camelia 「one」
scalar => 「one」
Altai-man_ m: grammar Number { token TOP { <scalar> { make $<scalar>.made } }; token scalar { 'one' | 'two' { make ($/.Str eq 'one' ?? 1 !! 2) } } }; Number.parse('one').say;
camelia 「one」
scalar => 「one」
Altai-man_ hmmm 19:01
pedr0 I am better off with a different class I reckon 19:02
overall ... it is better coding I think, as it could be too concise otherwise
Altai-man_ yes, I'd suggest that. The thing is that it is much cleaner this way to separate the format and the translation. 19:03
and if your grammar is not really tiny, it'll become big and hard to comprehend fast
pedr0 yeah
I see
Another thing if I can is 19:04
let's suppose I have the production
how do I account for that in the action method ?
shred_alert Isn't it just less work to learn how to use a parser generator, when grammars get really big?
pedr0 that's a parser generator I suppose
do I need to check for the number of arguments "by hand" within the action's method ? 19:05
Altai-man_ m: grammar Number { token TOP { <scalar> { make $<scalar>.made } }; token scalar { [ 'one' | 'two' ] { make ($/.Str eq 'one' ?? 1 !! 2) } } }; Number.parse('two').made.say;
camelia 2
Altai-man_ m: grammar Number { token TOP { <scalar> { make $<scalar>.made } }; token scalar { [ 'one' | 'two' ] { make ($/.Str eq 'one' ?? 1 !! 2) } } }; Number.parse('one').made.say;
camelia 1
Altai-man_ made inlined actions work. \o/
pedr0, the second branch won't be executed, since the first one always match it 19:06
pedr0 sorry, I owe you an apology - very silly example 19:07
Altai-man_ shred_alert, it depends on number of things
method SCALAR($/) { do I need to check the number of paramters to understand the production I've been called from ? } 19:08
Altai-man_ pedr0, ok, so in a method in actions for the rule you get the `$/` variable and you can access parts of this rule by either index ($/[0], $/[1] etc, or shortcuts $0, $1 etc) or a name if it is a named capture
so you can check if the named capture is present and if yes, it's one branch, otherwise - another one
like... 19:09
m: my regex foo-or-bar { $<foo>='foo' | $<bar>='bar' }; my $match = 'foo' ~~ /<foo-or-bar>/; say $match 19:10
19:10 rbt left
camelia 「foo」
foo-or-bar => 「foo」
foo => 「foo」
19:10 rbt joined
Altai-man_ m: my regex foo-or-bar { $<foo>='foo' | $<bar>='bar' }; my $match = 'foo' ~~ /<foo-or-bar>/; with $match<foo> { say "Foo was matched!" } orwith $match<bar> { say "Bar was matched!" } 19:11
camelia ( no output )
Altai-man_ oops
shred_alert "Token methods are faster than regex methods and ignore whitespace." Wouldn't it be a nice addition to say 'tokens don't backtrack'?
Altai-man_ m: my regex foo-or-bar { $<foo>='foo' | $<bar>='bar' }; my $match = 'foo' ~~ /<foo-or-bar>/; with $match<foo-or-bar><foo> { say "Foo was matched!" } orwith $match<foo-or-bar><bar> { say "Bar was matched!" } 19:12
camelia Foo was matched!
Altai-man_ pedr0, ^
pedr0 I see
shred_alert I feel like that would clear up a lot. Say tokens don't backtrack and are lazy regexes.
pedr0 great 19:13
thanks a lot indeed
Altai-man_ shred_alert, "tokens do not backtrack" is mentioned clearly at docs.perl6.org/language/grammars#Named_Regexes
shred_alert Oh. I was just talking about the grammar tutorial 19:15
Should have been more clear
Altai-man_ shred_alert, well, you can't mention all the info everywhere so that it'd be accessible everywhere, so a line should be drawn somewhere... 19:16
shred_alert It's just one tiny line though. I feel it would really add to the tutorial.
And it's a pretty important detail. 19:17
Altai-man_ shred_alert, can't argue with that. do you want to write it up or file a ticket?
shred_alert I can submit something on GitHub after dinner.
Altai-man_ ++shred_alert 19:18
shred_alert No worries :)
How does "They don't backtrack. They give up after the first possible match." sound? 19:21
pedr0 last one ;) 19:23
what if I want to return the value of an operation
can I write
make $<ONE> * $<TWO>
to return the product of two tokens 19:24
I meant
make $<ONE>.made * $<TWO>.made
Altai-man_ pedr0, you can write that
19:26 sauvin left 19:38 domidumont left
guifa thinks he’s got the strongly typed Raku doc draft mostly done. 19:52
Any thoughts? Am I missing anything or need any extra examples? gist.github.com/alabamenhu/3877fa6...d1661f69f9
19:54 sena_kun joined 19:55 Altai-man_ left
lizmat guifaL could you give a use case for a parameterizable Pair ? 20:02
20:07 pedr0 left
guifa lizmat: not off the top of my head. In the example, I was thinking I could do something like 20:09
*%hash where .pairs.all ~~ Pair[Value,Key]
Aha! I found one 20:12
20:12 sarna left
guifa Well, maybe 20:13
It seems the error oddly holds even for hash assignment 20:14
p6: my Associative[Str,Int] $foo = Hash[Str,Int].new(a => 1) 20:15
camelia Type check failed in assignment to $foo; expected Associative[Str,Int] but got Hash[Str,Int] ($(my Str %{Int}))
in block <unit> at <tmp> line 1
guifa but that’s not a problem for positional 20:16
p6: my Positional[Str] $foo = Array[Str].new("a","b")
camelia ( no output )
lizmat guifa: the Associative role in core carries this comment:
# These methods must be implemented by any object performing the Associative role. The reason this is not actually activated, is that there are some chicken-and-egg issues with building the core if we do. 20:17
i think that's the reason Associative vs Hash doesn't work
20:18 sarna joined
guifa I can’t imagine people using that one too often, thankfully. I tried to cover the most common use cases and gotchas (and I hope my slurpy section scared people away from using them haha) 20:19
Oh, this works, though, maybe I’ll mention it somewhere
p6: my Associative[Str,Int] $foo = Hash.new(a => 1) does Associative[Str,Int]; say $foo.WHAT
camelia (Hash+{Associative[Str,Int]})
guifa There’s no problem doubling it up, with Hash[Str,Int] does Associative[Str,Int], so it can type match both levels 20:20
20:30 hacktor joined
Geth doc: alexandrianlibrarian++ created pull request #3153:
Add note that token methods don't backtrack and what that means.This …
20:32 mahmudov left
shred_alert Oh cool 20:32
Git activity shows up here
20:33 mahmudov joined 20:34 mahmudov left 20:36 mahmudov joined
lizmat AlexDaniel: RT#128092 is NOT in the mapping gist, but RT redirects it to 5252 20:40
that ticket is referenced in Stringy 20:41
same for 128318 redirecting to 4999 (which is 127168 in RT) 20:48
cpan-raku New module released to CPAN! Gnome::GObject (0.15.9) by 03MARTIMM 20:51
20:52 hacktor left
Geth doc: facd93dcbb | alexandrianlibrarian++ | doc/Language/grammar_tutorial.pod6
Add note that token methods don't backtrack and what that means.This should be helpful to newcomers.
doc: f5b7405db7 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | doc/Language/grammar_tutorial.pod6
Merge pull request #3153 from alexandrianlibrarian/master

Add note that token methods don't backtrack and what that means.This … Thanks!
20:56 wamba joined
AlexDaniel lizmat: I have a feeling that it's a merged ticket 20:59
lizmat ahhh... ok, so you're saying the redirect is correct ? 21:00
AlexDaniel lizmat: yeah, the redirect itself is correct: rt-archive.perl.org/perl6/Ticket/D...?id=127951
21:00 mahmudov left
lizmat ok, I'll take those in the second round: I'm going through the setting replacing all RT references to new URLs now 21:01
AlexDaniel is there a need to do that?
lizmat yes, because RT will not stay around indefinitely 21:02
AlexDaniel hmm
lizmat so those references need to be updated
AlexDaniel but maybe delay it for a bit?
lizmat why?
AlexDaniel or… I don't know
thing is, some of these tickets will move
for example, some were already moved to raku/doc
cpan-raku New module released to CPAN! Gnome::Gtk3::Glade ( by 03MARTIMM
lizmat well, I'm checking them all now
AlexDaniel at least the open ones will
lizmat so if I run into a moved ticket, i'll let you know 21:03
in any case, RT wouldn't know about a moved ticket anyway, right?
AlexDaniel it's not an issue, it'll be just one more redirect away
lizmat does GH redirect moved tickets ?
AlexDaniel RT will redirect to github and then github will redirect to another repo
lizmat ok
AlexDaniel let me find an example…
lizmat and when RT goes down, we're stuck 21:04
note the use of "when" gere
Grinnz has anyone said RT will go down?
AlexDaniel rt.perl.org/Ticket/Display.html?id=126459
Grinnz my understanding was the read-only site would stay up indefinitely 21:05
21:05 mahmudov joined
lizmat Grinnz: no, but I think the chance of RT becoming unavailable is orders of magnitude larger than of GH going down 21:05
Grinnz (I did just update references all over the perl source though)
lizmat right, which makes sense
Grinnz: and why did you do that ? 21:06
Grinnz because new users won't understand what RT is
i updated links, haven't updated casual references yet but i plan on that too
lizmat right, :-) 21:07
Grinnz no matter what i update though, links to RT for perl are permanently all over the internet, maybe that's less of a problem for raku
but personally, i'm relying on it being up forever :P 21:08
AlexDaniel lizmat: I guess links to github tickets are better anyway because they're clickable :) 21:09
lizmat indeed :-)
Grinnz yes, many integration benefits
AlexDaniel Grinnz: it's not so much about the integration, we use full links generally 21:10
Grinnz: github.com/perl6/roast/blob/aa4994...ess.t#L143
compare that to RT references above :)
Grinnz as you might expect, it's completely inconsistent what is used in perl source ;) 21:11
21:13 [Coke] left 21:26 wamba left, wamba joined
Geth ecosystem/JJ-patch-7: 01e95542a1 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Adds Array::Shaped::Console

A shaped-array console-rendering function.
21:28 polettixx joined
Geth ecosystem: JJ++ created pull request #478:
Adds Array::Shaped::Console
ecosystem: 01e95542a1 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Adds Array::Shaped::Console

A shaped-array console-rendering function.
ecosystem: 0b1a10b5a4 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Merge pull request #478 from perl6/JJ-patch-7

Adds Array::Shaped::Console
21:52 mensvaga left 21:55 sena_kun left
unclechu hey, do you know whether distros are going to replace or add a new package called "raku" instead of "perl6"? 22:02
in nix package database "rakudo" still provides "perl6": nixos.org/nixos/packages.html?chan...query=raku 22:03
the same for fedora the distro
Grinnz the fedora packager is fedoraproject.org/wiki/User:Gerd, it would be up to them 22:05
or a new packager could help of course
shred_alert Has the name changed in the rakudo source yet? 22:10
22:16 kensanata joined
guifa Yay! just sent off my PerlCon proposal. 22:17
22:41 shred_alert left 22:44 patrickb joined 22:55 vrurg_ joined 22:56 vrurg left 23:04 kensanata left 23:12 hacktor joined 23:30 lucasb left 23:31 hacktor left