🦋 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.
00:06 jpn joined 00:14 teatime joined 00:48 jpn left 01:08 beanbrain joined 01:41 hulk joined, kylese left
tbrowder ok 02:03
oh, just read latest sean of the south daily letter, funny one about his latest flying experience and overbooking. google him, i think your current trip may make you appreciate it more 02:06
02:11 jpn joined 02:15 hulk left, kylese joined 02:19 jpn left 02:30 jpn joined 02:34 jpn left
jdv anyone else have trouble installing zef on head? 02:50
jdv@jdv-lap2:~/zef$ raku -Ilib bin/zef install . 02:51
No such method 'identity' for invocant of type
'Array[DependencySpecification]'
jdv@jdv-lap2:~/zef$
03:29 jpn joined 03:34 jpn left 03:51 Xliff joined
Xliff \o 03:51
I want to make something like Midnight Commander (mc) in raku. What TUI modules are available?
I'm aware of Terminal::Widgets, but that's still WIP 03:52
04:08 wlhn joined 04:12 wlhn_ left
antononcube @Xliff I think there is color terminal, or something, 04:16
raku.land/zef:lizmat/Terminal::ANSIColor
04:31 jpn joined
jdv wasn't japhb working on that sort of thing a while ago? 04:33
04:36 jpn left 04:40 beanbrain left 04:50 beanbrain joined 05:11 wlhn left, wlhn joined 05:30 Sgeo left 05:32 jpn joined 05:37 jpn left
patrickb Terminal::Widgets are japhs modules 06:05
06:25 swaggboi left 06:30 beanbrain left, beanbrain joined, beanbrain left, beanbrain joined 06:31 jpn joined 06:33 beanbrain left 06:37 beanbrain joined, jpn left 07:21 jpn joined 07:26 jpn left 07:52 dakkar joined 07:57 soverysour joined 08:04 jpn joined 08:09 jpn left 08:15 beanbrain left 08:36 beanbrain joined, beanbrain left, beanbrain joined 09:19 soverysour left 09:29 jpn joined 09:35 jpn left 09:40 beanbrain left 09:47 soverysour joined 10:24 jpn joined 10:29 jpn left 10:43 jpn joined 11:12 soverysour left 11:21 soverysour joined 11:28 jpn left
tbrowder hi, is there an easy way to sort the k (key) part with ‘for %h.kv -> $k, $v’? 12:10
m: my %h= %( a => 2); .say($k => $v) for %h.kv 12:14
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$k' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> my %h= %( a => 2); .say(⏏$k => $v) for %h.kv
tbrowder m: my %h = %( a => 1); for %h.kv -> $k, $v { say “$k => $v” } 12:17
camelia a => 1
antononcube @tbrowder Make pairs first, sort by key, then take .kv per pair. 12:18
Something like %h,pairs.sort(*.key)».kv . 12:19
tbrowder like adding a “.sort” in there ^^
yes, that’s what i always do. 12:20
antononcube Ok.
tbrowder but i see lizamat adding .sort in lots of surprising places, and also dwarring 12:21
antononcube Then, what you are asking is to have ability to sort Maps.
They might be using "Hash::Ordered" or similar.
tbrowder i guess so. i think you can use .x on anything that produces a $_ 12:22
antononcube This seems to work: 12:24
cdn.discordapp.com/attachments/633...bd827&
librasteve m: my %hash=(c=>3,a=>42,b=>7); say %hash.sort(*.key)
evalable6 (a => 42 b => 7 c => 3)
Raku eval (a => 42 b => 7 c => 3)
antononcube Well I meant this code: use Hash::Ordered; my %h is Hash::Ordered = b=> 3, a => 1; %h.sort.Hash.kv 12:25
lizmat Hash.kv is unordered
librasteve tbrowder: maybe I don't understand ... but .sort(*.key) seems to answer your question
antononcube @lizmat I guess I did not read the descript of "Hash::Ordered". 12:27
librasteve m: my %hash=(c=>3,a=>42,b=>7); say %hash.sort
evalable6 (a => 42 b => 7 c => 3)
Raku eval (a => 42 b => 7 c => 3)
tbrowder let’s see: 12:29
m: my %h=b=>2,a=1; for %(%h.sort(*.key)).kv -> $k, $v { say “$k => $v} 12:35
camelia ===SORRY!=== Error while compiling <tmp>
Unable to parse expression in curly double quotes; couldn't find final '”' (corresponding starter was at line 1)
at <tmp>:1
------> t(*.key)).kv -> $k, $v { say “$k => $v}⏏<EOL>
lizmat tbrowder: you're sorting a hash, then turning it into a hash again and the expect the order of the sort to be preseved? 12:36
m: my %h = :1a, :2b; .say for %h.sort(*.key).map(*.kv.Slip) # but it feels like a very roundabout way 12:38
camelia a
1
b
2
tbrowder no, i’m not surprised, i pulled the trigger before engaging brain
lizmat m: my %h = :1a, :2b; for %h.sort(*.key).map(*.kv.Slip) -> $k, $v { say "k = $k, v = $v" }
camelia k = a, v = 1
k = b, v = 2
12:40 tirnanog joined
tbrowder thnx, but my eyes glaze over with map and grep 12:40
antononcube <tbrowder> "[...] pulled the trigger before engaging brain" -- If you pull the trigger long enough, then the trigger pulls you.
lizmat m: dd (a => 42).kv
camelia ("a", 42).Seq
lizmat m: .say for (a => 42).kv 12:41
camelia a
42
librasteve took me a while to "get" this subtlety ... we are not the only ones - stackoverflow.com/questions/560670...d-using-kv 12:42
m: my %hash=(c=>3,a=>42,b=>7); for %hash.sort {say .key, .value}
Raku eval a42 b7 c3
evalable6 a42
b7
c3
librasteve ^^ this way sidesteps your question - passes each pair into the for loop 12:43
tbrowder ah, a trick that works 12:44
lizmat or use destructuring, which I think makes the most sense in this case:
m: my %h = :1a, :2b; for %h.sort(*.key) -> (:$key, :$value) { say "key = $key, value = $value" } 12:45
camelia key = a, value = 1
key = b, value = 2
lizmat note the variable *must* be called that
or further destructure: 12:46
m: my %h = :1a, :2b; for %h.sort(*.key) -> (:key($k), :value($v)) { say "key = $k, value = $v" }
camelia key = a, value = 1
key = b, value = 2
tbrowder ok, thnx to all. need to put all that in my keeper notes!
lizmat: did you see PR with 2 good tests? 12:48
lizmat you mean github.com/lizmat/Git-Status/pull/10 ? 12:50
librasteve my %hash=(c=>3,a=>42,b=>7); for %hash.sort.>>.kv -> ($k, $v) {say "$k => $v"} 12:51
evalable6 a => 42
b => 7
c => 3
librasteve lizmat: I like yours ... but a bit too much typing for my taste 12:53
lizmat m: my %h = :1a, :2b; for %h.sort(*.key) { say "key = $_key(), value = $_.value()" } # shorter 12:54
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$_key' is not declared. Perhaps you forgot a 'sub' if this
was intended to be part of a signature?
at <tmp>:1
------> a, :2b; for %h.sort(*.key) { say "key = ⏏$_key(), value = $…
lizmat m: my %h = :1a, :2b; for %h.sort(*.key) { say "key = $_.key(), value = $_.value()" } # shorter
camelia key = a, value = 1
key = b, value = 2
librasteve question - is it necessary to use .sort(*.key)? my testing shows that *.key is the default for Hashes anyway 12:55
lizmat actually, what you see is the default behaviour of Pair cmp Pair
.sort(*.key) does a Schwartzian transform under the hood 12:56
YMMV :-)
librasteve The type-agnostic comparator; compares two Pairs. Compares first their key parts, and then compares the value parts if the keys are equal. <== that's what we want isn't it
.oO ... guess we can add another Wikipedia page to the tally en.wikipedia.org/wiki/Schwartzian_transform 12:58
tbrowder lizmat: yes to PR question 13:10
lizmat tbrowder: left some comments 13:12
tbrowder ok
will fix 13:20
14:43 tirnanog left 14:50 soverysour left 15:01 tirnanog joined
tbrowder lizmat: i think the test.yml it's the way it should be, with @ugexe's suggested way 15:18
lizmat but why would we test zef in the CI of Git::Status ? 15:20
that will just run the tests again?
tbrowder it's not testing zef, or are you talking about the --debug option?
he --debug option shows more info in case there's a problem is my understanding, esp testing on workflows 15:21
github testing which we don't have a lot of control over without giant pain points 15:22
but it's easy to remove if you want. i put it in because i use that all the time now 15:24
lizmat the "run-tests" script already runs all of the tests 15:25
so what is the goal of running "zef --debug install ." ?
that it will install?
but isn't that implicit in the successful running of the tests? 15:26
I'm just trying to understand *why* you'd want to do that, in case there is some reasoning I missed
tbrowder oh! i got lost in the weeds trying to understand it, so i just kept it. please change the PR test stuff to what is correct
*understand run-tests that is 15:27
lizmat it's an alternative to testing: it's pretty quiet if all goes well, and very verbose when tests fail 15:28
tbrowder fine with me for sure! 15:29
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2024/06/24/2024-...r-matters/ 15:33
15:36 derpydoo joined 15:37 soverysour joined 15:44 thaewrapt left 15:47 soverysour left 15:48 thaewrapt joined 15:50 soverysour joined 15:55 derpydoo left
[Coke] sa 16:15
ww
16:18 beanbrain joined 16:34 dakkar left 16:37 derpydoo joined
SmokeMachine Does anyone know where the today’s hackathon from Perl and Raku conference will be? 16:53
17:15 xinming left 17:16 xinming joined
xinming releasable6: status 17:17
releasable6 xinming, Next release in ≈3 days and ≈1 hour. There are no known blockers. Changelog for this release was not started yet
xinming, Details: gist.github.com/0cc0ba8c374561eba7...67c80567c6
17:21 soverysour left
antononcube Thanks, xinming! 17:22
@SmokeMachine Try the Raccoon room.
SmokeMachine I just found it, thanks! 17:23
17:23 soverysour joined, soverysour left, soverysour joined
ugexe you would test with `zef install .` instead of some test script or manually invoking the tests yourself to ensure everything precompiles and actually installs 17:25
just running tests without also installing is not a good practice. and running the tests separate from the install means you have to precompile everything twice. so i recommend using `zef install .` to test your code in CI 17:26
17:31 jpn joined
ugexe "but isn't that implicit in the successful running of the tests?" - No 17:31
tests can pass yet encounter precompilation errors on install 17:32
17:42 discord-raku-bot left, discord-raku-bot joined 17:50 jpn left
SmokeMachine I'm having some troubles releasing my old module `SeqSplitter` on fez... I have released a version 0.0.1 (I already had that version on p6c) and then released 2 more version (0.0.2 and 0.0.3) but it seems raku.land only see the 0.0.1 (raku.land/zef:FCO/SeqSplitter). Any idea what I'm doing wrong? 17:50
now it's there! 17:51
gfldex Sometimes impatience is not a virtue. :-> 17:52
17:53 Xliff left
SmokeMachine :) 18:00
it seems that was the case... everything is working... thanks and sorry for the interruption
18:38 derpydoo left 19:11 MoC joined
Geth ecosystem/main: 83a71fa1ca | (Elizabeth Mattijsen)++ | META.list
Remove SeqSplitter

It lives in the zef ecosystem now
19:11
SmokeMachine Thanks lizmat! Sorry for not doing that... 19:18
19:21 MoC left
lizmat SmokeMachine: no worries 19:23
19:27 silug left 19:28 soverysour left 20:01 soverysour joined, soverysour left, soverysour joined 20:18 soverysour left 20:37 xinming left 20:39 xinming joined 20:48 soverysour joined 20:56 soverysour left 21:27 soverysour joined, soverysour left, soverysour joined, jpn joined 21:31 soverysour left 21:50 jpn left, jpn joined 22:03 jpn left 22:05 jpn joined 22:26 Sgeo joined 22:28 jpn left 22:30 jpn joined 22:41 sena_kun left 23:02 jpn left 23:04 jpn joined 23:24 jpn left