🦋 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: ... | Logs can be inspected at colabti.org/irclogger/irclogger_log/raku
Set by lizmat on 1 May 2021.
[Coke] ugexe: that still gives a broken pipe exception 00:00
(but then it's not "unhandled")
00:01 Shaeto left 00:02 reportable6 left 00:03 reportable6 joined, neshpion left 00:06 neshpion joined, dogbert17 joined 00:07 brtastic left, dogbert11 left 00:14 Shaeto joined 00:16 Kaiepi left 00:17 Kaiepi joined 00:18 Kaiepi left, Kaiepi joined 00:19 Shaeto left 00:23 Shaeto joined 00:27 Shaeto left 00:32 Shaeto joined 00:37 Shaeto left 00:41 Shaeto joined 00:46 Shaeto left 00:51 Shaeto joined, pecastro left 00:55 Shaeto left 01:00 Shaeto joined 01:04 Shaeto left 01:06 vrurg joined 01:09 Shaeto joined, aindilis joined 01:11 vrurg left, vrurg joined 01:13 Shaeto left 01:19 vrurg left 01:21 parv joined 01:27 Shaeto joined 01:31 Shaeto left 01:36 Shaeto joined, [Sno] joined 01:39 sno left 01:41 kvw_5 joined, Shaeto left 01:44 kvw_5_ left 01:45 Shaeto joined 01:50 Shaeto left 01:54 Shaeto joined 01:59 Shaeto left 02:03 Shaeto joined 02:04 Manifest0 left 02:06 Manifest0 joined 02:08 Shaeto left 02:13 Shaeto joined 02:17 Shaeto left
Xliff Huh. Why doesn't this regex work? 02:18
replit.com/@Xliff/DimTrustworthyCo...#main.raku
tusooa Xliff: Not found error: This is not the page you're looking for. 02:21
If you think this is a mistake please contact us_
Xliff Hrm,,,
02:22 Shaeto joined 02:26 Shaeto left
Xliff tusooa: Try this - replit.com/join/dyyhuasi-xliff 02:27
02:31 Shaeto joined 02:35 Shaeto left 02:36 parv left 02:40 Shaeto joined 02:42 squashable6 left 02:44 Shaeto left, squashable6 joined 02:49 Shaeto joined 02:52 aindilis` joined 02:53 aindilis left 02:54 Shaeto left 02:55 rindolf joined 02:58 aindilis` left, Shaeto joined 03:03 Shaeto left 03:07 Shaeto joined 03:12 Shaeto left
tusooa Xliff: it asked me to login 03:13
Xliff tusooa: OK, nevermind then. Thanks! 03:16
03:16 Shaeto joined
raydiak [Coke]: 'use NativeCall; sub signal(int32 $, int64 $) is native {}; signal(SIGPIPE, 0);' works on 64-bit linux. see github.com/rakudo/rakudo/issues/3004 and github.com/rakudo/rakudo/issues/4214 03:18
03:21 Shaeto left 03:26 Shaeto joined 03:30 Shaeto left 03:35 Shaeto joined
moon-child 0 is SIG_IGN? 03:39
03:39 Shaeto left 03:53 Shaeto joined 03:58 Shaeto left 04:02 Shaeto joined 04:04 parv joined 04:06 Shaeto left 04:11 Shaeto joined 04:15 Shaeto left 04:20 Shaeto joined 04:27 Shaeto left 04:32 Shaeto joined 04:44 Shaeto left 04:49 Shaeto joined 04:53 Shaeto left 04:54 parabolize left 04:57 neshpion left 04:58 Shaeto joined 05:03 Shaeto left 05:16 Shaeto joined 05:21 Shaeto left 05:23 Geth left
kybr c++ has reinterpret_cast for saying "no. i really know this is type X" class Animal {...}; class Dog is Animal {...}; my $animal = Dog.new; # can i ask $animal if is really a dog? 05:24
err.. my Animal $animal = Dog.new ;
Xliff kybr: say $animal ~~ Dog; 05:25
m: class Animal { }; class Dog is Animal { }; my $animal = Dog.new; say $animal ~~ Dog; say $animal ~~ Animal; 05:26
camelia True
True
Xliff m: class Animal { }; class Dog is Animal { }; my $doc = Dog.new; my Animal $animal = $dog; say $animal ~~ Dog; say $animal ~~ Animal; 05:27
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$dog' is not declared. Did you mean any of these: '$doc',
'Dog'?
at <tmp>:1
------> 3 my $doc = Dog.new; my Animal $animal = 7⏏5$dog; say $animal ~~ Dog; say $animal ~~
Xliff m: class Animal { }; class Dog is Animal { }; my $dog = Dog.new; my Animal $animal = $dog; say $animal ~~ Dog; say $animal ~~ Animal;
camelia True
True
Xliff So even typed as Animal, $animal still knows its a Dog
kybr i see that, but i really want to write a method of Animal that uses introspection to give me a string that is the real (most specific) type of self. 05:28
Xliff m: class Animal { }; class Dog is Animal { }; my $dog = Dog.new; my Animal $animal = $dog; say $animal.^name
camelia Dog
Xliff There you go.
Unless I am missing something. If so, please let me know. 05:29
kybr maybe i'm missing something :) i think i need to collect my thoughts. thank you.
Xliff yw!
m: class Animal { }; class Dog is Animal { method bark { say 'Woof!' }; my $dog = Dog.new; my Animal $animal = $dog; say $animal.^name; $animal.bark 05:32
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3 = $dog; say $animal.^name; $animal.bark7⏏5<EOL>
expecting any of:
statement end
statement modifier
statement modifier loo…
Xliff m: class Animal { }; class Dog is Animal { method bark { say 'Woof!' }; }; my $dog = Dog.new; my Animal $animal = $dog; say $animal.^name; $animal.bark
camelia Dog
Woof!
Xliff And on that note, I'm confused. If it's typed Animal, it should not know how to .bark() -- right? 05:33
moon-child m: class Animal {}; class Dog is Animal {}; class Cat is Animal {}; my Animal $a = Dog.new; my Dog $d = $a; my Cat $c = $a
camelia Type check failed in assignment to $c; expected Cat but got Dog (Dog.new)
in block <unit> at <tmp> line 1
moon-child Xliff: no, typing is gradual 05:34
Xliff moon-child: And that means?
moon-child $x ~~ Animal means $x can do _at least_ anything an Animal can, not at most
Xliff Ah. OK. That's what I suspected. Thanks!
05:34 Shaeto joined
kybr ha. how about this.. from an animal method, may i call a method on my dog-self? 05:35
Xliff moon-child: So all "my Animal $a" means is that $a ~~ Animal MUST be true. Right?
kybr sort of the opposite dirrection of callsame
Xliff kybr: I'm confused by the question. Isn't that what I just demonstrated with .bark() ? 05:36
moon-child m: class Animal { method do-stuff { self.bark } }; class Dog is Animal { method bark { say 'woo' } }; my $d = Dog.new; $d.do-stuff
camelia woo
moon-child Xliff: to my understanding yes
Xliff class Animal { method do-stuff { self.bark } }; class Dog is Animal { method bark { say 'woo' } }; my $d = Dog.new; $d.do-stuff; my $emo = Animal.new; $emo.do-stuff 05:37
moon-child Xliff: well, $a ~~ Animal means Animal.ACCEPTS($a). So you could make your own ACCEPTS
Xliff m: class Animal { method do-stuff { self.bark } }; class Dog is Animal { method bark { say 'woo' } }; my $d = Dog.new; $d.do-stuff; my $emo = Animal.new; $emo.do-stuff
camelia woo
No such method 'bark' for invocant of type 'Animal'. Did you mean any
of these: 'Bag', 'WALK'?
in method do-stuff at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff moon-child: I know that. I am asking about type checking.
Not .ACCEPTS.
moon-child afaik yes
Xliff So, as demonstrated, "my Animal $a" can do Dog's methods. 05:38
This is kinda counter-intuitive to most OOP implementations.
kybr Xliff: yes.
05:39 Shaeto left
Xliff And with that, I must suspend all processes for a few hours. :) 05:39
Xliff &
moon-child night 05:40
kybr m class Parent { method show { self.defaults.signature}} ; class Child is Parent { method defaults($a, $b = 2, :$c = 3) {}};Child.show().say; 05:42
m: class Parent { method show { self.defaults.signature}} ; class Child is Parent { method defaults($a, $b = 2, :$c = 3) {}};Child.show().say;
camelia Too few positionals passed; expected 2 or 3 arguments but got 1
in method defaults at <tmp> line 1
in method show at <tmp> line 1
in block <unit> at <tmp> line 1
kybr it's not really that i want to call a method on the dog as inspect it's signature. 05:43
05:44 Shaeto joined 05:46 Sgeo left 05:48 Shaeto left
kybr i want to refer to a method (defaults) without calling it 05:49
05:53 Shaeto joined 05:57 Shaeto left
raydiak m: class Parent { method show { self.WHAT.^methods.first(*.name eq "defaults").signature } }; class Child is Parent { method defaults ($a, $b = 2, :$c = 3) {} }; Child.show.say; 06:01
camelia (Child: $a, $b = 2, :$c = 3, *%_)
06:02 Shaeto joined, reportable6 left 06:03 reportable6 joined
raydiak I'm not sure what you're hoping to accomplish, and I'm actually afk for now, but it kinda sounds like you might want to re-think your class heirarchy or whatever architectural choices led to this need 06:06
06:06 Shaeto left 06:11 Shaeto joined 06:15 Shaeto left 06:16 vrurg joined 06:19 Sgeo joined 06:20 Shaeto joined, vrurg left 06:24 Shaeto left
kybr raydiak: yes! that's what i wanted. and Yes! your are almost certainly correct that i need to rethink how i'm designing things. 06:28
06:29 Shaeto joined 06:33 Shaeto left 06:38 Shaeto joined 06:43 Shaeto left 06:47 Shaeto joined 06:52 Shaeto left 06:57 Shaeto joined 07:01 Shaeto left 07:06 Shaeto joined 07:10 Shaeto left 07:11 frost-lab joined 07:15 Shaeto joined, ufobat_ joined 07:20 Shaeto left 07:30 domidumont joined 07:33 Shaeto joined 07:38 Shaeto left 07:40 ufobat_ left
raydiak kybr: glad I could help :) 07:42
07:46 wamba joined 07:50 domidumont left 07:51 Shaeto joined 07:56 Shaeto left 08:00 Shaeto joined 08:05 Shaeto left 08:09 Shaeto joined 08:14 Shaeto left 08:15 Shaeto joined 08:38 pecastro joined 08:39 xelxebar left, xelxebar joined 09:04 Sgeo left 09:18 Shaeto left 09:19 Shaeto joined 09:24 Shaeto left 09:25 linkable6 left, linkable6 joined 09:29 Shaeto joined 09:33 Shaeto left 09:36 DiffieHellman left 09:37 DiffieHellman joined, Geth joined 09:38 Shaeto joined 09:42 Shaeto left 09:47 Shaeto joined 09:51 Shaeto left 09:56 Shaeto joined 10:01 Shaeto left 10:05 Shaeto joined 10:10 Shaeto left 10:14 Shaeto joined 10:19 Shaeto left 10:22 parv left 10:32 Shaeto joined
codesections that's a fun error msg: 10:37
m: my Int $a; $a.VAR.abs
camelia No such method 'abs' for invocant of type 'Int'. Did you mean 'abs'?
in block <unit> at <tmp> line 1
10:37 Shaeto left 10:42 Shaeto joined 10:46 Shaeto left 10:47 vrurg joined 10:51 Shaeto joined 10:52 vrurg left 10:55 Shaeto left 11:00 Shaeto joined 11:05 Shaeto left 11:09 Shaeto joined 11:13 Shaeto left 11:14 dataange` joined 11:15 dataangel left 11:18 Shaeto joined 11:23 Shaeto left 11:27 Shaeto joined 11:32 Shaeto left 11:36 Shaeto joined 11:41 Shaeto left 11:45 Shaeto joined 11:47 [Sno] left 11:50 Shaeto left 11:55 Shaeto joined 11:59 Shaeto left 12:02 reportable6 left, reportable6 joined 12:04 Shaeto joined 12:08 Shaeto left 12:09 mowcat joined
tbrowder g'day, i have a question about unicode and first word char match. the result i want is to separate a set of words into 4 sets based on their first character. but there seem to be several <:charprop> codes that are similar. 12:18
the 4 sets should be lower-case <:Lc>, upper-case <:Uc>, number <:Nu>, and punctuation <:P> 12:21
sorry, too early 12:22
12:22 Shaeto joined
tbrowder again: <:LI>, <:Lu>, <:N>, and <:P>. will those sets be mutually exclusive but complete? 12:24
given a match on the first char of a word? 12:25
12:26 Shaeto left 12:31 Shaeto joined
tbrowder kyber: and look into roles, too 12:31
roles solved some subclass problems for me 12:32
kybr: ^^^
12:36 vrurg joined, Shaeto left 12:40 vrurg left 12:49 Shaeto joined 12:53 Shaeto left 12:58 Shaeto joined 12:59 domidumont joined 13:01 thundergnat joined 13:03 Shaeto left
thundergnat tbrowder: Depending on your word list, that should be fairly complete. A few words with initial characters that _won't_ fall into one of those categories: $100, +47, Džungla 13:06
13:08 Shaeto joined 13:12 rindolf left, Shaeto left 13:14 rindolf joined 13:16 codesect` joined 13:17 Shaeto joined 13:19 codesections left 13:21 Shaeto left 13:23 parabolize joined 13:26 Shaeto joined 13:29 domidumont left 13:31 Shaeto left 13:35 Shaeto joined 13:37 domidumont joined 13:39 Shaeto left 13:44 Shaeto joined 13:48 Shaeto left 13:53 Shaeto joined 13:58 Shaeto left 14:02 Shaeto joined 14:05 sftp left 14:07 Shaeto left 14:11 Shaeto joined 14:13 frost-lab left 14:15 rindolf left 14:16 Shaeto left, sftp joined 14:19 brtastic joined 14:20 Shaeto joined 14:25 Shaeto left 14:30 Shaeto joined 14:34 Shaeto left 14:39 Shaeto joined 14:43 Shaeto left 14:48 Shaeto joined 14:52 Shaeto left 14:56 cog joined 14:58 [Sno] joined 15:02 [Sno] left 15:06 Shaeto joined 15:11 Shaeto left 15:15 Shaeto joined 15:16 mowcat left 15:20 Shaeto left 15:24 Shaeto joined
tbrowder thundergnat: i see $ won't, but why Dzugla? 15:25
15:25 codesect` left
tbrowder is it that Dz is a combined/composed thing? 15:26
btw, i am working on my Abbreviations module to fix what i see is a problem with your auto-abbreviations 15:27
15:28 Shaeto left
tbrowder it didn't make sense to me that the list 'A ab Abcde' came out wth 3 until i realized that i could break the analysis into subgroups by leading char type 15:30
no, the problem is not yours, the problem is my using it
um, let me check the above statement again... 15:32
15:33 Shaeto joined 15:38 Shaeto left
tbrowder word set 'A ab Abcde' shows 2 but i wondered why the ab couldn't be 'a ab' as abbrevs. that's when i decided to start breaking word sets into subgroups when it is appropriate. based on your comments i may add a couple more subgroups and then have a catchall group. 15:38
thank!
15:43 Shaeto joined 15:47 Shaeto left 15:52 Shaeto joined 15:57 Shaeto left 16:00 Ulti_ is now known as Ulti 16:01 Shaeto joined 16:05 Shaeto left
tbrowder thundergnat: i'll add <:S> for symbol and put all else into a catch-all group (unless you can tell me how to catch 'Dz' 16:06
16:10 Shaeto joined 16:13 Kaiepi left, Kaiepi joined 16:14 Shaeto left 16:19 Shaeto joined 16:24 Shaeto left 16:28 Shaeto joined 16:33 Shaeto left 16:37 Shaeto joined 16:38 codesections joined
codesections is there a good way to wrap a fn for its next call, but then unwrap it after? e.g, a .wrap-once equivalent? 16:39
16:42 Shaeto left 16:47 Shaeto joined 16:51 Shaeto left 16:52 vrurg joined 16:54 vrurg left 17:05 Shaeto joined 17:10 Shaeto left 17:13 lucasb joined 17:14 Shaeto joined 17:18 Shaeto left 17:23 Shaeto joined 17:24 Sgeo joined 17:28 Shaeto left, neshpion joined 17:30 Xliff left, patrickb joined 17:32 Shaeto joined, vrurg joined
thundergnat tbrowder: Sorry, got an emergency call in to work right after my last comment. Copy pasto, that third one should have been Džungla (Dž ligature) with a :Lt property (title case). 17:33
They are obscure but exist. 17:34
m: say .key, '=>', .value.head(5) for (^1000).map(*.chr).classify( { .substr(0,1).uniprop } ) 17:35
camelia Zs=>(  )
Sk=>(^ ` ¨ ¯ ´)
Cf=>(­)
Lt=>(Dž Lj Nj Dz)
Sm=>(+ < = > |)
Cc=>(␀ )
Mn=>(̀ ́ ̂ ̃ ̄)
No=>(² ³ ¹ ¼ ½)
Pe=>() ] })
Sc=>($ ¢ £ ¤ ¥)
Lu=>(A B C D E)
Lm=>(ʰ ʱ ʲ ʳ ʴ)
Pd=>(-)
Lo=>(ª º ƻ …
tbrowder so probably i should add that group anyway, just for **fun** :-D
17:36 Shaeto left, neshpion left
tbrowder or add them to the <:Lu> group 17:36
17:37 neshpion joined
tbrowder i assume this regex should work /^ <:Lu>|<:Lt>/ for that 17:39
17:41 Shaeto joined 17:43 [Sno] joined
tbrowder hm, maybe that's overkill. just upper/lower case and all else in another group 17:45
once i have the subgrouping, if a user requests i can easily add other groups. 17:46
17:46 Shaeto left
tbrowder thanks so much 17:46
17:50 Shaeto joined 17:53 domidumont left 17:55 Shaeto left 17:59 Shaeto joined 18:02 reportable6 left 18:03 reportable6 joined 18:04 Shaeto left 18:08 Shaeto joined 18:10 brtastic left 18:13 Shaeto left 18:18 Shaeto joined 18:23 Shaeto left 18:24 vrurg left 18:27 Shaeto joined 18:31 Shaeto left 18:35 rindolf joined, maggotbrain left 18:36 maggotbrain joined, Shaeto joined 18:41 Shaeto left 18:45 Shaeto joined 18:49 Shaeto left 18:54 oddp joined, Shaeto joined 18:56 Kaiepi left 18:57 Kaiepi joined 18:59 Shaeto left
oddp i have a pipeline like so: .comb.map(...).produce(* + *).unique; now, what's an elegant way to insert 0 into that seq before .unique since .produce doesn't allow a custom starting value? 18:59
tellable6 2021-05-07T06:43:02Z #raku <gfldex> oddp this migth do what you want: gfldex.wordpress.com/2021/01/03/in...direction/
19:03 Shaeto joined
oddp Might not be able to keep that one-liner with seq and instead have to collect into an array and then push 0 onto it, right? 19:04
lizmat perhaps some form of ... ?
oddp huh? i'm converting a small dlang script that allows setting a custom seed value for cumulativeFold/produce 19:06
19:08 Shaeto left 19:10 MasterDuke joined
ugexe .map({ $++ ?? $_ !! (0,$_).Slip }) 19:12
lizmat perhaps Seq should have an .inject method :-) 19:15
oddp interesting, thanks, will try to integrate that somehow. map has a bunch of these atm: when '>' { -1i }; when '<' { i }; ... 19:16
ugexe .map({ my $val = do given $_ { when Str { 1 }; when Int { 2 }; }; $++ ?? $val !! (0,$val).Slip }) 19:18
19:21 Shaeto joined
oddp thanks for that, appreciated! 19:23
19:26 Shaeto left 19:29 aindilis joined 19:30 ecocode[m]1 joined 19:31 Shaeto joined 19:32 ecocode[m] left
oddp what do you say, is this also acceptable? or not recommended because it allocates too much? my $foo = ...produce(* + *); say unique(|0, |$foo).elems; 19:32
ugexe only if $foo will be less than 65535 values 19:35
19:35 Shaeto left
ugexe m: my $foo = 0..65535; say unique(|0, |$foo).elems 19:36
camelia Too many arguments (65537) in flattening array, only 65535 allowed.
in block <unit> at <tmp> line 1
ugexe m: my $foo = 0..65535; say unique(|0, $foo.Slip).elems
camelia 65536
oddp damn, good to know, thanks! 19:37
MasterDuke m: my $foo = 0..65535; say (|0, |$foo).unique.elems # method form is fine 19:39
camelia 65536
19:39 rindolf left
oddp sweet, prolly sticking to that for now then. thank you! 19:44
19:49 Shaeto joined 19:53 Shaeto left 19:58 Shaeto joined 20:11 parabolize left
kybr i can't remmeber where, but i think i've seen an impressive, succinct list of Raku language features and boasts. maybe in a presentation? was it shaped like a christmas tree? 20:16
20:18 MasterDuke left 20:26 Shaeto left 20:29 patrickb left, parv joined 20:37 parabolize joined 20:40 Sgeo_ joined 20:41 Sgeo left 20:42 ecocode_ left 20:44 ecocode joined 20:45 neshpion left 20:48 neshpion joined 20:49 aborazmeh joined 20:57 ecocode left 21:01 mowcat joined 21:02 wamba left 21:03 Anton joined
Anton I am trying out the package Math::Matrix ( github.com/pierre-vigier/Perl6-Math-Matrix ). I wonder should use Math::Matrix or Math::Libgsl::LinearAlgebra. Has anyone used Math::Matrix for "serious" matrix computation workflows? 21:07
21:27 wingfold_ joined 21:28 ecocode joined, aborazmeh left 21:30 wingfold left, wingfold_ left 21:31 wingfold joined 21:39 Anton left 21:49 brtastic joined 21:52 parv left 21:55 rindolf joined
tbrowder .tell kybr checkout my 2021 advent post about santa claus and raku: a christmas tree forming a raku script 22:02
tellable6 tbrowder, I'll pass your message to kybr
tbrowder uh, 2020, that is 22:03
kybr i found it in a talk Larry Wall gave and i found a good list of feature in the FAQ, but i'd love to see others. 22:04
22:08 dogbert11 joined 22:11 dogbert17 left, ecocode left 22:16 ecocode joined, dogbert17 joined 22:18 dogbert11 left 22:29 dogbert11 joined 22:32 dogbert17 left 22:45 mowcat left 22:49 rindolf left 22:58 ecocode left
oddp m: multi sub foo($x) { 'no' }; multi sub foo($x where *.Int) { 'ok' }; say foo $_ for <a 1 0>; 22:59
camelia no
ok
no
oddp is the last case really expected behaviour?
23:00 ecocode joined 23:09 pecastro left
oddp hm, foo($x where /\d+/) seems to work, good enough i guess 23:12
23:19 b2gills joined
ugexe m: say ① ~~ /\d+/; # a friendly reminder that \d+ is not a very good integer validator 23:31
camelia 「1」
moon-child eh what's wrong with that 23:33
m: my Int $x = ①
camelia ( no output )
ugexe its cute but not really what most people expect when validating things 23:34
oddp well, '0' not getting caught by the above multi sub is even more unexpected 23:35
ugexe where False 23:36
where 0
oddp still
ugexe *.Int returns an Int, what do you think it does?
i.e. its not checking if * is an Int 23:37
m: multi sub foo($x) { "no" }; multi sub foo(Int $x) { "ok" }; say foo $_ for <a 1 0>; 23:39
camelia no
ok
ok
23:47 brtastic left
oddp alright, thanks for that. now i just have to figure out, why that's not working for my actual script 23:49
23:55 dogbert17 joined
oddp seems like the above isn't working when recursive calls are involved 23:59
23:59 dogbert11 left