🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
guifa m: my %nums = %( even => (2,4,6,8,10), odd => (1,3,5,7,9), three => (3,6,9,12)); sub get-nums(*@types) { %nums.grep(*.key eq any @types)>>.value.flat }; say get-nums <even three>; 02:17
camelia ((3 6 9 12) (2 4 6 8 10))
guifa there's no containers, not sure why those aren't flattening 02:18
timo m: say my %nums = %( even => (2,4,6,8,10), odd => (1,3,5,7,9), three => (3,6,9,12)); say %nums.raku 02:42
camelia {even => (2 4 6 8 10), odd => (1 3 5 7 9), three => (3 6 9 12)}
{:even($(2, 4, 6, 8, 10)), :odd($(1, 3, 5, 7, 9)), :three($(3, 6, 9, 12))}
timo my %nums = %( even => (2,4,6,8,10), odd => (1,3,5,7,9), three => (3,6,9,12)); sub get-nums(*@types) { %nums.grep(*.key eq any @types)>>.value.map(*.<>).flat }; say get-nums <even three>; 02:45
evalable6 (3 6 9 12 2 4 6 8 10)
librasteve guifa: Hash (and Array) items are stored in containers, so even=>(2,4) aka even=>$(2,4) 03:53
tellable6__ librasteve, I'll pass your message to guifa
librasteve m: my %nums = %( even => (2,4,6,8,10), odd => (1,3,5,7,9), three => (3,6,9,12)); sub get-nums(@types) { %nums.grep({.key eq any @types})>>.value.flat: :hammer }; say get-nums <even three>; 03:58
tellable6__ 2024-10-03T21:18:33Z #raku <wayland76> librasteve we'd also have to get the grammar to do whatever Chroma does with syntax highlighting, but agreed.
evalable6 (2 4 6 8 10 3 6 9 12)
Raku eval ((2 4 6 8 10) (3 6 9 12))
librasteve ha! 04:01
(^^ this is a joyous laugh that my :hammer adverb is useful 04:02
)
lizmat weekly: github.com/zag/raku-knowledge-base 09:22
notable6__ lizmat, Noted! (weekly)
antononcube Flattening, for some reason or five, is very hard in Raku. 11:12
tbrowder wish i could help, only thing i've flattened are arrays with "|@arr" 11:21
antononcube Well, .flat works sometimes; .map(*.Slip) works much more often. 11:22
I have flatten in "Data::Reshapers", which at some I will make to take level specifications. 11:23
Actually, I think @lizmat recently worked on similar/same functionality... 11:24
lizmat .flat(:hammer) 11:26
antononcube 💡 11:27
@lizmat That is good to know! I was referring to, say, flat(level => (3, 5)) that flattens a nested structure between depth levels 3 and 5. 11:29
BTW, currently, flatten takes only "max-level" argument.
tbrowder any way to "unprecompile" for a module during testing other than deleting .precomps and setting the *NO_PRECOMPILATION env var? 11:31
lizmat raku.land/zef:lizmat/Repository::P...p::Cleanup 11:34
sorry, that's for core precomp files 11:35
tbrowder i think i'll try the env var and dump .precomp route. 11:38
but i thought i saw something here one time about a --no-precomp option for zef maybe, but i don't see it in zef help 11:40
lizmat ugexe? 11:46
wayland76 How long does fez/zef take to index a package? Like, are we talking, 5 minutes, 30 minutes, 2 hours? 13:11
timo you mean until it shows up on the website? 13:13
wayland76 Yeah, that's what I mean :) 13:15
Or maybe just how long before I can do a zef install and get the new version.
timo: Thanks for your help with the installation question. It made me re-examine META6.json, and I found the problem :) 13:18
Anyway, it looks like 10 minutes is a good rule of thumb for my package :) 13:19
timo i actually don't know how the zef ecosystem works exactly 13:20
wayland76 Well, you knew enough to help me :) 13:22
tbrowder arg, ran into this before. setting the env var does not completely work because the .precomp dir keeps coming back magically when raku starts up early in the process with one the phasers, or something like that.
wayland76 Apologies to anyone who tried the TOP module. The new one should work better.
timo oh, what i meant by zef ecosystem was uploads to, downloads from, and metadata updates inside of the zef ecosystem; we also get raku dists from cpan, and there used to be the p6c ecosystem which was based on a text file with URLs to META6.json files that was held in a repo on github, but we deprecated that 13:24
[Coke] greppable: experimental :pack 18:31
greppable6 [Coke], 54 lines, 25 modules: gist.github.com/cb0ceefdb6724aa018...5ea19b00d0
guifa making some cool new additions to Test::Inline, but now stuck on how to give options, when tags (akin to export tags) are given using colon pairs 22:38
tellable6 2024-10-04T03:53:51Z #raku <librasteve> guifa: Hash (and Array) items are stored in containers, so even=>(2,4) aka even=>$(2,4)
wayland if I have a scalar that does Positional, how do I loop over the items, ie. for $scalar -> $item {... ? 22:45
timo did you actually make a Scalar that has the Positional role, or is the thing inside the scalar a Positional? 22:54
but it should work to `for $scalar.list -> $item { ... }` or you can decont like `for $scalar<> -> $item { ... }` 22:55
wayland Great, I'll try those. Thanks! 22:59
wayland Hi! Does anyone have general suggestions about how to resolve this kind of error? gist.github.com/wayland/e2b585612a...f61775bcd5 The annoying thing is that, in the module tests, this seems to work, but it's not working for me now. 23:57