🦋 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: ... | Log inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
Geth doc: c6819b428f | Coke++ | doc/Language/variables.pod6
pass example compilation test
05:16
linkable6 Link: docs.raku.org/language/variables
Geth doc: 2f821909ee | (Christian Bartolomäus)++ | doc/Type/Proc/Async.pod6
Remove duplicate word
12:58
linkable6 Link: docs.raku.org/type/Proc::Async
Skarsnik Hello 15:48
lizmat, any luck with the BEGIN/INIT stuff in a module? x) 15:50
Nemokosch suppers
japhb Trying to figure out status on the URI install issue: I saw ugexe fixed zef's confusion about URI versus URI::Template. I know [Coke] noticed the same install problems with URI that I did, and jonathanstowe confirmed it was most likely a Rakudo regression, not a URI change (since there haven't been any). Was there any progress after that? 16:36
suman Suppose I have a hash my %new_hash = {"madam" => 4, "sir" => 1, "student" => 3}; 16:37
How to print the keys with higher values in this case: get the keys madam and student
japhb m: my %new_hash = madam => 4, sir => 1, student => 3; .say for %new_hash.sort(*.value).head(2); 16:39
camelia sir => 1
student => 3
japhb m: my %new_hash = madam => 4, sir => 1, student => 3; .say for %new_hash.sort(-*.value).head(2);
camelia madam => 4
student => 3
japhb (Forgot to reverse the sort direction)
suman @japhb Rather than elements of hash, I just wish to get the last two highest keys 16:40
japhb m: my %new_hash = madam => 4, sir => 1, student => 3; .key.say for %new_hash.sort(-*.value).head(2); 16:41
camelia madam
student
japhb Or
m: my %new_hash = madam => 4, sir => 1, student => 3; .say for %new_hash.sort(-*.value).head(2).map(*.key);
camelia madam
student
suman (y) 16:42
japhb (Technically it is possible to determine k-th greatest faster than sorting the whole array (by partitioning), but doesn't seem worth the hassle here.)
suman If you have time, it would be great to see that solution too '=D 16:44
japhb I don't think we have convenient optimized built-ins for that ... it would require writing out the partition algorithm by hand. Not conceptually difficult, but famously easy to make non-obvious mistakes and get off-by-one errors and such. 16:46
Unless your hash has a LOT of elements (at least thousands), I'd just stick with the (fairly well-written) sort routine. 16:47
suman @japhb Can you please tell me how to print keys who have specific values. If a hash has value=1, then it will print all keys with value 1. 16:59
my %hash={abc => 1, bcd => 1, cde => 1, def => 1, efg => 1}; 17:00
here it has to print all keys because all have val=1
lizmat feels like we're doing someone's home work :-) 17:01
m: my %a = :1a,:1b,:2c,:3d; say %a.map: { .key if .value == 1 } 17:02
camelia (a b)
suman Haha no no, I was looking to solve k-mer problem in bioinformatics in rakuish way '=D 17:03
ugexe m: my %foo = a => 1, b => 1, c => 3; say %foo.categorize(*.value, :as(*.key))<1> 17:05
camelia (Any)
ugexe m: my %foo = a => 1, b => 1, c => 3; say %foo.categorize(*.value, :as(*.key)){1} 17:06
camelia [a b]
suman (y) 17:09
suman I do say $heredocs.subst("\n",:g) to remove all newlines and get a combined string in heredocs. 18:02
suman Is it good ? 18:03
suman Uploaded file: uploads.kiwiirc.com/files/04ae635f.../test.raku 18:04
melika hi 20:25
thundergnat m: my %hash = abc => 1, bcd => 2, cde => 1, def => 3, efg => 1, hij => 2, klm => 1, nop => 2; say (% .push: %hash.invert)<1>; 20:31
camelia [abc efg cde klm]
japhb Found the URI problem: github.com/raku-community-modules/...-962519559 22:44
lucs y 23:23
ww
Nemokosch c ww? 23:31