šŸ¦‹ 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.
japhb Normally it's not super-slow. It's responding now again (was timing out for a while for me). It uses an in-memory DB, so maybe the VM was swapping ...? 00:02
00:02 reportable6 left 00:05 reportable6 joined 00:10 monkey_ joined 00:12 linkable6 left 00:13 linkable6 joined 00:26 melezhik joined
melezhik .tell AlexDaniel are latest whateverable commits missing bin/raku? gist.github.com/melezhik/b85595140...a962e90371 00:27
tellable6 melezhik, I'll pass your message to AlexDaniel
00:34 melezhik left
AlexDaniel Hmmm maybe 00:53
tellable6 2021-07-19T00:27:37Z #raku <melezhik> AlexDaniel are latest whateverable commits missing bin/raku? gist.github.com/melezhik/b85595140...a962e90371
AlexDaniel So only bin/perl6 and no bin/raku ?
Or .. uhm
Ah, these are failed builds I think 00:54
I see now, sry
You can check the logs, they're present in the tar as well
Sounds like something is wrong on the main branch, if that's what you're seeing for the latest commita 00:55
Commits*
01:05 monkey_ left 01:06 monkey_ joined 01:16 pjscott joined 01:17 monkey_ left 01:30 pjscott left 02:16 squashable6 left 02:19 squashable6 joined 02:23 squashable6 left 02:25 squashable6 joined 02:45 pjscott joined
pjscott Hello! Having trouble with latest rakudo. I downloaded rakudo star 2021.04 and built from source for Linux; I then tried installing command line rakudoc from github but raku couldn't find the target of 'use Rakudoc'. It says: 02:49
Could not find Rakudoc in: 02:50
inst#/home/peter/.raku
inst#/home/peter/rakudo/share/perl6/site
inst#/home/peter/rakudo/share/perl6/vendor
inst#/home/peter/rakudo/share/perl6/core
ap#
nqp#
perl5#
But putting Rakudoc.rakumod in that path didn't help. Yet I can 'use DBIish' and it works, but DBIsh.pm6 isn't in that path. 02:51
02:53 linkable6 left 02:56 linkable6 joined
pjscott I gather it's finding DBIish in some precompiled file, but I still don't know where to put Rakudoc.rakumod. 03:00
I fixed it with by adding a use lib to the rakudoc script but can't help think I missed something basic. 03:07
03:08 canw joined 03:12 canw left, canw joined 03:22 pjscott left
avuserow if I have a list @a, and want to remove all elements from @a that are in @b, is there a better way than: my $to-remove = @b.Set; @a .= grep({ $_ !(elem) $to-remove}); 03:43
I also need to preserve the ordering of the items in @a.
m: my @a = (1, 2, 3, 4, 5); my @b = (2, 3); my $to-remove = @b.Set; @a .= grep({$_ !(elem) $to-remove}); dd @a 03:45
camelia Array @a = [1, 4, 5]
lucs m: my @a = (1, 2, 3, 4, 5); my @b = (3, 2); say @a (-) @b 03:46
camelia Set(1 4 5)
lucs docs.raku.org/language/operators#i...e_operator 03:47
avuserow hmm, looks nice 03:51
but if I convert back to a list with `.keys`, then the ordering is lost, presumably when it makes the set 03:52
lucs Hmm... Right. Maybe someone else will know. 03:53
avuserow technically I could write it as `@a .= grep({$_ !(elem) @b.Set})` which is very nice and short, but I'd rather have the extra variable than make the extra Sets :) 03:55
03:59 dg joined
raydiak there are many ways to do it, and I'm not sure which is fastest for your case, or which you would consider "better", but here is another with no Set and no intermediate variable: 04:00
m: my @a = 1..5; my @b = 2, 3; @a .= grep: { !@b.first: $_ }; say @a
camelia [1 4 5]
avuserow yeah, I guess I wanted to make sure there wasn't a magic operator that I was overlooking 04:05
or an "inverted grep" (`@a.keep({...})` or something, I dunno) 04:06
raydiak not off the top of my head. inverted grep was something someone else speculated about in recent weeks though, not a bad idea imo 04:07
could use a Junction... 04:10
m: my @a = 1..5; my @b = 2, 3; @a .= grep: none @b; say @a
camelia [1 4 5]
avuserow okay, I guess my original question was thinking of something along the lines of python's `remove(value)` method for a list. but you would have to call it N times
oh yeah, junctions are a good option 04:11
moon-child @a .= grep: &[āˆŠ].assuming(*, @b) 04:17
err, should be āˆŒ 04:18
and get rid of *,
or &[!(cont)] for texans 04:22
avuserow I did some benchmarking just for kicks 04:26
.assuming is way slow
everything else is fairly similar, with `(@a (-) @b).List` being the fastest (if you can live with the randomized ordering) 04:29
but all the other approaches come within 10% of each other, and sometimes it varies which one is fastest (maybe my system is not sufficiently idle to always select a consistent winner) 04:30
moon-child oh my, .assuming is ... slightly disturbing
github.com/rakudo/rakudo/blob/mast...e.pm6#L311 04:31
avuserow surprisingly, creating the Set in advance (like my original approach) is not always better than just doing `@a .= grep: {$_ !(elem) @b}`
though my data is an array of five elements and removing two, so that's on the tiny side
moon-child yeah, hash-type collections are generally slower than arrays at such small sizes. (The flip side, though, is that an std type should know that and use an array representation when it's small enough, so you don't have to worry about that) 04:32
mykhal avuserow: you may realize that even in Python, list comprehension would be better than remove(), where you would have to check presence of en element as well 04:37
avuserow though if I really needed the speed, I would change the backing database structure and just issue a DELETE FROM table WHERE id IN (...)
mykhal m: my @a = 1..5; my @b = 2, 3; say ( $_ unless $_ (elem) @b for @a ; )
camelia (1 4 5)
moon-child avuserow: have you seen red?
avuserow Red scares me :)
okay, it does not scare me. it's too much magic for my application, and it is very cool 04:38
but yes, I've seen a bit of it
04:44 Xliff joined
Xliff \o 04:44
What's the best way to force GC?
I'd like to test something in a DESTROY
avuserow Xliff: seems like there's nqp::force_gc? or you can look at what Inline::Perl5 does in its tests: github.com/niner/Inline-Perl5/blob...ctor.t#L25 04:51
Xliff avuserow: Thanks! 04:53
Now THAT'S odd. 04:54
When I create an object, I get a different .WHERE than I do when it is reaped in submethod DESTROY! 04:55
moon-child compacted maybe 04:56
04:56 leedo left
Xliff class A { submethod DESTROY { say "D: { self.WHERE }"; }; }; my $a = A.new; say "C: { $a.WHERE }"; $a = Nil; use nqp; nqp::force_gc; my $p = start sleep 3; await $p; say "A: { A.WHERE }" 04:56
m: class A { submethod DESTROY { say "D: { self.WHERE }"; }; }; my $a = A.new; say "C: { $a.WHERE }"; $a = Nil; use nqp; nqp::force_gc; my $p = start sleep 3; await $p; say "A: { A.WHERE }"
camelia C: 139933773097672
D: 139933738761072
A: 77365192
04:56 leedo joined
Xliff O_o 04:57
I'
I expected the C and D values to be the same.
HAH! If I use an attribute's WHERE, it works. 05:00
avuserow "Please note that in the Rakudo implementation of Raku, and possibly other implementations, the memory location of an object is NOT fixed for the lifetime of the object." - docs.raku.org/routine/WHERE
Xliff Aaand... it's the same value. Of course. The Attribute object, itself. :/ 05:01
I'm trying to get something instance level.
raydiak I'd hesitate to use DESTROY at all. you can't count on it happening at any certain time (even in the middle of other code running), in any certain order, or even at all (even when the program terminates). beyond that, I'd also strongly avoid relying on underlying VM semantics. is there no clear exit path in your own code that you could use to call your own teardown methods manually? 05:08
even with force_gc it's not guaranteed... 05:12
m: class C { submethod DESTROY { say "DESTROY!"; } }; my $o = C.new; $o = Nil; use nqp; nqp::force_gc();
camelia ( no output )
raydiak m: class C { submethod DESTROY { say "DESTROY!"; } }; my $o = C.new; $o = Nil; use nqp; nqp::force_gc(); sleep 0; # it seems to wait for an idle time to actually run the gc 05:13
camelia DESTROY!
raydiak and none of that is guaranteed not to change tomorrow 05:14
05:24 dogbert17 left, dogbert17 joined
Xliff radiak: Thanks for telling me something I already knew! :) 05:28
And for this use case, I only care that it happens, not WHEN. That's exactly what DESTROY was meant for, yes? 05:29
I only asked about force_gc for testing purposes.
Glad I did. My initial assumption turned out to be wrong. LOL 05:30
raydiak you can count on me to state the obvious :) 05:31
Xliff Haha! I get where you were coming from. You were helpful. That's all that matters. radiak++ 05:32
At any rate, crossed 600kLOC of Raku, today!
See github.com/Xliff/p6-GLib/blob/mast...x?raw=true 05:33
raydiak heh that's quite a lot
but no, I don't believe you can always count on DESTROY running. maybe if you always call force_gc and then something else after it, but if there's a point where you can do that, then you might as well just call your own destructor methods which will always be reliable regardless of underlying VM behavior. that's why I showed that example above of it not running, so you know it won't always be called 05:36
maybe better to at least get input from a more authoratative core dev before relying on it 05:37
afk
Xliff radiak: If it doesn't get called then it doesn't get called. I just need it to make a basic attempt at resource cleanu. 05:41
Without it, I'd leak like a sieve.
And there is NO OTHER METHOD that will work. This is not something for manual methods. 05:42
05:57 ufobat__ joined 06:02 reportable6 left 06:03 abraxxa joined 06:05 reportable6 joined 06:09 abraxxa left 06:10 abraxxa joined 06:13 jmcgnh left 06:26 Sgeo left 06:33 patrickb joined 06:48 Eddward_ left 06:52 ufobat__ left 07:00 patrickb left 07:02 ufobat joined 07:18 jmcgnh joined 07:28 canw left 07:31 keutoi joined 07:36 canw joined, canw left
mykhal this fries CPU and memleaks: t' or '^D' 07:39
eh, sorry, paste issue. correct code: "" ~~ /<.ws>+/
also with * instead of + and/or without . and/or on non-empty string on left 07:46
(not trying to say to m, don't want to hurt camelia) 07:48
07:51 dakkar joined 08:10 lizmat left, lizmat joined
SmokeMachine yes, that's an infinite loop, right?! 08:12
it will always find a `<ws>` on "" for ever...
m: say "" ~~ /<ws>/ 08:13
camelia ļ½¢ļ½£
ws => ļ½¢ļ½£
SmokeMachine m: say "" ~~ /<ws> ** 10/
camelia ļ½¢ļ½£
ws => ļ½¢ļ½£
ws => ļ½¢ļ½£
ws => ļ½¢ļ½£
ws => ļ½¢ļ½£
ws => ļ½¢ļ½£
ws => ļ½¢ļ½£
ws => ļ½¢ļ½£
ws => ļ½¢ļ½£
ws => ļ½¢ļ½£
ws => ļ½¢ļ½£
SmokeMachine m: my token my-ws { \s* }; say "" ~~ /<my-ws> ** 10/ 08:18
camelia ļ½¢ļ½£
my-ws => ļ½¢ļ½£
my-ws => ļ½¢ļ½£
my-ws => ļ½¢ļ½£
my-ws => ļ½¢ļ½£
my-ws => ļ½¢ļ½£
my-ws => ļ½¢ļ½£
my-ws => ļ½¢ļ½£
my-ws => ļ½¢ļ½£
my-ws => ļ½¢ļ½£
my-ws => ļ½¢ļ½£
SmokeMachine mykhal: it's something like this: ^^ 08:19
it will always find "no space" 08:23
08:24 keutoi left 08:26 Geth joined
moon-child ways, so the empty string is whitespace? I find that counterintuitive 08:32
SmokeMachine no... 08:35
but <ws> matches 0, 1 or more white spaces, that's matching 0 spaces 08:36
moon-child right
SmokeMachine and because it matches 0 spaces it do not move forward... so it will match for ever... 08:43
09:03 charsbar left 09:04 charsbar joined 09:12 jmcgnh left
mykhal But it's just a pattern. Either should match or not, and not try to match forever 09:41
is perl -e 'print "" =~ /^^/' should also nahg ? 09:43
moon-child what do you think "" ~~ /[.*]*/ should do?
mykhal s/is//; s/nahg/hang/
initiallly i'd think that special meaning would be switched to literary in [] 09:48
09:49 jmcgnh joined
mykhal i'll think more afte ma after-vacc sleep 09:50
09:55 lealnie joined 10:13 hankache joined 10:36 silug2 joined, silug left, silug2 is now known as silug 10:39 rba[m] joined 10:56 hankache left 11:01 sena_kun joined
raydiak imo, a quantified construct matching nothing should only match once in a particular string position. this also seems to be how p5 behaves. that said, not everyone agrees, and this is a known behavior with a closed issue: github.com/rakudo/rakudo/issues/4438 11:06
Geth problem-solving/master: 5 commits pushed by (Daniel Sockwell)++, (Juan JuliĆ”n Merelo GuervĆ³s)++, (Elizabeth Mattijsen)++ 11:17
abraxxa is watching Liz FOSDEM talk on sets. Is there really no ascii equivalent of the negated set operators? 11:19
lizmat !(elem) 11:20
prefix with !
I guess we could consider something like (!elem) 11:21
abraxxa I see, thanks! Junst wondered because you didn't include them in the slides 11:22
lizmat m: sub infix:<(!elem)>(\a,\b) { !(a (elem) b) }; dd 42 (!elem) ^10 11:23
camelia Bool::True
abraxxa why does a union of two arrays not return an array but a set?
I prefer the negation before the operator instead of another operator
lizmat because it is a *set* operator, which always at least returns a Set 11:24
abraxxa is there an operator for joining arrays too?
lizmat define joining ?
abraxxa concatenate
lizmat m: my @a = ^5; my @b = 42,666; @a .= append: @b; dd @a 11:26
camelia Array @a = [0, 1, 2, 3, 4, 42, 666]
abraxxa like append does
lizmat or just .append :-)
abraxxa so no operator, only the method? 11:27
lizmat well, depends... 11:28
abraxxa what Bruce Gray said in his 'Raku, the Big' talk is what I'm thinking since years: there needs to a best practise guide for what way to use when 11:29
why operators when there a methods for all those things? They are just hard to remember, I guess hard to suggest for a text editor and aren't as easy to understand for novices 11:30
what helped me in Perl 5 to remember the sigils when I learned it back then was the explanation why the characters where chosen: like % looks like key / value 11:32
lizmat m: sub infix:<@>(\a,\b) { slip(|a,|b) }; .say for 42,666 @ ^10
camelia 42
666
0
1
2
3
4
5
6
7
8
9
sena_kun I don't think operators are not easy to understand for novices, people are just ok with "5 + 5" and it is far easier to them than "5.add(5)".
abraxxa (|) for union seems weird to me, I would have expected to be (~) because ~ is used to join strings
sena_kun: for mathematics everybody is used to it 11:33
sena_kun I do agree there is a place for the tool and when the syntax complexity goes overboard, that's a bad thing in general
lizmat abraxxa: | is "or", so it indicates elems that are either on left *or* right
abraxxa yes, I was also thinking
lizmat (&) indicates elems that are on both sides, as & is "and"
abraxxa 'or' when I've seen it but couldn't find an explanation as what an or has to do with joining 11:34
lizmat: that explanation absolutely makes sense, thank you! Can it be included in the docs?
lizmat abraxxa: probably, if someone (you?) makes a PR for that? github.com/Raku/doc/pulls 11:41
11:51 juanfra left, happy-dude left, demostanis[m] left, AlexDaniel left, cnx left, CIAvash left, aolko[m] left, littlebenlittle[ left, rba[m] left 11:53 juanfra joined 11:57 demostanis[m] joined, AlexDaniel joined, cnx joined, happy-dude joined 11:58 littlebenlittle[ joined, aolko[m] joined, CIAvash joined, rba[m] joined 12:02 reportable6 left 12:03 reportable6 joined 12:23 MasterDuke left 12:38 Eddward_ joined 12:56 TempIRCLogger joined 13:08 dogbert17 left 13:09 TempIRCLogger left 13:12 dogbert17 joined 13:16 MasterDuke joined 13:17 lealnie left 13:38 Sgeo joined 13:55 Kaiepi left, Kaiepi joined
abraxxa how is the Whatever * different from $_? Your example at 41:47 includes .sort(-*.value), .sort(-$_.value) would also make sense for me as $_ is the topic variable which gets set to each element of the array 14:31
Altreus I'm pretty sure that has to be .sort({-$_.value})
sena_kun abraxxa, `$_` won't work, as it is not a block
abraxxa or asking differently: why was * necessary in addition to $_ for such constructs? 14:32
lizmat what Altreus and sena_kun said :-)
Altreus which is then .sort({ - .value })
* becomes $_ /and makes a block/
FSVO "becomes $_"
I think of it more as "becomes $^a" ... or $^b or whatever Raku thinks makes sense 14:33
abraxxa FSVO?
{} is a pointy block, right? what type is it when you pass -*.value to sort? I guess sort is a multi-sub? 14:34
Altreus for some values of 14:38
There's a WhateverCode I think?
Ah, it's called Whatever-currying docs.raku.org/type/Whatever
> which is actually a Block that can be used wherever Callables are accepted 14:39
abraxxa so each literal text becomes a Whatever object? 14:46
how can I view pod6?
ah, rakudoc needs to be installed separately... 14:48
zef install rakudoc fails tests 14:49
lizmat: docs are hard. I've forked the docs repo. Will add some lines but it will need a review. 14:52
Altreus hah, that's a fun one!
What tests does it even have? :o 14:53
14:55 linkable6 left, evalable6 left
perlbot abraxxa pasted a new file at perl.bot/p/er7c6f - rakudoc test failure 14:56
14:57 linkable6 joined
Altreus looks like /site became /store perhaps? 14:58
14:58 evalable6 joined
ugexe no, tests would not be assuming the directory of the zef cache directory 14:58
(also more importantly is no such directory change has every occured in zef, so that couldnt be what they were doing) 14:59
looks like rakudoc is incorrectly trying to see if modules are installed
in rakudo itself
which it should also not be doing
15:00 discord-raku-bot left
ugexe in this case the test is written with the assumption the test dependencies are installed, but they dont have to be (they can be, and are, linked via -I/path/to/lib) 15:00
15:01 discord-raku-bot joined
ugexe t/04-compunit.t should be deleted entirely 15:01
Geth doc: abraxxa++ created pull request #3919:
add Set operator character explanations
SmokeMachine m: my &a = *.self; say &a.^name 15:10
camelia WhateverCode
Altreus surely that is not the way you determine whether a module is installed, whether it needs to or not 15:17
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2021/07/19/2021-...uled-to-3/ 15:38
sena_kun lizmat++ 15:39
Altreus a survey! 15:40
But the first question is hard
kind of weirdly worded throughout tbh 15:43
mykhal SmokeMachine, moon-child : maybe there shuld be at least some detection and warning for such infinite regex bombs
lizmat Altreus: you can leave your comments at the end of the survey :-) 15:51
15:51 melezhik joined
Altreus I saw this, but I couldn't articulate them 15:56
mykhal so is there a reson why Raku should explode on /(.*)*/ and Perl not ? 16:21
Altreus empirically, yes, otherwise it wouldn't 16:23
mykhal i mean SHOULD as in e.g. RFC 16:25
kind of
Altreus like is it defined in such a way that it would do that?
tu m'as posƩ un colle 16:26
mykhal mr armrer, mr cncn 16:31
Altreus: see several hours above 16:33
16:51 evalable6 left, linkable6 left 16:52 evalable6 joined 16:53 linkable6 joined 17:05 dakkar left
melezhik . 17:08
17:08 melezhik left 17:45 ufobat left 18:02 reportable6 left 18:05 reportable6 joined 18:21 sena_kun left 18:23 Xliff left
gfldex m: my &b = { ā€¦ }; my &wc = * - 1 + *; my &p = -> { ā€¦ }; (&b, &wc, &p)Ā».signatureĀ».say; 18:44
camelia (;; $_? is raw = OUTER::<$_>)
(;; $whatevercode_arg_1 is raw, $whatevercode_arg_2 is raw)
()
gfldex abraxxa: ^^^ the main difference between Block, pointy block and WhateverCode is the generates Signature. 18:45
18:45 linkable6 left 18:47 linkable6 joined 19:00 notna joined 19:26 dogbert11 joined 19:27 dogbert17 left, sono joined 19:28 archenoth left 19:33 notna left 19:43 archenoth joined
timo twitter.com/DeepSchneider/status/1...6877431811 19:54
lizmat yuck :-) 19:57
20:02 archenoth left 20:03 archenoth joined
gfldex m: constant yESā€¾wEā€¾cAN = True; 20:06
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing initializer on constant declaration
at <tmp>:1
------> 3constant yES7ā5ā€¾wEā€¾cAN = True;
gfldex :-(
m: constant term:<yESā€¾wEā€¾tERM> = True;
camelia ( no output )
gfldex :-) 20:07
20:07 dogbert17 joined 20:09 dogbert11 left 20:11 linkable6 left, linkable6 joined 21:11 evalable6 left, linkable6 left 21:13 evalable6 joined, linkable6 joined 21:21 Manifest0 left, Manifest0 joined 21:22 MasterDuke left 21:48 jgaz joined 22:00 Doc_Holliwood joined
Doc_Holliwood any idea why this bugs out? 22:00
m: dd map { .value / .key }, 1 .. * Z=> [\+] 10, 20 ... 90
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing comma after block argument to map
at <tmp>:1
------> 3 / .key }, 1 .. * Z=> [\+] 10, 20 ... 907ā5<EOL>
expecting any of:
postfix
22:01 jgaz left
Doc_Holliwood i can fix it with parens, i just don't see why they are neccessary here 22:01
leont I guess because the whatever consumes the entire expression on the right hand side 22:03
Doc_Holliwood m: dd map { .value / .key }, 1 .. Inf Z=> [\+] 10, 20 ... 90
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing comma after block argument to map
at <tmp>:1
------> 3 .key }, 1 .. Inf Z=> [\+] 10, 20 ... 907ā5<EOL>
expecting any of:
postfix
Doc_Holliwood nope
leont No, it consumes too much on the left side 22:05
The entire thing is the whatever expression?
Yeah, if you remove the map you just get a whatever expression, so that conclusion must be correct 22:06
No, it's a normal block. I don't know anymore. 22:07
22:29 dogbert11 joined, dogbert17 left 22:42 jmcgnh left
Doc_Holliwood it seems to think the comma belongs to the list 22:45
m: dd map { .value / .key }, foo => bar, 1 .. Inf Z=> [\+] 10, 20 ... 90 22:46
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing comma after block argument to map
at <tmp>:1
------> 3 => bar, 1 .. Inf Z=> [\+] 10, 20 ... 907ā5<EOL>
expecting any of:
postfix
22:47 jmcgnh joined 23:01 archenoth left 23:07 Juerd left 23:08 Doc_Holliwood left 23:16 Juerd joined 23:33 Juerd left 23:35 DocHolliwould joined
DocHolliwould attempts installing Comma on the new M1 23:40