🦋 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.
ab5tract anyone else here using Raku on Windows? I'm surprised to be experiencing garbled text a la "Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2020.10." 00:05
00:05 pecastro left
tbrowder is there any built-in method i'm missing? 00:08
guifa tbrowder: I don’t think there is a better built in method 00:10
00:20 mowcat left 00:24 jmchael left 00:28 epony left 00:34 jmchael joined 00:38 epony joined
guifa2 ab5tract: that's because the Windows terminal doesnt support higher plane Unicode I think 00:40
timotimo you need to use "chcp" with some special value to get unicode in the terminal
ab5tract timotimo, guifa2 -- geez, that's unfortunate... 00:41
guifa2 ab5tract: it's a thing to help with trademarky stuff rigth now. It might not be permanent 00:42
leont «chcp 65001» may help
ab5tract leont: that does seem to help! 00:43
at least with the TM ...
and also with the output from regex matches.. thanks for the tip! 00:44
huh... doesn't help in Powershell ISE but does help in the Terminus term emulator that I usually use.. 00:50
pretty crazy to see Unicode issues in 2020, but whatevs, it's "solved" :) 00:51
00:53 Henry151 left 00:56 Henry151 joined 01:11 BenGoldberg joined 01:18 asymptotically left 01:21 jmchael left 01:41 guifa left 02:17 maggotbrain joined 02:21 holli__ left 02:27 eseyman left 02:29 eseyman joined 02:31 MasterDuke left 03:29 maggotbrain left 03:38 ensamvarg195 left 03:57 maggotbrain joined 03:59 leont left 04:00 ab5tract left 04:01 sivoais joined 04:04 ab5tract joined 04:08 _jrjsmrtn joined 04:09 __jrjsmrtn__ left 04:13 ab5tract left 05:05 roguelazer left 05:08 roguelazer joined 05:23 BenGoldberg left 05:27 ChoppedBacon left 05:28 ChoppedBacon joined 05:29 cpan-raku left 05:30 cpan-raku joined, cpan-raku left, cpan-raku joined 06:02 maggotbrain left 06:07 aluaces joined 06:08 jmerelo joined 06:17 aborazmeh joined, aborazmeh left, aborazmeh joined 06:21 ufobat_ joined 06:26 parabolize left 06:32 moon-child joined 06:34 frost-lab joined 07:08 skids left
coldpress is there a shorter way to extract the first elements of each list, in a list of lists? 07:11
m: map *[0], (0..3).combinations(2)
camelia ( no output )
coldpress m: say do map *[0], (0..3).combinations(2)
camelia (0 0 0 1 1 2)
moon-child coldpress: not shorter, but I would probably say 07:14
m: print (0..3).combinations(2).map(*.head)
camelia 0 0 0 1 1 2
07:15 aborazmeh left
coldpress moon-child: that's fine, but I'm looking to extract other indexes as well, like: 07:17
m: say do map *[2], (0..5).combinations(3) 07:18
camelia (2 3 4 5 3 4 5 4 5 5 3 4 5 4 5 5 4 5 5 5)
moon-child I don't entirely follow. map *[0 .. k], @a will give you the first k elements of each list contained in @a, but I don't think that's what you're looking for 07:20
(or perhaps flat map *[0 .. k], @a) 07:21
07:40 domidumont joined 07:59 stoned75 joined 08:07 pecastro joined 08:11 holli__ joined 08:14 BenGoldberg joined 08:15 sena_kun joined 08:22 Sgeo left 08:24 sjm_uk joined 08:38 abraxxa joined 08:43 abraxxa left, abraxxa joined 08:44 dakkar joined
guifa2 coldpress: @foo[*;0] 08:47
08:47 BenGoldberg left
guifa2 m: my @a = 1,2,3; my @b = 10,20,30; my @c = 100,200,300; my @d = @a, @b, @c; say @d[*;0] 08:47
camelia (1 10 100)
guifa2 Or for your example: 08:49
m: say (0..3).combinations(2)[*;0]
camelia (0 0 0 1 1 2)
guifa2 You can also use >> inside of your method call, that will distribute the subsequent call to each item in the former (functionally it's very similar to map, but there are some differences)
m: say (0..3).combinations(2)>>[0] 08:50
camelia (0 0 0 1 1 2)
09:07 Altai-man joined 09:09 wamba joined 09:10 sena_kun left 09:34 v_m_v left, v_m_v joined 09:35 aluaces left 09:36 aluaces joined 09:44 aluaces left 09:56 aluaces joined
holyghost guifa2 : that's nice 09:59
10:01 wamba left
JJAtria[m] Are there any recent-ish examples out there of using NativeCall with C++ classes, etc? 10:06
Found this from 2016, but I'm not sure if things have changed significantly since then: hoelz.ro/blog/binding-to-cpp-with-nativecall
And this section is a bit scant: docs.raku.org/language/nativecall#C++_support 10:07
10:11 rindolf joined 10:14 holli__ left 10:29 asymptotically joined 10:50 redhands_001 joined 10:51 redhands left 10:54 aborazmeh joined, aborazmeh left, aborazmeh joined 10:56 guifa2 left 11:29 ufobat_ left 11:39 BenGoldberg joined
notandinus oof raku is driving me mad 11:42
m: my @set = 1, 2, 3; my @tmp = 0 .. @set.elems - 1; @tmp = @tmp.reverse; while shift @tmp -> $idx_1 { for @tmp -> $idx_2 { say "$idx_1 $idx_2" } } 11:43
camelia 2 1
2 0
1 0
notandinus m: my @set = 1, 2, 3; my @tmp = 0 .. @set.elems - 1; while shift @tmp -> $idx_1 { for @tmp -> $idx_2 { say "$idx_1 $idx_2" } }
camelia ( no output )
notandinus why does the first one work and second one doesnt?
11:43 Black_Ribbon left
notandinus paste.debian.net/hidden/c23f3a36/ - here is prettier version 11:44
if you remove line 4 it doesn;t work
is this a bug?
lizmat the first shift of @tmp yields a 0 if @tmp is not reversed. This is false, so the outer loop will never fire 11:47
so ENOTACOREBUG :-)
notandinus oh 11:48
lizmat notandinus ^^
notandinus oof i've been using it everywhere
what's the correct way of doigng this ?
lizmat define "this" :) 11:50
notandinus i want to loop over @tmp while pop'ng it 11:51
11:51 morayj joined
lizmat while @tmp { my $popped = @tmp.pop } 11:51
notandinus i see, can i ask `while' to not focus on pop'ed value & work with if `shift` was successful? 11:53
lizmat in this case, the while just looks at whether @tmp has any elements in it 11:54
so I'm not sure how shift or pop comes into that
or what you're trying to achieve
notandinus i see, yeah your code will fix it
what would be the direct translation of this perl code: 11:55
while (my $pop = pop @tmp) { }
lizmat for @tmp.reverse -> $pop { 11:56
11:56 wamba joined
lizmat well, that wouldn't destroy your @tmp 11:56
otherwise:
if you know there are only true values in @tmp (which in your case, there weren't) 11:57
you could do:
while @tmp && @tmp.pop -> $pop { 11:58
notandinus i see, 12:00
actually that while @tmp { my $popped = @tmp.pop } doesnt fix it
what i want to do is, combinations (nested for) but my operation is addition so a + b == b + a, that is why i want to eliminate the value as i go on 12:01
that code does this: paste.debian.net/hidden/0f878f78/ 12:02
ok wait, ah sorry, i should use $popped as $idx_1 12:03
thanks, that fixes it 12:05
12:07 jmchael joined
lizmat m: dd (^10).combinations(2).unique: :as(&sum) # something like this ? 12:09
camelia ((0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8), (0, 9), (1, 9), (2, 9), (3, 9), (4, 9), (5, 9), (6, 9), (7, 9), (8, 9)).Seq
12:13 BenGoldberg left
notandinus lizmat: yeah that's what i wanted, i should've read about combinations, i didn't know of unique method 12:14
i'll read the docs,t hanks 12:15
lizmat yw :-)
12:19 leont joined
notandinus lizmat: i think .unique is not required 12:19
m: say (^3).combinations(2).unique
camelia ((0 1) (0 2) (1 2))
notandinus m: say (^3).combinations(2)
camelia ((0 1) (0 2) (1 2))
notandinus looks like combinations does it by default 12:20
lizmat yeah, but you wanted uniqueness on the sum of the values ?
m: say (^4).combinations(2) # note that both (0 3) and (1 2) will produce 3 as sum ? 12:21
camelia ((0 1) (0 2) (0 3) (1 2) (1 3) (2 3))
12:22 dmc00 left
notandinus ah, sorry for misunderstanding, i wanted what combinations does by default 12:22
lizmat ok, then you're good with just combinations :-)
notandinus what i meant was both (0 1) and (1 0) will produce same sum
i mean the index,
lizmat ok
notandinus also, shouldn't this default behaviour of combinations be a bug? 12:23
12:23 aborazmeh left, dmc00 joined
notandinus because 12:23
m: say (^3).combinations(2).unique 12:24
camelia ((0 1) (0 2) (1 2))
notandinus should include (2 2) right ?
and also (1 0) (2 0)
is it expected behaviour? 12:25
lizmat m: say <a b c>.combinations(2) # maybe not using numbers makes it easier 12:26
camelia ((a b) (a c) (b c))
lizmat you're *combining*
(a a) cannot happen, because "a" only occurs once 12:27
m: say <a a b c>.combinations(2)
camelia ((a a) (a b) (a c) (a b) (a c) (b c))
lizmat note that now you have two "(a b)" and "(a c)" because there are two "a"\s
notandinus oh right 12:33
what i was thinking of is permutations right?
oof i'm already starting to forget these things
lizmat well, maybe *I* led you astray here 12:34
notandinus no, i had this discussion before too with someone else 12:35
i didn't understand what they were saying so i gave up, it was right here in #raku
thanks for fixing this 12:36
lizmat ok, well, I don't really backlog here anymore.. there's just too much to backlog :-)
notandinus hah yeah, its quite idle when i'm online though 12:37
might be active when i'm sleeping
12:41 v_m_v left 13:08 sena_kun joined 13:10 Altai-man left 13:12 ggoebel_ left 13:14 ggoebel joined 13:15 frost-lab left 13:31 morayj left 13:38 ab5tract joined 13:51 holli__ joined 14:02 morayj joined
tbrowder jmerelo (or anyone): when running Pod::To:HTML how can i eliminate the toc 14:04
14:04 cpan-raku left
tbrowder i like everything else but i don't see how to automagically eliminate it. 14:08
14:11 MasterDuke joined
MasterDuke coldpress: thanks, made those edits 14:12
leont What is generally considered a reasonable backwards compatibility policy in Raku. 14:14
I have the impression people in Raku tend to run relatively recent versions, but I'm not sure (especialyl not wrt distro packaged versions)
vrurg leont: we don't break it except for some bugs. Roast and ecosystem testing ensures that no major breaks happen. 14:18
leont I should be more specific: how backwards compatible should I be in my *modules* 14:19
14:19 cpan-raku joined, cpan-raku left, cpan-raku joined
vrurg This is harder to say. I'd say that best if you make them work with distros packages. But how much do they lag behind – I don't know. A year old rakudo release looks reasonable to me. 14:22
leont .rakumod is an obvious case of "only supported for about a year", but I also have some code for working with older version of raku in one of my modules 14:25
14:28 ggoebel left, domidumont left 14:34 wamba left 14:35 morayj left 14:37 morayj joined 14:38 domidumont joined, domidumont left, wamba joined
coldpress guifa2: nice, thanks for the two ways of distributing calls over arrays 14:39
tellable6 coldpress, I'll pass your message to guifa2
vrurg leont: to my view, if somebody is happy with really old version of compiler they could be ok with older versions of modules. 14:40
14:42 Sgeo joined
leont Apparently the version shipped with ubuntu LTS has .rakumod support, that does make things a bit easier 14:43
14:48 domidumont joined 15:04 BenGoldberg joined 15:07 parabolize joined 15:45 RaycatWhoDat joined
RaycatWhoDat Quick question: what's the state of game development in Raku? Is it still "make-bindings-to-SDL2-and-roll-everything-yourself"? 15:50
jmerelo RaycatWhoDat: kinda, yes. There's SDL" and SDL::raw. 15:51
RaycatWhoDat Is it a similar story for GUI development? 15:53
dakkar GUI is a bit better modules.raku.org/search/?q=gnome 16:16
you can use nearly all of GTK3
(disclaimer: I haven't tried, yet)
16:18 BenGoldberg left
codesections does anyone happen to know the implementation details of Raku Arrays enough to say whether there's a performance reason to use them as a queue via `unshift` and `pop` versus `push` and `shift`? 16:21
dakkar run a benchmark and see what happens? 16:22
codesections (that is, whether the direction matters)
dakkar: fair :D
dakkar it may well change between different releases
(which is all a long winded way of saying "I don't know" 😜)
codesections well, I'm not really interested in *micro* optimizations of the sort that change super frequently 16:24
dakkar I've written this: `use Benchy; my @front = ^100; my @back = ^100; b 2_000_000, { @front.unshift(1); @front.pop() }, { @back.push(1); @back.shift() };` 16:32
it doesn't give any reliable results
as in, different runs give very different times
2M operations take <½s on my machine
16:33 wamba left, wamba joined
dakkar codesections: I've checked with three different benchmark modules, the answer is: if there is a difference, it's too small to measure, pick whichever style looks better for you 16:40
16:40 domidumont left
codesections Thanks. (I didn't know about benchy -- I'll have to check that out) 16:42
dakkar I just searched "benchmark" on modules.raku.org
then used all three results ☺
codesections haha, fair enough :D 16:43
I've always just used `now - INIT now` 16:44
dakkar that has a few problems when you want to compare different implementations in a single run 16:45
but it's good enough for a first approximation 16:46
codesections agreed. Which is as far as I've gone 16:47
16:51 skids joined, domidumont joined 16:57 domidumont left 17:07 Altai-man joined 17:08 morayj left, morayj joined 17:09 dataange` left 17:10 sena_kun left, guifa2 joined 17:14 morayj left, morayj joined 17:17 leont left, leont joined 17:24 rindolf left 17:29 morayj left 17:32 finsternis left
guifa2 grr, I wish array slices could be used as left hands in assignment 17:34
tellable6 2020-12-09T14:39:57Z #raku <coldpress> guifa2: nice, thanks for the two ways of distributing calls over arrays
17:34 domidumont joined, RaycatWh` joined 17:35 dakkar left 17:37 RaycatWhoDat left, RaycatWh` left
[Coke] m: my @a = 1..10; @a[1,2,3]=4,5,6; dd @a 17:39
camelia Array @a = [1, 4, 5, 6, 5, 6, 7, 8, 9, 10]
[Coke] guifa2: ^^ ??
guifa2 [Coke]: I should have been more specific, I wanted to do 17:40
@a[3,4,5] = 5 17:41
--> [1,2,3,5,5,5,6…]
17:41 cpan-raku left
guifa2 but >>= doesn't work :-( 17:42
I can use @foo[*] = $bar xx Inf though it just feels clunkier 17:43
MasterDuke codesections: github.com/MoarVM/MoarVM/pull/1392 is likely relevant 17:44
codesections guifa2: is the clunkier alternative this: 17:46
m: my @a = 1..10; @a[3, 4, 5] = 5 xx *; say @a
camelia [1 2 3 5 5 5 7 8 9 10]
17:47 wamba left, rindolf joined
codesections MasterDuke: thanks 17:48
guifa2 codesections: I forget about the star sometimes haha 17:49
17:49 domidumont left
codesections :D or ∞, though * seems clearer here, IMO 17:51
guifa2 although actually dangit 17:55
That won't work for me
I need to swap out the key name at one level of a nested hash 17:56
there's gotta be a simpler way
17:57 dogbert17 joined
tbrowder .tell jmerelo my advent article is ready for publishing and it's here <github.com/tbrowder/advent2020/blo...t.html> 17:57
tellable6 tbrowder, I'll pass your message to jmerelo
tbrowder .tell jmerelo i'll try to put it on the raku-advent.blog site but i'm now having much luck with it so far 17:58
tellable6 tbrowder, I'll pass your message to jmerelo
guifa2 .<new> = .<old> if .<old> for %a{*;*} # this will work since the old key name sticking around is okay 18:01
.<new> = .<old>:delete if .<old> for %a{*;*} # even better! 18:05
tbrowder .tell jmerelo it's on the advent site, bit styling doesn't look great, bummer
tellable6 tbrowder, I'll pass your message to jmerelo
18:05 domidumont joined 18:06 domidumont left 18:19 lucasb joined 18:20 skids left
jmerelo tbrowder: ack. I'll check it out. Thanks! 18:21
tellable6 2020-12-09T17:57:39Z #raku <tbrowder> jmerelo my advent article is ready for publishing and it's here <github.com/tbrowder/advent2020/blo...t.html>
2020-12-09T17:58:57Z #raku <tbrowder> jmerelo i'll try to put it on the raku-advent.blog site but i'm now having much luck with it so far
2020-12-09T18:05:10Z #raku <tbrowder> jmerelo it's on the advent site, bit styling doesn't look great, bummer
18:25 xinming left 18:26 xinming joined 18:29 jjmerelo joined 18:31 jmerelo left 18:35 aborazmeh joined, aborazmeh left, aborazmeh joined 18:38 Doc_Holliwould joined 18:41 holli__ left 18:42 cpage_ joined, cydf joined
cydf Hi all 18:44
18:45 cpage left, cpage_ is now known as cpage
guifa2 waves at cydf 18:46
cydf There used to be a thing called 'p6doc' before... what would that be now? There's no 'rakudoc' in my install from rakubrew
moritz use docs.raku.org/ 18:48
cydf And how do I get the docs from an installed module? Or do I have to find those on-line, too? 18:51
moritz ha, good question 18:52
cydf I guess that means there's no good answer.... 18:53
leont There's raku --doc, but that expects a file not a module name 18:55
moritz I'm not omniscient
jjmerelo There's actually rakudoc 18:56
You need to install it on top of the documentation.
But moritz's answer is actually the best thing. Use them online. 18:57
18:58 wamba joined
cydf Where would I find this mythical rakudoc? Doesn't seem part of the ruke distribution... 18:58
ruke/raku
jjmerelo cydf: zef install rakudoc, probably 19:01
Let me check
But, again, the web which you can also build yourself is your best bet. rakudoc is not thoroughly checked, and it's not even called rakudoc... I haven't been able to find it 19:02
github.com/Raku/rakudoc Not sure why it's not been released... Probably because I had to check it before we did, and we didn't 19:03
cydf: there's a pre-built repo which you can just download here github.com/rakudocs/rakudocs.github.io
leont Yeah, having it in the module repository would be helpful 19:05
cydf OK, thanks jjmerelo 19:06
19:09 BenGoldberg joined
jjmerelo cydf: sure :-) 19:10
19:16 |oLa| joined 19:26 sjm left 19:32 aluaces left 19:33 sjm joined, aluaces joined 19:34 jjmerelo left 19:41 sjm left 19:42 sjm joined 19:43 BenGoldberg left 19:44 |oLa| left 19:58 |oLa| joined, |oLa| left 20:01 aborazmeh left
SmokeMachine m: my @a; @a = 5 xx *; say @a 20:04
camelia [...]
SmokeMachine m: my @a; @a = 5 xx *; .say for @a 20:05
camelia (timeout)5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5…
20:09 sjm_uk left
SmokeMachine m: my @a; @a[<1 3 5 7 9>] = 5 xx *; .say for @a 20:09
camelia (Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
20:12 rypervenche left 20:14 tejr left 20:16 skids joined, rypervenche joined 20:19 tejr joined
guifa2 SmokeMachine: or even 20:20
m: my @a; @a[1,3,5 ... *] = 5 xx *; .say for @a
camelia ( no output )
guifa2 glares at camelia
20:21 ggoebel joined
moritz m: my @a; @a[1,3,5 ... *] = 5 xx *; .say for @a.head(10) 20:29
camelia ( no output )
moritz m: my @a; @a[1,3,5 ... *] = 5 xx *; .say @a.head(10)
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3my @a; @a[1,3,5 ... *] = 5 xx *; .say7⏏5 @a.head(10)
expecting any of:
infix
infix stopper
statement end
st…
moritz m: my @a; @a[1,3,5 ... *] = 5 xx *; say @a.head(10)
camelia ()
guifa2 m: my @a; @a[1,3,5 ... 9999] = 5 xx *; .say for @a 20:31
camelia (Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5
(Any)
5…
guifa2 notes the limitation: must be a finite list
moritz would have prefered an error message to a silent non-action 20:39
MasterDuke yeah, that's interesting 20:46
20:57 robinsmidsrod left 20:58 robinsmidsrod joined 21:00 grondilu joined
grondilu SpaceX's second attempt imminent : www.youtube.com/watch?v=ap-BkkrRg-o 21:00
lizmat T-minus 3 minutes 21:01
21:08 sena_kun joined 21:10 Altai-man left 21:18 Black_Ribbon joined 21:21 stoned75 left
moritz tenative T-0 now at 22:40 UTC 21:25
El_Che now 21:39
21:39 rindolf left
moritz in one hour, actually 21:43
El_Che that's why it doesn't move 21:44
:)
21:51 jmchael left, jmchael joined 21:52 jmchael left 21:54 jmchael joined 22:22 sena_kun left 22:34 BenGoldberg joined, skids left
ggoebel how do you make a method or function signature that requires an array parameter to be an array of integers? 22:43
leont You can declare an Int @array, but that does something subtly different 22:44
It wants you to pass an Array[Int], not an Array that happens to contain Ints
So unless that array is the former, that won't help you
ggoebel can you use a where clause to constrict it to an array of int? And would that also allow an Array[Int]? 22:45
leont You can do that, yes
ggoebel what is the syntax for that... I'm reading docs.raku.org/type/Signature#index...ere_clause but not seeing it 22:46
thank you for your help leont++
22:47 MasterDuke left
leont sub foo(@array where all(@$_) ~~ Int) {} 22:47
Or better, sub foo(@array where $_.all ~~ Int) {} 22:48
ggoebel thank you! 22:50
23:01 wamba left
lizmat well, that was interesting: hit the target with a little excess velocity :-) 23:03
23:08 BenGoldberg left
leont Boom is bad? 23:21
lizmat well, flying something up to 12.5km by just rockets, then getting it back to within meters of the target, is quite the achievement already 23:31
after the smoke cleared, the message was "SN9 is up next" or something to that effect