🦋 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.
uzl[m] perl6.party/ doesn't seem to be available anymore :-(. 00:11
farcas82regreg hello 01:23
i'm new to raku (and perl in general), what would the most idiomatic way would be to generate a random phrase? I have about 100 probabilistic grammars describing random company names, i'm basically doing the random company name generator part of the stock market simulator 01:24
basically i have a separate probabilistic grammar for each company sector/industry 01:25
the engine must generate company names first
what would be the idiomatic way?
also do you ppl happen to know a good raku online forum? i might need to post my questions for wider audience 01:26
rypervenche farcas82regreg: Hang around for an answer. Some of the ones who could answer this have gone to bed for the night, but will be around tomorrow morning, if they don't answer tonight. 01:40
farcas82regreg rypervenche, ok 01:40
Xliff o/ 02:16
Does Raku have a decent gettext implementation with something that can properly handle .po files? 02:17
rypervenche Xliff: modules.raku.org/dist/POFile:cpan:JNTHN ? 02:19
Xliff I looked at this earlier... the docs didn't make much sense. 02:21
rypervenche What are you trying to do exactly? 02:22
Xliff Port this to perl6: github.com/dniku/shutter/blob/mast...Toolbar.pm
All entries to $d are from the Perl5 Locale module, I think. 02:23
PO files are here: github.com/dniku/shutter/tree/mast...po/shutter 02:26
And I know I need to handle LANGUAGE and LANG environment vars, too...
Was hoping there was something out there that could handle it all for me so I can focus on the porting. Not re-inventing Locale. 02:27
Xliff rypervenche: Well, thanks for the suggestion. I may have to take another look at POFile. Was kinda put off by the interface, I guess. 02:37
jmerelo Apparently, perl6.party is down, right? 06:37
.tell uzl[m] we seem to have discovered it at the same time... 06:38
jmerelo Some URLs still seem to work... tpm-regex.perl6.party/#/47 06:38
Geth doc: f37792ebf3 | (JJ Merelo)++ | doc/Type/Str.pod6
Clarification on synthetic numerics and No values

Refs #2632
06:51
linkable6 Link: docs.raku.org/type/Str
doc: 4a590756ab | (JJ Merelo)++ | doc/Type/Int.pod6
polymod acting on lazy lists added

Refs #2632
linkable6 DOC#2632 [open]: github.com/Raku/doc/issues/2632 [Hacktoberfest][RFE][big][docs][good first issue][help wanted][new][⚠ Top Priority ⚠] Checklist for 6.d
Link: docs.raku.org/type/Int
doc: df4c29982f | (JJ Merelo)++ | doc/Type/Int.pod6
Changed to other similar URL, more permanent (probably)

Refs #3212
linkable6 DOC#3212 [open]: github.com/Raku/doc/issues/3212 [site] Substitute perl6.party URLs
rba . 07:47
rindolf rba: ..
moon-child ... 07:48
lizmat weekly: www.noudaldenhoven.nl/wordpress/?p=288 08:49
notable6 lizmat, Noted! (weekly)
SmokeMachine hi guys! I’m playing with this: github.com/FCO/EventExpressionLanguage this is the think I was asking a few days ago… would someone like to play with that? 09:15
(far from be working yet...)
lizmat SmokeMachine: a readme would be nice in github.com/FCO/EventExpressionLanguage ? 09:28
SmokeMachine lizmat: sure! I’ll do that as soon as possible… (sorry) 09:29
lizmat then it would be RWN worthy :-)
SmokeMachine lizmat: sorry, what RWN means? 09:30
lizmat Rakudo Weekly News :-) 09:31
SmokeMachine :)
lizmat fka P6W
SmokeMachine lizmat: I think it’s too early stage to that… it isn’t even working yet... 09:32
lizmat but I understand you want feedback about the idea, no ? 09:33
SmokeMachine yes
lizmat so, I'd present it as a discussion piece, not as a new module :-)
SmokeMachine But there is something a little bit more readable here: gist.github.com/FCO/ae6f90cec5e0ba...cb3f1af120 (I don’t think it’s good enought yet for RWN) 09:34
lizmat afk for a few hours&
SmokeMachine foo222: this is how thet thig we were discussing is going: github.com/FCO/EventExpressionLanguage and gist.github.com/FCO/ae6f90cec5e0ba...cb3f1af120 09:42
scimon So today I found that if I use a regex in the where clause in a signature $0 and so forth are available in the sub... is this a lucky accident or just more Raku awesomeness? 10:13
jnthn Well, only really works out well if you have one such regex :) 10:19
scimon True. 10:20
jnthn But it falls naturally out of the routine's $/ being in dynamic scope at that point.
scimon :D
abraxxa I can't find infos regarding newline matching in Grammars 11:09
I want to match a multiline comment
moritz what kind of info do you want? 11:17
\n matches a newline
. matches anything, including newlines
abraxxa moritz: I'm currently matching each comment line as a separate token using token comment { \N* } and rule option:sym<comment> { ' '*'#'<comment>)>\n } 11:35
abraxxa I was wondering if something like the Perl 5 m regex modifier is active or not 11:35
I think it's safer to match each line and combine them like token comment-line { <.ws> '#' \N* \n }, token comment-lines { <comment-line>+ } 11:37
or would you solve it differently?
jnthn Depends if I actually want the comments or just want to ignore them 11:38
abraxxa I ignore them currently in the action class
jnthn In the latter case I tend to stick parsing of them in my <.ws>
abraxxa but want to attach them to the 'option'/
I though I'll define a new token comment-with-option { <comment-lines>?<option> } 11:39
jnthn Ah, then I'd have to think about it a bit more, though Rakudo's grammar does actually parse Pod declarator comments in the <.ws>, and then uses dynamic variables to stash 'em and have 'em attached :)
jnthn Which works nicely enough there, but may not be convenient for all situations. 11:40
abraxxa and instead of token TOP { <option>+ } use token TOP { <comment-with-option>+ }
s/comments/comment-lines/ 11:41
and the first file I try to parse fails because it only has a comment :_) 11:47
abraxxa so how to handle that... 11:48
timotimo greppable6: ignorecase 11:52
greppable6 timotimo, 71 lines, 5 modules: gist.github.com/ba95ce5e8eb325db14...2fbd5ca5ee
timotimo greppable6: :i\b 11:55
greppable6 timotimo, 1378 lines, 139 modules: gist.github.com/75c5bb3cb6b621daf9...b2f72b2625 11:56
timotimo i sense a desire / need for "BLAH".starts-with("blah", :ignorecase) and friends 12:00
timotimo eq with :i is probably already served just fine with .match 12:00
m: say "BLAH".match(:i, "blah")
camelia Nil
timotimo m: say "BLAH".match(/:i blah/)
camelia 「BLAH」
timotimo hum. or not.
lizmat timotimo: same for contains and substr-eq I guess 12:02
timotimo yeah 12:03
lizmat fwiw, I implemented .contains(/foo/) last week
timotimo of, match with :i is a contains, not an eq
oh*
lizmat timotimo: no, it returns a Match, not a Bool 12:04
which is *much* heavier
timotimo that also
but i mean in terms of anchoring
lizmat .contains(Regex) returns a Bool without creating a Match object
timotimo contains(Regex, :i) is not going to work, same reason as .match(Regex, :i) 12:06
timotimo alternatively, implement Regex.make-ignorecase 12:08
good luck with that, that would be gnarly 12:09
if the regex contains code blocks or lexicels 12:10
lizmat timotimo: lcing the string before doing the contains ? 12:12
abraxxa I need a token that can match either comment, comment with option, or just option 12:18
token comment-with-option { <comment-lines>?<option>? } doesn't work because it matches nothing successfully too which means the TOP rule never stops
timotimo lizmat: well, fc. but i do believe we have a bunch of i / im / m nqp ops for many of the string ops 12:37
lizmat yeah: github.com/perl6/nqp/blob/master/d...kdown#eqat 12:38
and github.com/perl6/nqp/blob/master/d...down#index 12:39
won't work on the JVM backend though :-(
timotimo could be registered as a desugar that just calls fc on both arguments before doing anything 12:41
was fc of ẞ and ß still Ss and ss?
lizmat no idea
moritz I think so, yes 12:42
lizmat ask daxim, he did a lightning talk on it once :-)
moritz upper-case ß never really caught on
and there are stability promises in Unicode that means they can't simply change the rules for existing characters
timotimo could be ok if you do substr before eqic 12:49
er
fc
gunnar97 Recently my installed zef has become dead slow: Hours to install a package and this is what I got when asking for help: 13:24
$ time zef --helpZef - Perl6 Module ManagementUSAGE zef [flags|options] command [args]COMMANDS install Install specific dependencies by name or path [ ... ]real62m52.027suser4m11.913ssys1m22.005s
Any ideas how to fix it?
abraxxa I think I've asked this before but can't remember the answer: how can I undefine a variable? 13:25
jnthn gunnar97: Just zef or any module loading? What does `echo $PERL6LIB` say? 13:26
abraxxa: For saclars, at least, assign Nil
abraxxa jnthn: thanks! 13:27
gunnar97 All stuff. The variable just contain '.', curr dir
jnthn Try clearing it. :) 13:28
I think having . in there means it'll go scanning everything beneath the current directory for modules, which could get quite time consuming if there's a lot to search. 13:29
gunnar97 That made the trick! Hmm, but this is a new phenomenon and i've had '.' there for almost all my perl6/raku life. 13:30
SmokeMachine lizmat: a first draft of an attempt of a README... github.com/FCO/EventExpressionLang...ree/master
lizmat SmokeMachine++ 13:33
weekly: github.com/FCO/EventExpressionLang...ree/master
notable6 lizmat, Noted! (weekly)
cpan-raku New module released to CPAN! Operator::dB (0.0.96) by 03ALLSOPP 14:02
New module released to CPAN! HTML::BoreDOM (0.0.7) by 03ALLSOPP
SmokeMachine lizmat: did that make any sense?
lizmat on casual glance, yes... some minor spello's, but other than that nothing stood out to me as being wrong 14:03
SqrtNegInf m: sub t ($s) { srand($s); say (^100).rand}; t(1) for 1..3 14:14
camelia 30.8302962221659
30.8302962221659
30.8302962221659
SqrtNegInf m: sub t ($s) { srand($s); say (^100).roll}; t(1) for 1..3
camelia 3
87
73
SqrtNegInf The varying results for .roll bisect to the libtommath update 14:15
lichtkind has jj a new handle? 14:23
lizmat SqrtNegInf: please make an issue ! 14:26
SqrtNegInf Yep, on the way... 14:28
lizmat SqrtNegInf++ 14:29
bisectable6: srand(1); ^100 .rand.say # who knows this will actually give useful info 14:30
bisectable6 lizmat, On both starting points (old=2015.12 new=cfe2cdc) the exit code is 0 and the output is identical as well
lizmat, Output on both points: «30.8302962221659␤»
lizmat SqrtNegInf: ^^^ looks like it's been like that a long time ?
bisectable6: srand(1); ^100 .rand.say for ^3
bisectable6 lizmat, Bisecting by output (old=2015.12 new=cfe2cdc) because on both starting points the exit code is 0
lizmat ah, the first value is being kept 14:31
AlexDaniel` 6c: srand(1); ^100 .rand.say for ^3 14:31
bisectable6 lizmat, bisect log: gist.github.com/13838b712d01bb39ad...ce305e283f
lizmat, (2018-03-25) github.com/rakudo/rakudo/commit/a2...bf10bc1d11
committable6 AlexDaniel`, gist.github.com/e78fed785f57e9c138...1e4bb2c2a3
lizmat m: srand(1); ^100 .rand.say for ^3 14:32
camelia 30.8302962221659
66.93476443244059
78.20976054058401
lizmat hmmm...
SqrtNegInf I'm seeing the srand interaction with .roll and .pick just since Rakudo version 2020.01-76-ge1faa704e
lizmat m: srand(1); (^100).rand.say for ^3
camelia 30.8302962221659
66.93476443244059
78.20976054058401
lizmat aaah.... it's resetting the srand every time 14:33
there is no bug...
the weird thing is that .roll is not predictable
lizmat finally gets it 14:34
I think
rypervenche lizmat: Would you have time to look at my grammar question? I have added some example code and file text in my gist: gist.github.com/rypervenche/2a42fb...df93369d08 14:38
lizmat rypervenche: currently working on the weekly, will look at it some time after that
rypervenche Take your time. I do love the weeklies <3 14:39
jnthn rypervenche: I'm not sure TOP needs to be a regex. If yoiu just want to ignore lines that don't match, completely, you could have `token TOP { [<line> || \N*]* % \n }` or some such 14:44
rypervenche Ahh! Let me try that. 14:47
moritz don't forget to match the final \n if there is one 14:49
jnthn Ah, indeed...%% I think? 14:51
rypervenche Will do. 14:51
[Coke] jnthn++ 14:52
rypervenche Oh! That looks to be working correctly now with this. Is my \N*? all right or is there something smarter to use there in "token line"? (updated gist.github.com/rypervenche/2a42fb...df93369d08 ) 15:02
jnthn rypervenche: I did consider you could make line a proto and then have variants for line with identifier and line without, but I suspect it's not so useful since 1) you don't really need the LTM, 2) you probably want to ignore lines that don't match, and this way you won't need to discard them in actions. 15:03
So I think the way I suggested is probably the better solution overall 15:04
(Unless you do want the lines without identifiers too.)
rypervenche I was thinking of making a proto, but as there are only two options and, as you said, the unwanted lines, I guess this works. I just wanted to make sure that I wasn't doing anything wasteful or inefficient with the \N*? in line. I keep wanting to use .*? in everything. Thanks for helping with this. 15:06
jnthn If you've made TOP a token, then there's no backtracking to worry about anyway 15:08
.*? is sensible in the other case, and probably essential for correctness
rypervenche Using \N* didn't work, as I'm assuming it would skip over <entry> and go straight to the end of the line. \N*? looks to have worked. 15:11
(in token line, that is)
Glad it's finally working. :)
lizmat fwiw: upping the number of threads to 64 makes it a lot slower, and I haven't seen it crash yet 15:42
(running for ~ hour now)
oops, wrong channel
abraxxa how can I call the method of a Grammar ActionClass? 15:55
or access one of its attributes? 15:56
Geth doc: uzluisf++ created pull request #3214:
Minor rewording and ...
16:02
nine abraxxa: action classes are plain classes, so it works like everywhere else? 16:09
nine abraxxa: perhaps I'm missing some context for your question 16:10
abraxxa nine: I only get a match object when i call parse
no idea how to access the Action object
nine access it where?
abraxxa the methods aren't defined on the match object
nine The Match object has an actions attribute: docs.raku.org/type/Match#method_actions 16:11
abraxxa yes! 16:13
thanks!
Altreus I have an architecture question I'm not sure I'm going to explain very well but here goes 16:15
The Discord API has a habit of sending back partial objects, especially when the request was for a different object. E.g. maybe it sends back a bunch of users in a channel when you request a channel 16:16
Altreus I don't want to send a request for every single one of those users just to populate the channel object fully; and I don't want to discard the data either 16:16
Grinnz Twitter does similar things 16:17
Altreus What I think I want is for the object to know it's a partial object and to fetch itself later on if the user requires it, but I don't know how to do that
Also it might not be what I want to do
Altreus I sense the answer lies in the metaclass, but here be dragons 16:17
Geth doc: coke assigned to stoned Issue Invalid example in doc/Type/Cool.pod6 github.com/Raku/doc/issues/3213
a4c562c2ef | (Luis F. Uceta)++ | 2 files

  * Wrap language constructs with C<> where appropriate.
16:18
Altreus The alternative I could think of would be to have a property that runs in parallel to @.users, @.users-partial
but that seems nasty
Well it's a % I think 16:20
Grinnz my twitter api mechanism is intentionally dumb, but twitter comes back with a partial user object when you get a tweet, and a partial last-tweet object when you get a user, i just fill in the object with whatever's there 16:21
Altreus I thought of having something along the lines of «%users{$id} = User.new but Partial» but then I'd have to remove Partial later, and it seems to me that a complete object is just a Partial one with no missing parts
Grinnz up to the user to have requested what they need
Altreus But can the user request what they need?
Grinnz sure, get_user if you need the full user 16:22
Altreus I guess that could be idempotent
So if you pass it a complete user it just returns it
Altreus Then you don't need to know if it's a full user 16:22
colon thinking colon 16:23
Grinnz mainly i just wanted to avoid doing unnecessary requests
because in 100% of cases so far i havent actually needed to request further
Altreus It seems more likely in my case that this will be necessary 16:24
Possibly
It's more likely to be the Message object, honestly
$message.author will probably be a partial object
I guess what I /really/ want is a sort of central cache of each object type 16:25
So it doesn't matter how I come by the User object - I either already know about it, or I get it
The other concern is I can't just swap objects out with a complete version of them
Or I'd do that
Grinnz i guess the most i can suggest is to determine what kind of tradeoff you want to make between DWIM and explicit managing of how many requests are made
Altreus yes ... the eternal tradeoff 16:33
I will consider
doc: 1424d9e9fd | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | 2 files
Merge pull request #3214 from uzluisf/master

Minor rewording and ...
lizmat it's that time of the week again: another Rakudo Weekly News hits the Net: rakudoweekly.blog/2020/02/10/2020-...r-brewing/ 17:09
Geth doc/master: 4 commits pushed by (JJ Merelo)++ 17:10
jmerelo lizmat++ 17:11
Doc_Holliwould m: sub roman( RomanIntStr $r is copy .= uc ) { } 17:13
camelia 5===SORRY!5=== Error while compiling <tmp>
Invalid typename 'RomanIntStr' in parameter declaration.
at <tmp>:1
------> 3sub roman( RomanIntStr7⏏5 $r is copy .= uc ) { }
Doc_Holliwould booh, I say
booh
;-)
m: sub roman( Str $r is copy .= uc ) { } 17:15
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed parameter
at <tmp>:1
------> 3sub roman( Str $r is copy7⏏5 .= uc ) { }
expecting any of:
constraint
Doc_Holliwould Is there a way to do that? Transforming an argument in the within the sig. 17:16
Altreus sounds side-effecty 17:20
lizmat Doc_Holliwould I guess you could put it in a where block ? 17:24
but yuck ? 17:25
Geth doc: 03badf9cbc | (JJ Merelo)++ | doc/Language/variables.pod6
Converts an inline-note in a real note refs #3215
17:41
linkable6 Link: docs.raku.org/language/variables
doc: 36191c3771 | (JJ Merelo)++ | doc/Language/variables.pod6
Adds new indexing term refs #3215
linkable6 DOC#3215 [open]: github.com/Raku/doc/issues/3215 [RFE] Improve (including better indexing) of dynamically scoped variables
jmerelo Camelia has apparently stopped working in #whateverable 17:42
Also, this
m: say $foo // 3
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$foo' is not declared
at <tmp>:1
------> 3say 7⏏5$foo // 3
jmerelo So far so good
But
m: say $*not-defined // 3
camelia 3
jnthn Why the "but"? 17:43
jmerelo Do dynamic variables get an out-of-not-defined-hell-card free?
Geth doc: 3b8f9fe964 | (Elizabeth Mattijsen)++ | doc/Type/Cool.pod6
Fix example

Since I was the one who merged this faulty example.
linkable6 Link: docs.raku.org/type/Cool
jmerelo jnthn: so is that spec?
jnthn jmerelo: The failed lookup produces a Failure
jmerelo: Sure
You're then disarming the failure with // 17:44
jmerelo m: $*not-defined = 33; say $*not-defined
camelia Dynamic variable $*not-defined not found
in block <unit> at <tmp> line 1
jnthn They're dynamic; we can't reason about them lexically (that is, at compile time).
jmerelo jnthn: which is why they behave differently to static variables 17:45
jnthn Yes.
jmerelo should we maybe document that?
jnthn I'm sure there's quite a lot of code doing the $*maybe-exists // 'default' thing
jmerelo: For sure; I'd assumed it already would be :) 17:46
If it's missing, totally worth documenting.
jmerelo jnthn: don't be sure about anything in the documentation...
jnthn :)
True; I tend to use the documentation almost entirely for standard library reference, not for language reference. 17:47
jmerelo jnthn: in this case, that's not the case: it's documented 17:47
jnthn: "a dynamic variable can be used undeclared as long as it's checked for definedness or used in a boolean context before using it for anything else"
m: say $*not-defined or "Bust" 17:48
camelia WARNINGS for <tmp>:
Useless use of constant string "Bust" in sink context (line 1)
Dynamic variable $*not-defined not found
in block <unit> at <tmp> line 1
jmerelo m: say $*not-defined || "Bust"
camelia Bust
jnthn jmerelo: Yes, I just went looking and found exactly that :) 17:49
lizmat m: say "bust" without $*FOO
camelia bust
jnthn Though searching for "dynamic variable" or "dynamic scope" in the search box didn't lead me to it
Dunno if we try to index such terms
jmerelo jnthn: yep, that's the thing. I just created an issue for that: D#3215 17:50
linkable6 D#3215 [open]: github.com/Raku/doc/issues/3215 [RFE] Improve (including better indexing) of dynamically scoped variables
jmerelo jnthn: please add that if you think they should be found through those terms too. 17:51
lichtkind jmerelo: thank you 17:59
jnthn jmerelo: Done so :) 18:01
jnthn goes home, hopes the wind isn't too high
jmerelo jnthn: thanks! 18:17
lichtkind: no problem, my pleasure
cpan-raku New module released to CPAN! Gnome::Gtk3 (0.23.1) by 03MARTIMM 18:39
guifa o/ 19:35
veesh \o 19:58
Geth ¦ old-issue-tracker: AlexDaniel assigned to Kaiepi Issue Specifying the source address of an outgoing connection using IO::Socket::* github.com/Raku/old-issue-tracker/issues/6399 21:01
Geth doc: c18229e558 | (Stoned Elipot)++ | doc/Language/compilation.pod6
Fix xref links
21:40
linkable6 Link: docs.raku.org/language/compilation
stanrifkin I upgraded to moar-2020.01 with rakudobrew but there is no perl6 executable. I just build it with rakudobrew build moar and switched to it. 22:56
cpan-raku New module released to CPAN! Getopt::Long (0.1.4) by 03LEONT 23:18