🦋 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:00 stoned75 joined
melezhik .tell tony-o please take a look at this - github.com/tony-o/raku-fez/pull/15 , thanks 00:06
tellable6 melezhik, I'll pass your message to tony-o
00:11 lucasb left 00:12 benjif left
notagoodidea using JSON::Fast, the to-json function is particurly slow (even with :!pretty). 00:12
Is there a alternative to manage large JSON files? 00:13
moon-child notagoodidea: wrt libclang, not writing a native c parser with a raku grammar seems like a missed opportunity 00:14
(though maybe that needs more perf work yet; as I recall, somebody was trying to express a c++ grammar in raku and it took several minutes to parse a simple function declaration) 00:15
notagoodidea And following the various #include to parse too can be hell.
I will first try to port this github.com/floooh/sokol/tree/bindgen/bindgen to Raku 00:16
elcaro notagoodidea: There is JsonC... but if I recall comments about it, perf still leaves a little to be desired
notagoodidea From json spit by clang, filtering it and producing NativeCall from the cleaned json like floooh did for zyg. 00:17
moon-child yeah preprocessor is a pain
elcaro the parsing is faster, but the conversion from C to Raku data structure is a tad slow
moon-child notagoodidea: but, in raku you can already modify the parser over the course of a running program. Idk how that works but presumably you could do the c preprocessor in the same way
notagoodidea Will see because to-json is running on my computer for the last 10 minutes :)
(the JSON provided is big) 00:18
moon-child notagoodidea: afaik the sokol bindgen stuff relies on specific annotations in the sokol headers. So you wouldn't be able to use it for any other library 00:19
notagoodidea 165302 lines.
ah. 00:21
will try at least for the simplified json output from the clang dump. 00:22
moon-child: Leveraging grammer will be nice but I am not sure that will happen soon, performance wise. 00:26
I am not sure that even parsing JSON with grammar will be that performand (JSON::Fast goes straight for nqp)
moon-child :/ 00:27
notagoodidea And it will be a pain to use because it convert the JSON to a Str :/ 00:28
JsonC converts to a hash, that would be easier. 00:29
melezhik .tell tony-o I've added integration test for `fez meta` 00:30
tellable6 melezhik, I'll pass your message to tony-o
.tell tony-o maybe I should push all the tests to fez repo? i don't know ... 00:31
tellable6 melezhik, I'll pass your message to tony-o
notagoodidea Forget it, JsonC does not pass his test and zef refuse to install :/ 00:32
00:32 stoned75 left 00:41 benjif joined 00:46 pecastro left 00:53 oddp left 00:56 notagoodidea left 01:06 stoned75 joined 01:20 squashable6 left 01:21 jmchael left 01:23 squashable6 joined 01:35 mowcat left 01:41 melezhik left 01:42 stoned75 left 02:19 Ben_Goldberg joined, BenGoldberg left 02:20 Ben_Goldberg is now known as BenGoldberg 02:41 kvw_5 joined 02:45 kvw_5_ left 03:05 Sgeo_ joined 03:08 Sgeo left 03:22 benjif left 03:25 melezhik joined
melezhik . 03:25
.tell tony-o I put fez-test sparky configuration - github.com/melezhik/sparky-playgro...n/fez-test so far ... cc tib 03:26
tellable6 melezhik, I'll pass your message to tony-o
03:41 melezhik left 04:41 sourceable6 left, greppable6 left, evalable6 left, unicodable6 left, committable6 left, bloatable6 left, linkable6 left, coverable6 left, benchable6 left, squashable6 left, nativecallable6 left, tellable6 left, bisectable6 left, shareable6 left, statisfiable6 left, quotable6 left, notable6 left, releasable6 left, sourceable6 joined 04:42 greppable6 joined, nativecallable6 joined, statisfiable6 joined, bloatable6 joined, quotable6 joined, evalable6 joined, unicodable6 joined, tellable6 joined, benchable6 joined 04:43 shareable6 joined, coverable6 joined, committable6 joined, notable6 joined 04:44 linkable6 joined, releasable6 joined, squashable6 joined, bisectable6 joined 05:19 BenGoldberg left 05:26 hippo_ joined, epony left 05:27 epony joined
lucs Just saw about raku.land 05:31
Not sure why they're called "distributions" though.
Not "modules"? 05:32
05:37 brtastic joined 05:54 kst joined, kst left 05:55 kst joined 06:02 melezhik joined
melezhik lucs not a big difference on my view.  distribution is a certain version of a module ... something ... 06:04
I really like this page - raku.land/recent - a kind a trend of what's going on ... 06:05
06:08 melezhik left 06:11 jmerelo joined
lucs jmerelo: Good morning. 06:12
Having fun in the snow? 06:13
melezhik: Yeah, makes sense. Just not used to that term I guess. 06:14
tellable6 lucs, I'll pass your message to melezhik
jmerelo lucs: not down here, in Granada... 06:30
Not too far away, anyway. 06:31
lucs Aw, too bad, snow is nice (sometimes) ;) 06:33
06:33 rindolf joined
lucs Actually, I didn 06:33
't read up much on what happened. 06:34
I guess it must be pretty hard when you're not prepared for it.
06:35 wamba joined 06:42 parabolize left 06:44 jmcgnh joined 06:55 aluaces joined
jmerelo lucs: it's nice if you're warm and chill... I'm telecommuting these days, so... 06:58
lucs jmerelo: I grew up playing in the snow (winters, that is), which was nice. 07:01
As an adult, not so much :)
jmerelo lucs: not so usual where I lived. Just the cold and the chilblains. Even in Granada, it's an once every five years event. 07:02
not so usual in Madrid, either. Some people are having the time of their lives. Some are just having the most miserable time of their lives. 07:03
I lived in Úbeda, north of Granada, a small town which is 700 meters high. But Jaén and Granada are too dry, so rain is unusual
Xliff m: multi sub trait_mod:<is> (Method $m, :$query!) { my $r = $m; $m.wrap(-> |c { say 'Hi!'; nextsame; }); }; class A::B { method b is query { say 'B'; }; };
camelia ( no output )
jmerelo lucs: where did you live?
Xliff m: multi sub trait_mod:<is> (Method $m, :$query!) { my $r = $m; $m.wrap(-> |c { say 'Hi!'; nextsame; }); }; class A::B { method b is query { say 'B'; }; }; A::B.new.b 07:04
camelia Hi!
Attempt to return outside of immediately-enclosing Routine (i.e. `return` execution is outside the dynamic scope of the Routine where `return` was used)
in block at <tmp> line 1
in block <unit> at <tmp> line 1

lucs jmerelo: In Montréal
Xliff m: multi sub trait_mod:<is> (Method $m, :$query!) { my $r = $m; $m.wrap(method (|c) { say 'Hi!'; nextsame; }); }; class A::B { method b is query { say 'B'; }; }; A::B.new.b
camelia Hi!
lucs (Still there)
Xliff Wow. That doesn't work on my version of Raku.
m: $*PERL.compiler.version.say
camelia v2020.12.42.gd.53.a.92733
jmerelo lucs: makes sense, then. 07:05
Xliff: what didn't work? 07:06
Xliff m: multi sub trait_mod:<is> (Method $m, :$query!) { my $r = $m; $m.wrap(method (|c) { say 'Hi!'; nextsame; }); }; class A::B { method b is query { say 'B'; }; }; A::B.new.b 07:10
camelia Hi!
Xliff ^^
I get a 'Cannot invoke this object' error, locally.
I'm on the same version as Camelia. 07:11
jmerelo Xliff: from the REPL? 07:12
Xliff rak?
What REPL?
No, I'm running that from the command line.
I thought I had found a bug, and now it's looking to be environmental. Which is .... ODD 07:13
jmerelo Xliff: Ah, OK. The REPL might behave in a different way. Maybe it's just a new goodie in HEAD
Xliff: give committable a try
Xliff No. It's not a problem here.
I was hoping I could replicate it HERE.
I cannot. 07:14
It even works on repl.it
07:20 aborazmeh joined, aborazmeh left, aborazmeh joined 07:24 sjm_uk joined
Xliff jmerelo: FINALLY! 07:24
See repl.it/@Xliff/SorrowfulFlawedMicr...#main.raku
The compunit is the problem. Somehow the compunit is corrupting things. What I'm attempting works just fine when it's in MAIN:: 07:25
And with that, I must crash and ZZZZZ
07:27 ufobat__ joined
jmerelo Xliff: have a good night sleep :-) 07:29
Xliff tanks! ;) 07:32
07:32 Xliff left 07:40 aborazmeh left, aluaces left 07:59 sena_kun joined 08:05 domidumont joined 08:09 MasterDuke joined 08:10 BenGoldberg joined, aluaces joined 08:14 stoned75 joined
stoned75 nef 08:16
08:27 notagoodidea joined, Manifest0 left 08:30 Manifest0 joined 08:33 cgfbee left 08:34 Sgeo_ left 08:35 notagoodidea left 08:38 cgfbee joined
xinming_ SmokeMachine: is it possible to completely delete the optimizer in Red? 08:38
SmokeMachine Not currently, but that’s easy to change... why? Is it giving you problems? 08:39
xinming_: just need to not run this: github.com/FCO/Red/blob/master/lib/Red.pm6#L36 08:41
08:44 notagoodidea joined
notagoodidea moon-child: I found this "old" perl6 module by azawawi (github.com/azawawi/p6-libclang) that wrap libclang. And after a deep look at the sokol bindgen, there is nothing that specific. 08:54
the main problem is for now the JSON parsing. I have to try different modules available and worst case scenario use jq for that part. 08:55
or accept the JSON as string and try to parse with a grammar or whatnot. 08:57
MasterDuke notagoodidea: timotimo works on json::fast, he might have a suggestion 09:02
09:03 pecastro joined 09:06 dakkar joined 09:07 notagoodidea left 09:15 ufobat joined 09:17 aborazmeh joined, aborazmeh left, aborazmeh joined, ufobat__ left 09:21 JRaspass joined 09:23 tejr left 09:32 notagoodidea joined 09:36 sno left 09:39 Xliff joined 09:42 aborazmeh left 10:25 jmchael joined
lizmat clickbaits rakudoweekly.blog/2021/01/11/2021-...new-stuff/ 10:33
10:34 cono joined
cono p6: class { has %!h = a => 42; submethod BUILD() { %!h.say } }.new 10:34
camelia {}
tadzik BUILD is funny like that 10:35
p6: class { has %!h = a => 42; submethod TWEAK() { %!h.say } }.new
camelia {a => 42}
cono p6: class { has %!h = a => 42; submethod BUILD() { %!h.say }; method g { %!h.say } }.new.g
camelia {}
cono why I don't see it in method g? 10:36
tadzik becuase your BUILD breaks attribute initialization 10:37
it's not like Moose's BUILD, if you're familiar with that one, it does a bit more and it's often confusing, that's why TWEAK came to be 10:38
I wish I could tell you exactly what BUILD does and how to make it do what you need, but I just hate it, not understand it and never use it :P
but generally BUILD is the bit responsible for setting attribute values, so if you define your own BUILD then it's up to you to set them 10:39
cono oh 10:43
I thought BUILD's responsibility is only to set values passed by the arguments. But looks like assigning them in class, also done in BUILD
complex 10:44
thanks for explanation! tadzik++
tadzik you're welcome, I hope I got it right :P 10:45
notagoodidea I don't understand something. Using only JSON::Fast from-json and to-json, the to-json function is super slow. Same json file but using JSON::simd to load and to-json again from JSON::Fast to dump is super fast.
is due to the fact that JSON::simd create a raku hash instead of a string for the load? 10:46
lizmat notagoodidea: which version of JSON::Fast do you have ? 10:48
notagoodidea I just installed yesterday with zef, let me check. 10:51
the JSON provided is ~160K lines (it is a dump from clang ast of curl.h) 10:54
lizmat ok, then I don't think I have any suggestions to make things faster in the short term 10:56
notagoodidea With JSON::simd for loading and JSON::Fast for dumping, it is fast enough. 10:58
Using only JSON::Fast, loading is fast but dumping is really slow.
my guess is the from-json from Fast output a Str instead of a Hash and to-json have a bad time with it. 10:59
11:08 abraxxa1 left, abraxxa1 joined 11:12 PimDaniel joined
PimDaniel Hi! everybody's waked up? 11:13
Ok, i'll start with a simple question:
what's the difference between : my @l = <1, 2, 3>; and my @l = 1, 2, 3; ? thank's! 11:15
MasterDuke `<> ` in this case is a quoting construct
that automatically splits on whitespace 11:16
PimDaniel so my syntax is wrong : i do not have the ,
my @l = <1 2 3>; 11:17
11:17 thdrmz left 11:18 thdrmz joined
MasterDuke that'll create an array of strings (which in this case will actually be IntStrs, since they "look" like numbers) 11:18
11:18 sno joined
MasterDuke m: dd <1 2 3>; dd 1, 2, 3 11:19
camelia (IntStr.new(1, "1"), IntStr.new(2, "2"), IntStr.new(3, "3"))
11:20 asymptotically left
PimDaniel MasterDuke : thank you , i'm looking at docs.raku.org/language/quoting 11:20
11:22 PimDaniel left
notagoodidea ok thinks are getting weirder 11:26
MasterDuke pages Dr. Freud 11:28
notagoodidea `use JSON::Fast; my \x = slurp("curl-test.json") ==> from-json; my \xo = to-json x;` runs in
605sec 11:29
idem if you swap `use JSON::Fast` by `use JSON::simd :subs;` 11:30
11:30 Altai-man joined 11:32 sena_kun left
tadzik I guess it's the to-json that's slow, not the from-json, and JSON::simd just uses JSON::Fast's to-json()? 11:36
from JSON::simd's docs: As an added bonus, this also imports to-json from JSON::Fast, which works exactly as usual 11:37
notagoodidea yes but 11:38
'use JSON::simd; use JSON::Fast; my $json = JSON::simd.new; my \x = $json.load: "curl-test.json"; my \xo = to-json x;'
runs in
4.6s 11:39
11:39 aluaces left
notagoodidea I think that the from-json imported with :subs respects the interface of JSON::Fast by providing a Str 11:41
11:42 Toilie is now known as dudz 11:43 dudz left, dudz joined 11:45 Black_Ribbon left
notagoodidea tadzik: yep it returns a Str and when used the OO way it returns a Hash. to-json is fast with a hash and slow with a Str. 11:48
or I messed something with the feed operator in the declaration? 11:49
yep it is on me. 11:51
with the feed operator, the subs from JSON::simd runs in the time that the OO approach. 11:52
is there a precedence with assignement vs feed operator? 11:53
m: my $x = "foo" ==> map *.uc; say $x; 11:59
camelia foo
MasterDuke m: my $x = do "foo" ==> map *.uc; say $x; 12:01
camelia (FOO)
tadzik wait, what 12:03
if something returns a Str from JSON parsing, is it even parsing it at all? 12:04
dakkar sure, `"foo"` is a valid JSON-encoded string value
(but I think that's not the issue here) 12:05
notagoodidea tadzik: I will test without my mistake to check what JSON::Fast returns
tadzik dakkar: it's valid, yeah, but if I think if one parsing method returns a Hash and another returns a Str then at least one of them is wrong :P 12:06
notagoodidea tadzik: it returns an Hash
tadzik for some value of wrong anyway... github.com/qntm/fastjson
notagoodidea The mistake is on me by using the feed operator in the assignement 12:07
MasterDuke would it be too snarky to say it seems to me that much of npm would belong in the Acme:: namepace in CPAN? 12:09
notagoodidea and Fast is the fastest
lizmat: in case of, the problem was pebak not JSON::Fast 12:10
lizmat *phew* :-) 12:12
12:12 aborazmeh joined, aborazmeh left, aborazmeh joined
tadzik MasterDuke: I just assume everything on npm is sarcastic :P 12:15
12:20 PimDaniel joined
PimDaniel Hi! 12:20
Modify array by ref with a sub: 12:21
look a my piece of code : pastebin.com/8Tc463py
In Perl5 it was bad to use $_ unless we declared it local. 12:22
Is it safe tu use $_ in a for loop in raku like i did with sub b(@r) {...} in my paste_bin given example? 12:23
if no : could we declare loop variable -> $e as rw? 12:24
12:29 aborazmeh left 12:30 BenGoldberg left, Ben_Goldberg joined, Ben_Goldberg is now known as BenGoldberg
PimDaniel Thank's in advance! 12:33
moritz you can use for @a <-> $n { $n = 42 } 12:35
for @a -> $n is rw { $n = 42 }
12:37 codesect` joined 12:39 codesections left
PimDaniel moritz : thank your very mutch! 12:39
12:45 PimDaniel left 12:47 aborazmeh joined, aborazmeh left, aborazmeh joined 12:59 aluaces joined 13:07 k-man left 13:18 k-man joined 13:29 notagoodidea left 13:51 dakkar left, aborazmeh left 13:55 dakkar joined 13:57 domidumont left 14:03 thdrmz left 14:15 vrurg joined 14:20 thdrmz joined 14:21 aborazmeh joined, aborazmeh left, aborazmeh joined 14:27 notagoodidea joined 14:38 MasterDuke left 14:39 parabolize joined 14:58 rindolf left 15:03 wamba left 15:05 codesect` left 15:06 MasterDuke joined, codesections joined 15:13 rindolf joined
Xliff OK, how is this for weirdness? 15:14
repl.it/@Xliff/SorrowfulFlawedMicr...#main.raku 15:15
This REPL illustrates a problem that's been driving me batty.
The same piece of code is executed. One via MAIN:: the other via a class in another compunit.
The MAIN:: code runs fine. It craps out when it's in a compunit. 15:16
"Help!" he says!
15:16 cpan-raku left 15:17 cpan-raku joined, cpan-raku left, cpan-raku joined 15:20 Sgeo joined 15:30 sena_kun joined 15:32 aborazmeh left, Altai-man left 15:36 aborazmeh joined, aborazmeh left, aborazmeh joined 15:41 aborazmeh left 15:53 aborazmeh joined, aborazmeh left, aborazmeh joined 16:03 aborazmeh left 16:08 domidumont joined
Xliff Can you get the instance of an object from one of its Methods? 16:11
16:12 atroxaper joined
atroxaper Hi, #raku 16:12
moritz Xliff: no, methods are generally not bound to instances (unlike in, say, python) 16:13
atroxaper Am I right that wrap method do not change the Signature? What if I want to change it any way? Is it possible?
Xliff moritz: Ah, thanks. 16:14
moritz: OK, how about this. Can an inner-sub gain access to class attributes somehow? 16:15
m: class A { has $!a; sub b { say $!a }; method c { b } }; A.new(a => 42).c
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable $!a used where no 'self' is available
at <tmp>:1
------> 3class A { has $!a; sub b { say $!a7⏏5 }; method c { b } }; A.new(a => 42).c
16:15 thdrmz left
Xliff Yeah. Figured that. 16:15
Barring that... class defined traits. :/ 16:16
moritz well, you could put sub b inside method c
then it gets self as an outer lexical 16:17
or you could pass in `self` explicitly
m: class A { has $!a; sub b(self) { say $!a }; method c { b } }; A.new(a => 42).c
camelia 5===SORRY!5=== Error while compiling <tmp>
Invalid typename 'self' in parameter declaration.
at <tmp>:1
------> 3class A { has $!a; sub b(self7⏏5) { say $!a }; method c { b } }; A.new(a
Xliff Yeah, but I am trying to apply trait mods to methods, but the trait would need access to the object.
moritz m: class A { has $!a; sub b(\self) { say $!a }; method c { b } }; A.new(a => 42).c 16:18
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable $!a used where no 'self' is available
at <tmp>:1
------> 3lass A { has $!a; sub b(\self) { say $!a7⏏5 }; method c { b } }; A.new(a => 42).c
Xliff So... more like: class A { method b is blah { ... } };
moritz Xliff: well, then `self` is the first argument passed to that method
and you trait then needs to go through that
and possibly the MOP
Xliff So.... 16:19
If I wrap a method, I could maybe do... 16:20
$m.wrap(sub (|c) { c.list[0] # instance? })
moritz or just $m.wrap(sub (\SELF, |c) { SELF is invocant here }) 16:21
16:21 _jrjsmrtn joined
Xliff Cool! 16:21
16:23 __jrjsmrtn__ left
notagoodidea how to I test a type of a variable? 16:28
MasterDuke $foo ~~ Str 16:29
notagoodidea m: my $foo = Any; say $foo.^name =:= Any;
camelia False
notagoodidea m: my $foo = Any; say $foo.^name ~~ Any;
camelia True
notagoodidea thanks! 16:30
Xliff Perl guru help here, pls. 16:40
Why does the code in MAIN:: work, but the code from the compunit bomb? 16:41
jdv79 notagoodidea: there's a module for the fastest, or it was, json lib somewhere 17:08
its limitting factor is the c/raku marshalling iirc
17:08 asymptotically joined
jdv79 but it has some opti for certain cases to ameliorate that 17:09
notagoodidea Json::Fast is good in enough for now, crunching load and dump under
I think my filter and extract methods will take more time. 17:10
17:10 tejr joined
jdv79 ah, you found it - JSON::simd 17:10
backlogging and skipped a bit:( 17:11
notagoodidea no trouble. I don't think that I may leverage the delay args from simd so Fast is faster due to the C/raku marshalling on a big json, afaik 17:12
m:say Hash ~~ Any 17:14
evalable6 True
notagoodidea m: say Any ~~Hash; 17:16
camelia False
notagoodidea That was confusing.
17:16 b2gills left, Kaiepi left
atroxaper Xliff: I have fixed your code. But I don't know how to share it in relp.it ^^ 17:23
[Coke] can always post in gist.github.com - what was the fix?
tellable6 2021-01-11T06:12:48Z #raku <jmerelo> [Coke] thanks!
atroxaper [Coke]: Oh, sure. Thanks. 17:27
Xliff: gist.github.com/atroxaper/5b450550...f74e3af844 see my comments
17:32 guifa joined, wamba joined 17:34 MasterDuke left 17:37 dakkar left 17:38 b2gills joined, notagoodidea left 17:45 lucasb joined 17:46 Kaiepi joined
Xliff atroxaper: Thanks! What was the problem? 17:47
OK, I see. Still... isn't it LTA to have to create a sub and "use soft"? 17:49
atroxaper Xliff: actually, I don't know. They said, that wrap is mostly untested part of Rakudo... Probably, GC clears the anon sub.
Xliff OK. Thanks. Now to see if your solution works in the larger piece of code. Thanks! 17:50
atroxaper Xliff: you do not have to use 'use soft'. It was my mistake. 17:51
Xliff: You're welcome :)
Xliff One other thing... using it in a sub like this means I lose access to the Method object.
Any ideas on how to get that into the sub?
So I need access to \m in foo
Hummm.... maybe... 17:52
nextcallee?!? 17:53
I finally found a use for that! LOL!
atroxaper Xliff: Oh! Great find :) 17:55
guifa lucs: the reason for calling them distributions is that a distribution can (and often does) contain multiple modules 17:59
Xliff *sigh* -- still breaks in orignial code with "Cannot invoke object with invocation handler in this context" 18:00
18:09 natrys joined
[Coke] .seen codesections 18:35
tellable6 [Coke], I saw codesections 2021-01-10T19:50:55Z in #raku: <codesections> will do :)
18:37 dazage joined 18:39 dazage left
atroxaper Xliff: Probably this will lead to the right thoughts. Maybe you do not need an access to the method in foo. gist.github.com/gfldex/22f9133dbdb83c21c8e4 18:40
Xliff: perl6advent.wordpress.com/2015/12/...d-methods/
lucs guifa: Aha, makese sense. Thanks. 18:42
tony-o 2.
tellable6 2021-01-12T00:06:19Z #raku <melezhik> tony-o please take a look at this - github.com/tony-o/raku-fez/pull/15 , thanks
2021-01-12T00:30:15Z #raku <melezhik> tony-o I've added integration test for `fez meta`
2021-01-12T00:31:24Z #raku <melezhik> tony-o maybe I should push all the tests to fez repo? i don't know ...
2021-01-12T03:26:40Z #raku <melezhik> tony-o I put fez-test sparky configuration - github.com/melezhik/sparky-playgro...n/fez-test so far ... cc tib
tony-o .tell melezhik you're welcome to push tests. #15 is merged 18:43
tellable6 tony-o, I'll pass your message to melezhik
18:44 cpan-raku left
[Coke] did the behavior of chdir in rakudo change in the past few months? 18:46
based on behavior of a raku/doc xt/ test, it looks like it might have previously been lexically scoped? 18:47
Geth doc: coke self-assigned xt/check-signatures.t skips all tests github.com/Raku/doc/issues/3765
7e96ae04e5 | Coke++ | xt/check-signatures.t

Without this fix, recent rakudos were looking in the RAKUDO_SRC dir (post chdir)
Fixes #3765
linkable6 DOC#3765 [closed]: github.com/Raku/doc/issues/3765 [docs] xt/check-signatures.t skips all tests
18:51 jmerelo left
atroxaper Am I right that wrap method do not change the Signature? What if I want to change it any way? Is it possible? 18:52
[Coke] codesections: fixed #3765; now left with a single failure running the signature test. 18:55
18:56 domidumont left, natrys left 18:57 notagoodidea joined
guifa atroxaper: yes and no. wrap can wrap with any new signature, but it’s possible the compiler will be overly strict at compile time and think it impossible 18:59
So if the original sub has both slurpies on it, you can do anything you want. If the original only takes a single positional, you’ll probably be unfortunately stuck with the single positional (but named arguments should genreally work) 19:00
atroxaper guifa: It fails in runtime, actually.
guifa odd, when I get issuse with it, it’s always compile time
Geth ¦ doc: coke assigned to codesections Issue check-signature test cannot find some method definitions. github.com/Raku/doc/issues/3780 19:01
guifa m: sub foo($a) { say $a }; &foo.wrap: -> $a, $b { samewith $a }; foo 1, 2;
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling foo(Int, Int) will never work with declared signature ($a)
at <tmp>:1
------> 3; &foo.wrap: -> $a, $b { samewith $a }; 7⏏5foo 1, 2;
19:02 sortiz joined
atroxaper guifa: Oh... Apparently, I was wrong. 19:02
guifa: I just thinking for fun... Could I implement something similar as Python's decorators. They take a sub and return a 'wrapped' sub to original name. 19:07
19:07 cpan-raku joined, cpan-raku left, cpan-raku joined 19:10 natrys joined
guifa I’m not familiar enough with Python to know the difference between that and wrapping. Wrapping has global effect, so you could write a sub that takes another one as an argument, and in turn wraps it. 19:15
m: sub foo { say "hi" }; sub wrap-me(&f) { &f.wrap: sub { callsame; say "bye" } }; foo; say "---"; wrap-me &foo; foo;
camelia hi
guifa If you want to return a sub while preserving the original, you don’t need to use wrap, just return a code block of some sort: 19:18
sub foo { say "hi" }; sub wrap-me(&f) { sub {f; say "bye"} }; foo; say "---"; my &bar = wrap-me &foo; bar
evalable6 hi
atroxaper guifa: Yes, I know that. Thank you for examples :) 19:20
notagoodidea is it a sane way to loop around elements of hash containing arrays containg hashes etc for which I don't know the depth? 19:22
it's coming from a JSON. The keys of the hash are the same at differents depth.
19:30 Altai-man joined
Geth ecosystem: 4de08385a4 | (David Warring)++ | META.list
move remaining modules from the pdf-raku project to CPAN
19:32 sena_kun left
guifa notagoodidea: sure, depending on the exact structure you can go about it different ways 19:34
my @a = 1, 2, [1,2,3]; for @a -> $b { .say for $b<> } 19:35
evalable6 1
notagoodidea the structure could be now at runtime by testing a bit. 19:36
The two elements that I know : I need to follow the key `inner` to go deeper in the structure, and at the last level of depth I will find a key `name`. 19:38
Each time the `inner` key contains an array that contains the next hash. 19:39
mm I could use loop or until ..
19:39 BenGoldberg left, Ben_Goldberg joined, Ben_Goldberg is now known as BenGoldberg 19:43 atroxaper left 19:48 ufobat left, b2gills1 joined, b2gills left 19:53 PimDaniel joined
PimDaniel hi, this is me again. 19:54
I'm reading docs.raku.org/language/packages and docs.raku.org/language/modules and docs.raku.org/language/modules-packages. 19:56
19:57 wamba left
PimDaniel and i do not understand the relationship between package and modules. Probably the language does not bind my brain! 19:57
I mean "English language". 19:58
guifa A package is just a way to collect variables/subroutines/etc. Classes are also packages, for instance.
19:59 tejr left
PimDaniel @guifa thank you! So what is a module? 20:00
guifa A module is type of package specially designed for importing symbols (variables, subroutines, settings, etc) into code 20:01
PimDaniel @guifa : Merci! Physically, suppose i want to write a Module... is it the same than in perl5? 20:04
What is the file extension i should use?
I do not see this in the documentation. 20:05
hooo : Chapter "Modules on disk" : Sorry! :(
20:09 tejr joined
guifa is afk for a bit 20:09
20:10 Black_Ribbon joined
PimDaniel Does unit means namespace? 20:11
No No : sorry! 20:13
@guifa : Ok : i see clearly now: thank you very mutch! 20:21
20:26 JRaspass left, JRaspass joined, PimDaniel left 20:27 JRaspass left, JRaspass joined 20:32 sjm_uk left
[Coke] "unit" is how you declare the thing. so "unit module blah;" is the first line of a file, the entire file is the module blah. otherwise you need to use {} for scoping with the module/class/whatever. 20:42
file extensions: .raku for programs, .rakumod for modules 20:43
Hope this helps.
that feeling of ... not-quite-dread about an upcoming meeting... that is suddenly pushed out a day. ahhhh. 20:44
20:48 natrys left, mowcat joined 21:01 Ben_Goldberg joined, BenGoldberg left, Ben_Goldberg is now known as BenGoldberg 21:02 rindolf left, Ben_Goldberg joined, BenGoldberg left, Ben_Goldberg is now known as BenGoldberg 21:07 Ben_Goldberg joined, BenGoldberg left, Ben_Goldberg is now known as BenGoldberg 21:20 BenGoldberg left, Ben_Goldberg joined, Ben_Goldberg is now known as BenGoldberg 21:33 BenGoldberg left, Ben_Goldberg joined, Ben_Goldberg is now known as BenGoldberg
no-n does unit just mean the rest of this file belongs to this package? 21:35
timotimo less "the rest", more "the entirity" IMO 21:36
no-n ahh
21:40 Altai-man left 21:42 MasterDuke joined, sena_kun joined
[Coke] m: say "hi"; unit package bar; 21:43
camelia hi
[Coke] ... I'm surprised that doesnt' error. :)
21:44 PimDaniel joined, PimDaniel left 21:48 sena_kun left 21:50 benjif joined 21:53 BenGoldberg left, Ben_Goldberg joined 21:54 Ben_Goldberg is now known as BenGoldberg
jdv79 BenGoldberg: everything alright? 21:55
21:58 BenGoldberg left, Ben_Goldberg joined 21:59 Ben_Goldberg is now known as BenGoldberg 22:00 stoned75 left
timotimo stuff that doesn't define anything should in general be fine i'd imagine 22:02
22:07 simcop2387 joined
guifa [Coke]: you need to put stuff above the unit declaration in case you have to, e.g. parameterize a class or pass something into a trait, so it makes sense to allow code above the declaration 22:15
22:16 BenGoldberg left, Ben_Goldberg joined 22:17 Ben_Goldberg is now known as BenGoldberg
[Coke] guifa++ 22:21
22:24 notagoodidea left
[Coke] m: say Mixy.^methods 22:25
camelia (of new-from-pairs)
[Coke] docs say that Mixy provides total & roll, but it doesn't.
22:26 BenGoldberg left, Ben_Goldberg joined, Ben_Goldberg is now known as BenGoldberg
[Coke] (doesn't provide *total*) 22:26
guifa [Coke]: it definitely does though: github.com/rakudo/rakudo/blob/mast...c/Mixy.pm6
at least, roll is there 22:27
[Coke] wasn't clear: docs say both, but total isn't there. 22:29
total appears to be in Mix, not Mixy. 22:30
22:32 brtastic left
[Coke] (wow, that method was docced back when the doc files were in lib/) 22:33
Geth doc: 7bac622b20 | Coke++ | 2 files
Move total method to Mix from Mixy

xt/check-signatures.t found this, presented as a SKIP'd test.
Investigation showed the method was defined in the wrong spot, and when moved, that the signature needed a slight update.
22:40 benjif left 22:41 aluaces left 22:54 melezhik joined
kawaii Is there any module or operator I can use to compare strings and return which ones 'kinda' match? Like how spellcheck presumably works in word processing applications? 22:58
guifa kawaii: there are a few different algorithms for calculating the difference between strings 23:00
moon-child kawaii: try one of these maybe modules.raku.org/search/?q=levenshtein
guifa There are a few different modules for that
I’d then make an operator for it
kawaii Ah, nice, thanks very much guys :)
guifa sub infix:<kinda-eq> ($a, $b, :$similarity-factor) { my $distance = distance-function-of-your-choice $a, $b; {formula to convert distance to similarity} > $similarity-factor } 23:02
If you need it in a regex … 23:03
23:13 bdju left 23:14 bdju joined
MasterDuke github.com/MasterDuke17/Text-Diff-Sift4 another alternative. i haven't benchmarked it against the levenshtein modules recently, but it used to be quite a bit faster, although not giving identical results 23:15
23:15 bdju left
kawaii MasterDuke: thank you! I will evaluate its fitness for my project also :) 23:16
23:19 bdju joined
JRaspass if you write your own, feel free to compete on code.golf/levenshtein-distance#raku ;-) 23:23
kawaii MasterDuke; am I perhaps going about this the wrong way? I'm basically writing a bot where a user will enter a command like `!team <name>` and it will return some info on that member, but of course users shouldn't be expected to know the exact string and capitalisation required so I wanted to do something like this to try and help them out. www.irccloud.com/pastebin/F2l2F7lw/ 23:33
But it seems as though some of my keys are too similar to make an informed decision based on the results. 23:34
Perhaps there is a better way?
guifa hmm, let’s see how it would work with Joccard Index 23:37
23:38 melezhik left
guifa kawaii: try this one: bit.ly/39rUJuP 23:42
It’s not as fast, but it sounds like speed isn’t your concern here — when I ignore case, the two Toms are tied for top place. 23:43