🦋 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 getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
00:02 reportable6 left 00:04 reportable6 joined 01:04 evalable6 left, linkable6 left 01:07 evalable6 joined 01:29 frost joined 02:29 greppable6 left, releasable6 left, committable6 left, statisfiable6 left, nativecallable6 left, benchable6 left, bisectable6 left, squashable6 left, tellable6 left, quotable6 left, unicodable6 left, sourceable6 left, bloatable6 left, evalable6 left, shareable6 left, reportable6 left, coverable6 left, notable6 left 02:30 committable6 joined, sourceable6 joined 02:31 coverable6 joined, shareable6 joined, bisectable6 joined 02:32 quotable6 joined, Eddward joined 03:29 unicodable6 joined 03:30 squashable6 joined, notable6 joined 03:31 tellable6 joined, releasable6 joined, greppable6 joined 03:56 Eddward left 04:00 squashable6 left, squashable6 joined 04:15 squashable6 left 04:18 squashable6 joined 04:29 evalable6 joined 04:30 nativecallable6 joined 05:07 linkable6 joined 05:29 statisfiable6 joined 05:30 bloatable6 joined 05:48 broquaint left, renormalist left, tonyo left, esh left, moritz_ left, moritz joined, renormalist joined, esh joined, broquaint joined 05:49 tonyo joined 05:54 mtj left, patterner_ left, nebuchadnezzar left, juanfra__ left, phogg left, polettix left, wanko left, ingy left, Juerd left, gugod left, wanko joined, nebuchadnezzar joined, patterner_ joined, polettix joined 05:55 mtj joined, Juerd joined 05:56 gugod joined, phogg joined 05:57 ingy joined 06:00 djerius left 06:02 djerius joined, reportable6 joined, Sgeo left 06:14 abraxxa joined 06:22 abraxxa left 06:23 abraxxa joined 06:24 jjido joined 06:29 benchable6 joined 07:22 jjido left 08:11 dakkar joined 08:48 patrickb joined 08:50 Xliff left 09:26 squashable6 left 09:30 squashable6 joined 09:59 lizmat_ joined 10:03 lizmat left 10:08 Xliff joined, lizmat_ left 10:09 lizmat joined
Xliff Good mornign, #perl6 10:17
s/#perl6/#raku/
One of these days...
Nemokosch do these s// notations actually do something on the IRC? 10:19
or is it just a kind of inside joke
Xliff Inside joke 10:20
Although if you preceed anything with "m:", what follows is taken as evalable code by camelia and she'll try and run it.
Nemokosch It started being suspicious that there is some kind of bot there as well 😄
oh okay, that I can see 10:21
Xliff m: say "Hi there!" ~~ m:g/[er]/
camelia (「er」)
10:28 immediate joined
immediate hi, out of curiosity :d Is there any way to detect if a passed array is actually an attribute of an instance object? 10:31
*passed to a function 10:32
moritz no, the array knows nothing about where it's referenced 10:34
lizmat well, actually, you can with introspection:
m: class A { has @.a }; sub b(\a) { dd a.VAR.name }; b A.new(a => (1,2,3)).a
camelia "\@!a"
moritz my experience with introspecting container names is that's not as reliable as you'd want it to be 10:35
lizmat true
in any case, that property is being used by "dd"
m: class A { has @.a }; dd A.new(a => (1,2,3)).a 10:36
camelia Array @!a = [1, 2, 3]
Xliff lizmat: Have you played with RakuAST long enough to know which nodes are used in the creation of something like this: "sub a ( &b (Int, Str --> Num) ) { }"
lizmat Xliff: it's been many months since I've done anything with rakuAST, so I wouldn't know offhand
I suggest checking the tests, they all have the intended Raku equivalent source code in comments and/or tests 10:37
immediate: you're probably better of mixing in a role into whatever values you want to be able to detect 10:39
m: class A { has @.a = 1,2,3; method TWEAK() { @!a does role { method foo() { } } } }; sub b(\a) { say "{a} is a foo" if a.can("foo") }; b (1,2,3); b A.new.a 10:43
camelia 1 2 3 is a foo
lizmat m: class A { has @.a = 1,2,3; method TWEAK() { @!a does role { method foo() { } } } }; sub b(\a) { say "{a} is a foo" if a.can("foo") }; b (4,5,6); b A.new.a # clearer
camelia 1 2 3 is a foo
immediate lizmat: thank you very much! 10:45
Xliff lizmat: Looked. Doesn't seem to be there 10:47
I'll try and catch jnthn.
10:53 Altai-man joined 10:59 frost left 11:02 patrickb left 11:14 immediate left 11:18 frost joined
Anton Antonov What would be the most elegant way to rename the keys in a hash? For example, I have a hash `h0` and a hash `kk` with key-to-new-key mapping. I found the Perl5 module `Hash::Rename` something like that and it was not that hard to re-program it in Raku, (metacpan.org/pod/Hash::Rename). But I would rather use Raku "direct" code. 11:32
lizmat %newhash = %hash.map: { %mapper{.key} => .value } 11:33
you could even .race that if the hash is very big 11:34
11:35 squashable6 left
Anton Antonov @lizmat Great, thanks! 11:35
lizmat this of course assumes no clashes and no keys added while mapping 11:38
Anton Antonov @lizmat During the weekend I read the code of your packages `Hash::int` and `Hash::Agnostic`. Is it a good idea to have a package `Hash::str`? And if yes, should `Hash::str` it based on `Hash::int` or `Hash::Agnostic`?
lizmat probably neither 11:41
Anton Antonov @lizmat Haha, ok! 11:47
lizmat just give me a mo, it's basically just a cat license of Hash::int
Anton Antonov Sounds great! 11:48
lizmat well... the speedup for the native str Hash would only be a few % 11:50
Anton Antonov @liszmat Any speed-up is welcome! 11:51
lizmat nah, just benchmarking it a bit now, it is within noise 11:52
11:52 squashable6 joined
Anton Antonov Do you think that is across all platforms / OS? 11:53
I think it might instructive to see the code anyway...
@lizmat FYI, my motivation for asking for `Hash::str` is to speed-up building of tries-with-frequencies. (Which is a favorite Machine Learning method/approach of mine.) My initial Raku implementation was 100 slower than my Java implementation and 5 times slower than my Mathematica implementation. I was able to reduces those factors by half (40 and 2.2 respectively) but that is still slow. 11:55
12:02 reportable6 left
lizmat Anton Antonov: Hash::str should be available now after a "zef update" 12:04
12:05 reportable6 joined
Anton Antonov Great! Thank you! 12:05
@lizmat And, yes, I found the code here: github.com/lizmat/Hash-str . 12:08
@lizmat And, yes, I found the code here: github.com/lizmat/Hash-str . 12:14
Geth raku-mode: 4ee9045eeb | Altai-man++ (committed using GitHub Web editor) | raku-mode.el
Bump version to have an update without pkg-info

  @phikal++ for the suggestion.
12:27
Altreus Having discarded the traditional regex grammar, I don't suppose Raku went a step further and discarded the traditional datetime formatting codes as well? 12:30
I marvel at the use of many of these, and the logic behind many others 12:31
%t - a tab character ... as if we can't put a tab character in a string already 12:33
lizmat printf compatibility was rated high
Altreus strftime not printf 12:34
lizmat meanwhile, I think the rakuAST approach of printf shows how we can easily make something better and be performant (because it will generate code, rather than interpret stuff each time)
Altreus printf generally has useful codes
lizmat I don't think we have strftime support in Raku ?
Altreus oh, then I approve
:D
ah it has a formatter object 12:35
I do wish someone would formally name Y-m-dTH:M:S±z so we can create meaningful method names 12:36
lizmat m: sub Y-m-dTH:M:S±z { } 12:38
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3sub Y-m-dTH:M:S7⏏5±z { }
expecting any of:
new name to be defined
lizmat m: sub Y-m-dTH:M:S { }
camelia ( no output )
lizmat too bad about the ± :-) 12:39
Altreus hey wait, you can put a colon in identifiers?
Wouldn't it be seen as an adjective?
lizmat m: sub Y-m-dTH:M:S { dd }; Y-m-dTH:M:S 12:40
camelia sub Y-m-dTH:M:S()
Altreus m: class Y-m-dTH:M:S {}
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use adverb S on a type name (only 'ver', 'auth' and 'api' are understood)
at <tmp>:1
------> 3class Y-m-dTH:M:S7⏏5 {}
expecting any of:
generic role
lizmat I don't recall the exact semantics of that, but yes, you can
Altreus ah
that's where it's an adverb
class identifiers have different rules :) 12:41
lizmat yup
Altai-man m: class YouCan't {}; say YouCan't.new;
camelia YouCan't.new
lizmat I think they're considered adverby on other identifiers as well
raku.land/zef:lizmat/Acme::Don't :-) 12:43
Altreus oh good, Raku was feeling boring without acme 12:44
lizmat raku.land/?q=Acme
Altreus +1 for don't x unless y 12:45
that's English! 12:46
12:47 Eddward joined
Altreus I have been informed the datetime format I want is in rfc3339 12:59
Anton Antonov @lizmat Your example here github.com/lizmat/Hash-int uses `Hash::str` (not `Hash::int`.)
lizmat Antonov: yeah a snafu, I guess I should make an update 13:00
Altreus a thinko 13:02
Anton Antonov @lizmat Your example here github.com/lizmat/Hash-int uses `Hash::str` (not `Hash::int`.)
Altreus discord bot may be duplicating messags 13:03
lizmat Antonov: should be fixed now
13:07 jmcgnh left
Anton Antonov @lizmat Ok, thanks! 13:13
13:15 frost left 13:20 Altai-man left 13:21 Altai-man joined, jmcgnh joined 13:26 immediate joined 13:28 Altai-man left 13:30 Altai-man joined
@lizmat I programmed a benchmark for `Hash::str` and `Hash::int` -- both are 40-50% faster on my MacBookPro. 13:53
@lizmat It looks like though I cannot use `push` on those structures. Is it something that has to be implemented? I.e. should I open issues on the corresponding GitHub repositories? 13:54
codesections I found this surprising. Any thoughts on whether it's a bug: 14:01
m: class C {...}; say C.foo; say C.bar; my class C { my $n = 42; method foo { $n }; method bar { 42 }}
camelia (Any)
42
codesections Specifically, the "this" I'm referring to is that local variables in a class are declared but not assigned in the time between a forward declaration of the class and the actual declaration 14:02
14:17 Sgeo joined 14:25 justsomeguy joined 14:32 justsomeguy left 14:41 justsomeguy joined
lizmat Antonov: please open issues :-) 15:14
15:15 justsomeguy left
raydiak codesections: I don't have time to check docs for an explanation, but I for one do find that surprising 15:36
autopunned roles don't seem to suffer from it, interestingly: 15:37
m: role C { ... }; C.m; role C { my $foo = 42; method m { say $foo } }
camelia 42
codesections raydiak, thanks. If no one chimes up with a reason it's _not_ a bug, I'll open an issue later today 15:47
raydiak if you wanted to check the docs yourself, I'd be searching for something about class composition time and compile vs run time, I strongly suspect it's something to do with those things 15:54
codesections++ good at shaking out the bugs 15:55
afk &
16:12 Altai-man left 16:26 tejr left, tejr joined 16:35 dakkar left
[Coke] www.reddit.com/r/rakulang/comments...ntime_for/ looks nifty. Wonder if there's enough other stuff to make the online attendance package worth it. 16:52
17:35 evalable6 left, linkable6 left 17:37 linkable6 joined
codesections That does look really interesting. It looks like at least many of the talk recordings from the 2020 conference were posted online (2020.splashcon.org/). I hope the same is true this year 17:53
[Coke] (y) 17:57
18:03 reportable6 left 18:05 reportable6 joined 18:18 peder left
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2021/09/27/2021-...ming-haku/ 18:44
18:44 peder joined 19:44 linkable6 left 19:57 vasko left 20:04 vasko joined
raydiak thank you lizmat++. if I may offer a correction, in "Jonathan Worthington saw a relative easy way to optimize subroutine calls" "relative" should be "relatively" 20:31
20:35 evalable6 joined
[Coke] wonder how much faster 'zef install HTML::Canvas --deps-only' would be on an M1 mac instead of this ancient beast. 20:37
ugexe dont forget it could be slower depending on how much JIT affects it 20:43
although when skipping tests everything was a bit faster in zef (presumably due to the extra cores of the m1 vs the previous gen intel i7 macbook) 20:44
tonyo [Coke]: 23s on my m1
it also failed
ld doesn't have an arm for libfreetype
arm arch 20:45
20:50 jjido joined, immediate left
[Coke] 'zef look' doesn't respect my path. if I change my PATH, then do a 'zef look', I get my default raku, not the one first in my PATH. 20:56
tonyo zef isn't a shell 20:57
[Coke] zef launches a shell. I'm saying the env vars aren't being passed in to the invoked shell 21:05
sorry, "zef look" launches a shell. 21:06
jdv why does zef look launch a shell? weird. i didn't know about that. 21:24
ugexe cause thats what `panda look ...` did heh 21:27
and i imagine panda did that because cpanm does that 21:33
jdv oh
[Coke] ugexe: does it make sense to try to preserve existing shell env vars or should I not expect that? I no longer need it, but will open a ticket if you like 21:37
lizmat raydiak++ # fixed 21:43
ugexe [Coke]: i'm not sure how that wouldnt already be happening if raku sees it fine since shell passes along %*ENV and the zef look logic is essentially just a 1 liner -- github.com/ugexe/zef/blob/1809160b...kumod#L881 21:46
[Coke]: i'm not sure how that wouldnt already be happening if raku sees it fine since shell passes along %*ENV and the zef look logic is essentially just a 1 liner -- github.com/ugexe/zef/blob/1809160b...kumod#L881 21:47
for me it seems to work as you expect 21:55
i.e. if i set `BAR=42` then do `zef look` i can still see BAR as 42 21:56
[Coke] could have been user error, for sure. 22:00
my issue was that when I did "which raku" I got the rakubrew raku instead of the one I had first in my PATH before issuing zef look. 22:01
ugexe ah well you probably have something like .bash_profile or some such auto setting that
[Coke] ... D'oh 22:03
22:05 jrjsmrtn left, gugod left, jrjsmrtn joined 22:12 gugod joined
[Coke] so yes, user error. :) 22:16
22:33 jjido left 22:37 djerius left 22:39 djerius joined 22:46 linkable6 joined 22:51 vasko4 joined 22:53 vasko left, vasko4 is now known as vasko 23:31 juanfra left, AlexDaniel left 23:32 demostanis[m] left, cnx left, happy-dude left 23:47 AlexDaniel joined 23:54 happy-dude joined