🦋 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.
timotimo so, how do we take a heap snapshot at the time a "too many open files" error occurs and grab the paths to all objects that hold on to a file descriptor? 01:58
additionally / alternatively: grab a stack trace every time a file is opened and hang it off the object that holds on to the fd 01:59
another alternative, just dump stack traces whenever a file descriptor gets created period. figure it out post-mortem from printf to stderr from during the run 02:00
jmerelo releasable6:status 05:58
releasable6 jmerelo, Next release will happen when it's ready. 3 blockers. 0 out of 178 commits logged (⚠ 1 warnings)
jmerelo, Details: gist.github.com/6b1774952ef803bd6c...dbda24a340
rouking I need to build a tree structure where each layer alternates between one of four types. These types do share a common role, but the issue is I need to instantiate children inside the parent, which means using the actual class and not just the role, creating a circular dependency 16:37
I'm wondering if there's a better way to resolve this problem than moving everything into one file and creating stubs 16:38
kybr what's a better way to do this? gather for ((1,2,3) X* (4,5,6)) -> $a, $b, $c { take ($a, $b, $c) } 17:29
guifa rouking: hmm, so one thing I’ve done in the past is to have the children “register” themselves in some way with the parent 17:33
tio.run/##ZY7BboMwEETv/oqRqtxajj2A...V/W7ps4/gL
m: say ((1,2,3) X* (4,5,6)).batch(3) 17:35
camelia ((4 5 6) (8 10 12) (12 15 18))
guifa kybr: ^^
kybr .batch ! thank you.
guifa or rotor, too 17:36
batch $x == rotor $x, :partial
kybr is there a more linear algebra way? just curious. this is fine.
guifa you mean by using the named variables? The only other thing I can think of off the top of my head would be 17:40
m: say gather for ((1,2,3) X* (4,5,6)) { take ($^a, $^b, $^c) };
camelia ((4 5 6) (8 10 12) (12 15 18))
kybr ahh, ok 17:41
guifa but if I misunderstood I can try to think of something else, I’m not a huge math geek but I can hack some decent stuff together in Raku ^_^ 17:43
kybr i was trying my hand at making a little tool for analyzing number series as they describe here: getpocket.com/explore/item/how-a-s...ket-newtab 17:47
my @arithmetic = 2, 2 + (3 * 1), 2 + (3 * 2) ... *;
my @geometric = 2 * 3**0, 2 * 3**1, 2 * 3**2 ... *;
(@arithmetic[^6] X+ @arithmetic[^6]).Set.elems; 17:48
(@arithmetic[^6] X* @arithmetic[^6]).Set.elems;
turns out i don't need to un-flatten the list coming out of the X. 17:49
tadzik m: sub if ( \if ) { say if; }; my \if = 42; if( if) if if # twitter.com/b2gills/status/1383841825954287622 18:06
camelia 42
tadzik kek
m: sub if ( \if ) { say if; }; my \if = 42; if(if) if if # hmm 18:07
camelia 42
tadzik m: sub if ( \if ) { say if; }; my \if = 42; if if if if # hmm!
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3if ) { say if; }; my \if = 42; if if if 7⏏5if # hmm!
tadzik aww :(
b2gills It breaks if you add any spaces where there isn't any
m: sub if ( \if ) { say if; }; my \if = 42; if( if ) if if
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3y if; }; my \if = 42; if( if 7⏏5) if if
tadzik right
b2gills m: sub if ( \if ) { say if ; }; my \if = 42; if( if) if if
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of bare "say". In Raku please use: .say if you meant
to call it as a method on $_, or use an explicit invocant or argument,
or use &say to refer to the function as a noun.
at <tmp…
tadzik still, fun :)
samcv Hi everyone. Just wanted to announce that the PaperCall for the 2021 Perl and Raku Conference is open. So far we only have 1 Raku talk, and we would really love if we got more submissions from the Raku community. Thanks www.papercall.io/tprcic21 20:35
kybr link to an example of defining my own hyperoperator?
codesect` If I have some non-Seq Iterable and call .grep/.map/etc, is there any way to turn it back into whatever type it was before? 20:36
e.g., if I know it was an Array, I can call .Array
(same if I knew it was a List, I could call .List). But what if I don't know? Is there a "collect this back to what it was" method I'm missing somehow? Or, alternately, is there a way to grep/map over a List/Array without losing their current type? 20:41
ugexe m: my List $a := (1,2,3,4); my Array $b := [5,6,7,8]; say $a.grep(*.so)."{$a.^name}"().WHAT; say $b.grep(*.so)."{$b.^name}"().WHAT; # probably the best you can do
japhb codesect`: .= grep?
camelia (List)
(Array)
codesect` ugexe: that's what I currently have, but it felt a little gross so I thought I'd ask. (well, actually, what I cave is even worse, because I had "$a.WHAT.raku()"() - at least your suggestion avoids the second call) 20:44
ugexe for it to just turn back into the original type would imply everything that can be iterated over knows how to create a collection of itself 20:45
codesect` japhb: that's a good idea in general. In the particular instance I'm dealing with, I don't want to assign to the variable 20:46
ugexe List is immutable
codesect` also that :) 20:47
japhb Heh 20:48
codesect` ugexe: yeah, fair point re: Iterables not knowing how to create collections of themselves. I guess I was imagining it being possible in a single-line call; with e.g., `my List $a = (1, 2, 3); my $b.grep(* %% 2).collect;` it doesn't seem like an _impossibility_ for $b to know that it should collect into a List without positionals having to know all the time 20:51
but it'd definitely require some special casing, and I can see why we don't 20:52
ugexe i dont see how $b would communicate its original type through the underlying sequence
i would expect that would require something like perls 20:53
'wantarray' which is impossible in raku afaik
codesect` I guess I was imagining some sort of special-casing of grep/etc so that it wouldn't return a Seq in some situations. But that'd certainly be harry - and maybe not even possible 20:55
El_Che wasn't wantarray the reason of the perljam rant at the CCC?
codesect` As I said, I can see why we don't
m: sub f(\x) { say x.WHAT }; f(do for (1, 2).List {$_}); f(do for [1, 2].Array {$_}) 21:01
camelia (List)
(List)
codesect` I guess I _am_ kind of surprised that there's not a way to have the second of those calls build itself back into an Array - many of the same points apply, of course, in that it'd still need to "remember" the pre-iteration type 21:03
but it somehow feels like it should be easier to do so when there aren't any Seqs involved. But I'm not sure why 21:04
ugexe m: my List $a := (1,2,3,4); my Array $b := [5,6,7,8]; my $aa = $a.WHAT.new: $a.grep(*.so); my $bb = $b.WHAT.new: $b.grep(*.so); say $aa.WHAT; say $bb.WHAT 21:13
camelia (List)
(Array)
ugexe this is at least slightly less worse 21:14
codesect` oh, that is a bit better 21:18
ty
guifa kybr: it’s not possible to create your own hyper operator. At least not doing anything simple, you’d need to create a slang in order to process the base operator, although the slang itself might not be toooo hard to do 22:23
guifa s/process/parse 22:28