02:01 rakuUser left 06:16 yjh joined
yjh Hello. Is this the right place to be to ask about a problem installing a module? 06:17
10:10 mjgardner left 10:11 mjgardner joined 10:28 rakuUser joined
Anton Antonov Is there a function or idiom that lets me get a Hash without specified elements. I.e. something like : `my %h = {a=>1,b=>8,c=>4}; %h.key-drop<a c>` would return `{b=>8}`. 13:30
I know I can use `my %h1 = %h; %h1<a c>:delete; %h1` . 13:31
lizmat do a c need to be removed from the hash? or just not part of the return value? 13:38
Anton Antonov The latter, just not part of the returned value.
lizmat something like: my %h = :42a, :666b, :12c; dd (%h{%h.keys.grep(* ne "a"|"b")}:p).hash ? 13:40
if you would be happy with a list of Pairs, you can drop the outer ().hash 13:41
Anton Antonov Thanks, Liz. This does what I want: `%h{%h.keys.grep(* !(elem) <a b>)}:p` . 13:44
Thanks, Liz! This does what I want: `%h{%h.keys.grep(* !(elem) <a b>)}:p` .
lizmat you could also use ∉ instead of !(elem) :-) 13:45
Morfent if you're using setty ops... 13:46
m:```
my %h = a=>1, b=>8, c=>4;
say %(%h{%h (-) <a b>}:p)
```
Anton Antonov Ah, I know, I have hard time entering it, and, *to me*, in Raku `!(elem)` looks more readable. 13:47
lizmat sure :-)
Anton Antonov <@!210313526928080896> Yes, I like that.
@lizmat In Mathematica I do prefer using `∈` and `∉`. 13:49
Nemokosch what is `%h{}` for? 13:59
lizmat it's called the zen-slice... it is basically the same as %h but %h{} can be interpolated in a double quoted string
Anton Antonov <@!297037173541175296> For getting a elements / values out of a dictionary/hash.
lizmat ah, I thought the empty {} was meant :-) 14:00
Anton Antonov Liz, I think it is...
Nemokosch hm? 14:05
Anton Antonov How can I merge an arbitrary list of hashes? Is there some reduction operation for `%a , %b` ? 14:31
How can I merge an arbitrary list of hashes? Is there some reduction operation for `my %c = %a , %b` ?
Of course, I can always use a `for` loop. 14:32
lizmat what's wrong with my %c = %a, %b ? 14:38
Anton Antonov @lizmat `my %c = %a, %b` is fine for two hashes. Let us consider having an array of hashes, e.g. `my Hash @arr = [ %( ...]`. I would like to merge all hashes in that array into one hash. I can use `my %hres = do for @arr -> %h {%hres = %hres , %h}`, but I was wondering can I use something like `[,] @arr` . 14:50
lizmat perhaps: my @a is List = {:42a},{:666b},{:777c}; dd @a; my %h = @a; dd %h 14:53
my %h = @a does the right thing if there are no containers involved 14:54
if it has to be an Array, then something like: my @a = {:42a},{:666b},{:777c}; dd @a; my %h = @a.map: *<>; dd %h
basically de-containerizing the elements of the array 14:55
Anton Antonov Lizmat, these are great options -- I will study them. Thanks! 14:58
yjh Is there a reason %?RESOURCES<libraries/sha1> would return a path with filename extension 'lib' instead of 'dll' on windows? 15:00
lizmat that feels... odd 15:02
gfldex m:``` 17:50
my %h = :1a, :8b, :4c;
dd %h.grep(*.key ne 'a'|'b').hash;
```
[Coke] the lib vs. dll question is "why am I getting a static library instead of a dynamic one?" 18:08
?