🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log inspection is still being worked out. If you're a beginner, check out the #raku-beginner channel!
Set by lizmat on 16 August 2021.
[Coke] submitted a trivial PR to Cro, that's something, anyway. 02:10
lizmat clickbaits rakudoweekly.blog/2021/08/16/2021-...cumbering/ 08:32
thundergnat Is there a reason that concurrency is not enabled for .first? Or maybe I am just doing it wrong... 11:08
m: put (^∞).map(1 ~ *).race.map( -> \n { next unless [eq] (2,3,4,5,6).map: { (n × $_).comb.sort.join }; n } ).first; say now - INIT now; 11:09
camelia 142857
0.549896505
thundergnat m: put (^∞).map(1 ~ *).map( -> \n { next unless [eq] (2,3,4,5,6).map: { (n × $_).comb.sort.join }; n } ).first; say now - INIT now;
camelia 142857
0.753836408
thundergnat m: put (^∞).map(1 ~ *).race.first( -> \n { [eq] (2,3,4,5,6).map: { (n × $_).comb.sort.join } } ); say now - INIT now;
camelia 142857
1.010666259
thundergnat m: put (^∞).map(1 ~ *).first( -> \n { [eq] (2,3,4,5,6).map: { (n × $_).comb.sort.join } } ); say now - INIT now; 11:09
camelia 142857
0.775302808
thundergnat ^^ .map and .race.map are faster than both .first and .race.first 11:10
And .race.first is significantly slower than bare .first. (I know, it depends on the load, but this calculation should be heavy enough to benefit from race.) 11:12
Or possibly I am just confused... I would certainly not be the first time. (probably not even the first time today 🙄) 11:14
I can't stick around, but I read the logs regularly.
kawaii_ Hello, I have a subroutine which returns some JSON data. I'd like to iterate over each pair in the data and run the amount through my stake-int-friendly routine so the number becomes human readable - but I can't really figure out how to break down the data for iteration. www.irccloud.com/pastebin/UW0o3sD9/ 12:04
example data ^ www.irccloud.com/pastebin/veHjkNOA/ 12:05
sena_kun kawaii_, is that me or you are doing a loop on values and stake-int-friendly returns not a pair value, and then you try to initialize a hash with those not pair values? 12:11
maybe you mean something like... 12:12
my %stakes = stakers-info<>.map({ $_<delegator> => stake-int-friendly($_<amount>) })? 12:13
kawaii_ oh, hmm, this looks like it makes more sense, let me try it :)
sena_kun I am really not sure desugaring (unpacking?) in signatures work this way as you probably intend it to.
kawaii_ sena_kun: thank you, this works perfectly :) 12:15
sena_kun m: sub foo { @(%( a => '12001464284108570651140', d => 'rdx1' ),) }; my %hash = do for @(foo) -> $item { $item<d> => ($item<a> * 2) }; say %hash; 12:16
camelia {rdx1 => 24002928568217141302280}
sena_kun the call to .Hash is not necessary
yw
kawaii_ sena_kun: am I going about trying to iterate over this in a Cro template the wrong way? `<:sub input($_)><@stakes><.amount> : <.delegator></@></:>` 12:23
`template 'stakes.crotmp', format-stakes;`
sena_kun kawaii_, your template assumes you are passing a hash with `stakes => ...`, but your `format-stakes` routine returns just a hash? 12:26
so you probably need something like `%( stakes => format-stakes() )`?
demostanis[m] Wouldn't Raku with Rust macros be awesome? 12:28
lizmat why not Raku with Raku macros ? :-) 12:42
demostanis[m] Raku macros seem less fun than Rust's
lizmat in their current state: yes, I agree :-) 12:44
leont Yeah, it's waiting for RakuAST before it gets really interesting 12:49
demostanis[m] What's RakuAST? 12:50
leont A big refactor that's currently in progress on how code gets transformed into bytecode
dakkar or, more relevant to macros, a way for macros to actually look inside their arguments and make sense of them, and also a way to generate code without splicing strings together 12:52
demostanis[m]: www.youtube.com/watch?v=B5-gNKRw4g...mp;index=8 this video explains what it is, and the current status of the project 12:53
lizmat demostanis[m]: recommended :-) 13:14
MasterDuke seconded 13:23
demostanis[m] Ahh ok. I understand. It seems like a lot of work. 13:43
dakkar yep 13:44
but necessary
lizmat thundergnat: there is no .first on hypers yet 14:20
tellable6 lizmat, I'll pass your message to thundergnat
leont still has to watch that presentation, but it's in front of their yt queue 14:24
jdv is wondering if the mem leaking will change incidently by all the new big changes 14:34
lizmat has no doubt about that. But if it will leak more or less, that's the question :-) 14:36
tib Hello, I'm looking for a kind volunteer to proofread a long blog post (long = 22 minutes read according to devto) and report me mistakes (technical and english). Of course it's about raku :) 14:40
gfldex I could read it. If that proofs anything, I don't know. :) 14:41
Altreus I can do the grammar bit
MasterDuke jdv: any mem leaking in particular in mind? 14:51
frost m:say DateTime.now
evalable6 2021-08-17T16:51:47.136597+02:00
tib thank you a lot gfldex and Altreus I'm already on it with lizmat :) :) 14:58
jdv yes, the very same that mr lembark ran into 15:00
i can probably repro it these days - maybe i will
i think the prevailing guess was libuv buffers or soemething now that i think about it 15:01
Altreus :)
MasterDuke jdv: github.com/rakudo/rakudo/issues/3086 ? 15:02
jdv hmm, i don't think so. 15:06
i'll try to golf it. i'll be back in a few hours probably...
MasterDuke cool 15:09
pat_js is there a syntax to match on hash keys? 15:59
Altreus there's .keys.grep 16:00
pat_js m: "!foo"~~/'!' [$({:1foo,:2bar}.keys)]/ 16:01
camelia ( no output )
dakkar m: say "a" ~~ %(a=>1)
camelia True
dakkar m: say "a" ~~ %(b=>1)
camelia False
pat_js Altreus: but I want it the other way around (full keys as part of a regex, not parts of keys described by regex) 16:02
Altreus m: "!foo" ~~ any( $({:1foo,:2bar}.keys) ); # does any work? 16:04
camelia ( no output )
Altreus o you'd have to map maybe
m: "!foo" ~~ any( {:1foo,:2bar}.keys.map: / $_ / ); # maybe?
camelia No such method '!cursor_start' for invocant of type 'Str'
in block <unit> at <tmp> line 1
Altreus eh something like that
I anticipate you're trying to inject it into an existing regex anyway 16:05
dakkar m: my %a=(foo=>1, bar=>2); say "!foo" ~~ /@(%a.keys)/
camelia 「foo」
dakkar like that?
pat_js m: my %a=(foo=>1, bar=>2); say "!foo" ~~ /'!'@(%a.keys)/
camelia 「!foo」
pat_js yeah! thank you dakkar! did not know about the @() inside of a regex 16:06
dakkar pat_js: the `@(%a.keys)` in that case is expanded to something like `['foo'|'bar']`
Altreus that's an intelligent DWIM
I like that
dakkar docs.raku.org/language/regexes#Quo...TM_matches plus the "normal" way to cast something to a list 16:07
docs.raku.org/language/regexes#Reg...erpolation oh, it's actually mentioned at the end of this section
Altreus "the longest-match alternation" 16:09
pat_js That's where I should have looked better… thank you again
Altreus m: my @increasingly-edible = <food foo fo f>; say 'food' ~~ /@increasingly-edible/;
camelia 「food」
dakkar the documentation is *vast*, I knew something like that was documented but it still took me a while to find it!
Altreus m: say 'food' ~~ /< food foo fo f >/ 16:10
camelia 「food」
Altreus ah! order not important
dakkar Altreus: yep, lists get interpreted as `|`-alternatives, that do longest-token-matching
m: say 'food' ~~ /[f||fo||foo||food]/ 16:11
camelia 「f」
dakkar `||` does left-to-right
Altreus aha
dakkar I don't think there's a way to have @-interpolations do `||`, though
Altreus Where to draw the line between "relevant here" and "go and find that out", when writing docs, is difficult
Personally I would have at least nb'd that there were | and || lists 16:12
"lists"
in regex
alternations
Altreus oh I just realised this section is part of the | doc :D 16:17
mjgardner New blog post on using Perl modules in Raku: phoenixtrap.com/2021/08/17/perl-ra...frenemies/ 18:52
lizmat mjgardner++ 18:59
gfldex lolibloggedalittle: gfldex.wordpress.com/2021/08/17/most-fancy/ 20:42
holyghost_ ugh! network kill. 22:04
tib mjgardner Nice post! I think you posted twice the Raku snippet whereas you wanted to post a pure Perl 5 version in the « Perl feed finder » part + there is 2 words without space « typesused » 22:05
holyghost_ anyway, hacking perl5 for third Ph.D. Will work more on AI-NLP later on.
tib But this is a great post with a lot of interesting links as usual (you know I’m a fan)
mjgardner Thanks tib. The hazards of crossposting to another CMS… 22:13
Should be fixed now
tib Fixed mjgardner 22:14
Thank you for this 22:15