🦋 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. |
|||
guifa | leont: is it something you’re going to use regularly? Then you could make a custom operator that you could use with Z | 00:16 | |
00:21
leont left
00:27
m_athias left
|
|||
MasterDuke | i think there was some discussion about that exact question recently (within the past month or so), but i can't find it | 00:29 | |
00:34
wildtrees left
|
|||
rypervenche | There was something similar that Jonathan wrote, but I couldn't get it to work. Something like @a Z[&({$^b($^a)})] b . But yeah, I think a custom operator may be a cleaner approach. | 00:36 | |
00:44
m_athias joined
00:45
veesh left
|
|||
vrurg | m: sub foo($s) { $s*2 }; say (1,2,3) Z[&(-> $a, $b {$b.($a)})] &foo xx * | 01:27 | |
evalable6 | (2 4 6) | ||
vrurg | rypervenche: ^^ something like this. | 01:28 | |
m: sub foo($s) { $s*2 }; say (1,2,3) X[&(-> $a, $b {$b.($a)})] &foo | |||
evalable6 | (2 4 6) | ||
rypervenche | Ahhhh, it needs a lambda. | 01:32 | |
01:34
Altai-man_ joined
|
|||
cfa | rypervenche: this is fine too, | 01:35 | |
m: sub foo($s) { $s*2 }; say (1,2,3) Z[&({$^b.($^a)})] &foo xx * | |||
evalable6 | (2 4 6) | ||
cfa | per your original | 01:36 | |
as is | |||
m: sub foo($s) { $s*2 }; say (1,2,3) Z[&({$^b($^a)})] &foo xx * | |||
evalable6 | (2 4 6) | ||
01:37
sena_kun left
|
|||
cfa | or, ofc | 01:38 | |
m: say (1, 2, 3) Z[&({$^b($^a)})] { $_ * 2 } xx * | |||
evalable6 | (2 4 6) | ||
cfa | m: say (1, 2, 3) Z[&({$^b($^a)})] (* * 2) xx * | 01:39 | |
evalable6 | (2 4 6) | ||
cfa shuts up | 01:40 | ||
vrurg | rypervenche: it also works with $^b, $^a. Pointy block in my case is an artifact of experimenting. | 01:45 | |
m: sub foo($s) { $s*2 }; say (1,2,3) X[&({$^b.($^a)})] &foo | |||
evalable6 | (2 4 6) | ||
vrurg | Oh, I should've read what cfa was writing. :D | ||
01:47
hankache joined
01:52
hankache left
|
|||
rypervenche | m: my @values = <one two three>; say @values X[&({$^b($^a)})] &uc | 01:54 | |
evalable6 | (ONE TWO THREE) | ||
rypervenche | Ahhh, I see. I needed the & there. | ||
How would one put something like &uc into an array? and then use an array at the end instead? I keep getting errors. | 01:56 | ||
cfa | vrurg: :P | 01:58 | |
vrurg | m: say (&uc xx 3).raku | 01:59 | |
evalable6 | (proto sub uc ($, *%) {*}, proto sub uc ($, *%) {*}, proto sub uc ($, *%) {*}).Seq | ||
vrurg | rypervenche: like this, for example. | ||
rypervenche: &foo is a Callable object (Code and derivates). | 02:00 | ||
cfa | rypervenche: what are you trying to achieve, exactly? | 02:03 | |
rypervenche: store a collection of functions to apply later? | |||
rypervenche | Oh, I was missing parentheses. All good then. Just trying to do what the original question was. | 02:09 | |
vrurg | rypervenche: parentheses are there only to invoke .raku on the resulting list. xx creates a list on its own. | 02:14 | |
m: my $a := &uc xx 3; say $a | |||
evalable6 | (&uc &uc &uc) | ||
vrurg | m: my $a := &uc xx 3; say $a.raku | ||
evalable6 | (proto sub uc ($, *%) {*}, proto sub uc ($, *%) {*}, proto sub uc ($, *%) {*}).Seq | ||
02:25
mowcat left
03:02
cfa left
03:35
sena_kun joined
03:37
Altai-man_ left
03:40
reach_satori joined,
reach_satori_ left
03:42
veesh joined
04:04
reach_satori left
04:05
reach_satori joined
04:15
holyghost joined
04:41
avar joined,
avar left,
avar joined
04:59
aborazmeh left
05:27
reach_satori left
05:28
reach_satori joined
05:34
Altai-man_ joined
05:37
sena_kun left
05:44
pierrot_ is now known as pierrot
05:45
pierrot left,
pierrot joined
06:19
Doc_Holliwould joined
06:36
sftp left
06:39
sftp joined
06:41
sauvin joined
07:30
wamba joined
07:35
sena_kun joined
07:37
Altai-man_ left
07:39
abraxxa joined
07:41
Bucciarati joined
07:42
Redfoxmoon left
07:44
abraxxa left,
abraxxa joined
07:50
wamba left,
Doc_Holliwould left
08:10
discord6 left,
discord6 joined,
discord6 left,
discord6 joined
08:24
rindolf joined,
domidumont joined
08:26
erdic left
08:28
erdic joined
08:31
leont joined,
wamba joined
08:37
domidumont left
08:39
abraxxa left
08:41
abraxxa joined
08:47
xelxebar left
|
|||
leont | guifa: not really, though I have seen someone ask for the same operator a few weeks ago | 08:48 | |
08:52
titsuki joined
08:54
wamba left
08:58
wamba joined
09:13
mowcat joined
09:15
wamba left,
veesh left
09:17
veesh joined
09:18
titsuki left
09:23
wamba joined
09:34
Altai-man_ joined
09:37
sena_kun left
09:40
titsuki joined
|
|||
leont | m: say NaN == NaN; say NaN === NaN | 09:44 | |
evalable6 | False True |
||
09:44
abraxxa left
|
|||
leont | That seems surprising, it that a bug or a feature? | 09:45 | |
I would argue bug | 09:47 | ||
09:48
abraxxa joined
|
|||
leont | Both are logical in their own right, but the combination seems confusing | 09:49 | |
09:51
pecastro joined
09:54
Black_Ribbon left
10:00
hankache joined
10:08
pecastro left
10:17
reach_satori left,
reach_satori joined
10:36
pecastro joined
10:42
reach_satori left,
reach_satori joined
10:44
pecastro left,
reach_satori_ joined
10:47
reach_satori left
10:56
wamba left
10:58
raven__ left
11:00
EuAndreh[m] left
11:01
wamba joined,
pmf[m] left
11:03
darkstardevx joined
11:07
mowcat left
11:14
reach_satori joined
11:15
reach_satori_ left
11:23
mowcat joined
11:25
tadzik[m]1 left
11:35
sena_kun joined
11:37
Altai-man_ left
11:38
erdic left
11:39
erdic joined
11:50
pecastro joined
11:59
pecastro left
12:16
hankache left
|
|||
tyil | hmm | 12:19 | |
I have a small raku script here, which throws a big error if I run it with `| head -n 3` | 12:20 | ||
about a broken pipe | |||
12:20
molaf joined
|
|||
tyil | I cannot post the script or its output, but I can post the error | 12:20 | |
p.tyil.nl/uk0k | |||
piped through wc -l shows there's 71678 lines in the actual output | 12:21 | ||
12:22
wamba left
12:23
mowcat left
12:25
mowcat joined,
lucasb joined
12:27
pecastro joined
12:32
pecastro left
|
|||
leont | Yeah, that is a known issue | 12:34 | |
I'm sure I posted a solution a while ago, but I'm not sure I saved it | 12:35 | ||
«use NativeCall; sub signal(int32, int64) is native { * }; signal(SIGPIPE, 0);» | 12:38 | ||
It will ensure the default unix behavior in such cases, which is the right thing for command line tools and the wrong thing for network applications | 12:49 | ||
12:51
abraxxa left
12:52
reach_satori left,
pecastro joined
12:53
abraxxa joined,
Voldenet left
|
|||
tyil | interesting | 13:03 | |
thanks leont | |||
leont | Raku defaults to the opposite, basically | 13:04 | |
lizmat | tyil: could it be that the module upload bot is down ? | 13:08 | |
tyil | cpan-raku is in this channel | 13:09 | |
13:09
Voldenet joined,
Voldenet left,
Voldenet joined
|
|||
tyil | logs show it saw voldenet change host just now as well | 13:10 | |
is it not reporting a module you uploaded? | 13:11 | ||
lizmat just uploaded a module twice, and it has been reported on Twitter already :) | |||
tyil | hmm | ||
give me a few moments to do some work related stuff | |||
then I'll take a look :> | |||
lizmat | no hurry... just noticing... | ||
13:16
cpan-raku left,
cpan-raku joined,
cpan-raku left,
cpan-raku joined
|
|||
tyil | lizmat: which module are you referring too? | 13:24 | |
twitter doesn't let me read anything without accepting js trackers these days | |||
so I can't check there | |||
lizmat | ValueTypeCache | 13:25 | |
tyil | ty | ||
lizmat | 0.01 and 0.02 | ||
13:26
mowcat left
13:27
mensvaga left
|
|||
cpan-raku | New module released to CPAN! ValueTypeCache (0.0.2) by 03ELIZABETH | 13:27 | |
New module released to CPAN! ValueTypeCache (0.0.1) by 03ELIZABETH | 13:28 | ||
tyil | both the nntp and rsync services to check for new modules seem to be having issues on my end | ||
cpan-raku | New module released to CPAN! Cro::ZeroMQ (0.8.3) by 03JNTHN | ||
New module released to CPAN! Cro::WebApp (0.8.3) by 03JNTHN | |||
New module released to CPAN! cro (0.8.3) by 03JNTHN | |||
New module released to CPAN! Cro::WebSocket (0.8.3) by 03JNTHN | |||
New module released to CPAN! Cro::TLS (0.8.3) by 03JNTHN | |||
New module released to CPAN! Cro::HTTP (0.8.3) by 03JNTHN | |||
New module released to CPAN! Cro::Core (0.8.3) by 03JNTHN | |||
New module released to CPAN! ValueType (0.0.2) by 03ELIZABETH | |||
tyil | seems like kicking them helps | ||
nntp one is easy to fix by letting it die when it encounters an issue, so it'll restart itself | 13:29 | ||
as for the rsync service, I'll need to take a moment to figure out a prettier way | |||
13:29
mowcat joined
|
|||
tyil | if that restarts, it does a full rsync of all modules, which is a lot of data to do fi its not strictly necessary | 13:30 | |
13:34
Altai-man_ joined
|
|||
lizmat | ack | 13:36 | |
cpan-raku | New module released to CPAN! ValueType (0.0.1) by 03ELIZABETH | 13:37 | |
13:37
sena_kun left,
abraxxa left
13:41
__jrjsmrtn__ joined
13:42
_jrjsmrtn left
13:43
mowcat left
|
|||
rypervenche | How do you all normally work on your modules and test them after changes made to them? I'm currently pushing to master on a git repo and then zef installing it each time, which is not ideal. Not sure how to use a different branch, but even then, it would be nice to just be able to use the module right away. I'm guessing 'use lib "lib"' and have to be in that directory or hardcode the directory there | 13:46 | |
and just exclude it from my repo? I'm curious how others do it. | |||
13:53
mensvaga joined
|
|||
lizmat | zef install . | 13:56 | |
13:57
Doc_Holliwould joined
|
|||
lizmat | but failing that, "use lib 'lib'" when in the repo | 13:57 | |
or other various ways of doing that, like PERL6LIB=lib ? | |||
afk& | |||
rypervenche | Ahh, didn't realize I could zef install . I'll go with that and --force-install. | 14:03 | |
Altreus | I find I'm accidentally "activating" latent behaviour when I try to debug stuff | 14:04 | |
Either I'm causing blocks on incomplete promises or, in this case, accidentally activating an Object::Delayed | |||
Any tricks to make this easier? | 14:05 | ||
I'm just using say because I'm lazy | |||
14:12
NODE left
14:15
molaf left
14:16
xNetX0 joined
14:19
gabiruh joined
14:23
xNetX0 is now known as NODE,
titsuki left
14:34
Doc_Holliwould left
|
|||
uzl[m] | rypervenche: You can use the -I flag followed by where the module is located (e.g., `raku -Ilib my-script.raku`). Alternatively, you can use RAKULIB/PERL6LIB (e.g., `RAKULIB=lib raku my-script.raku`) as lizmat suggests. This way you don't need to be installing your module after every minor change. | 14:48 | |
14:48
heth left
|
|||
rypervenche | Sounds good. Thanks for the advice. | 14:49 | |
14:50
heth joined
|
|||
uzl[m] | Np! | 14:52 | |
14:56
vike left
15:02
vike joined
|
|||
leont | m: say roundrobin([1, 2], [3, 4]); say roundrobin([1, 2]);' | 15:02 | |
evalable6 | (exit code 1) 04===SORRY!04=== Er… | ||
leont, Full output: gist.github.com/e0f4793310da9fbdf9...0b5a9598cc | |||
leont | m: say roundrobin([1, 2], [3, 4]); say roundrobin([1, 2]); | 15:03 | |
evalable6 | ((1 3) (2 4)) ((1 2)) |
||
leont | That second result is very surprising to me | ||
I would have expected (1), (2) | |||
15:08
patrickb joined
|
|||
guifa | leont: that NaN != NaN but NaN === NaN isn’t a bug | 15:08 | |
uzl[m] | m: say roundrobin [1, 2], [] | ||
evalable6 | ((1) (2)) | ||
guifa | You need to use === to test that something is, well, not a number | ||
uzl[m] | leont: ^ It seems you must provide a list of lists so they can be zipped up. Even if one of them is an empty list as in this case. | 15:09 | |
guifa | Because === checks for identity | 15:10 | |
== checks for value, and in that sense, it should return false: NaN can be obtained from a variety of different operations, and it’s Not Safe™ to assume the values are equal | |||
leont | uzl[m]: that doesn't make sense | 15:11 | |
I can see what it does, but why would we want it to do this? | 15:12 | ||
uzl[m] | leont: What I gather is that with a single list, roundrobin has nothing to zip it up with so it just returns a list containing the list itself. | 15:13 | |
guifa | It’s not returning the list itself | 15:19 | |
15:20
patrickz joined
|
|||
guifa | m: my @a = [1,2]; say @a.WHAT; say roundrobin(@a).WHAT | 15:20 | |
evalable6 | (Array) (Seq) |
||
guifa | m: my @a = [1,2]; say @a.WHAT; say roundrobin(@a).head.WHAT | 15:21 | |
evalable6 | (Array) (List) |
||
guifa | It gathers the first element of each iterable it’s passed, and puts it into a list. Then it grabs the second element, etc. Then it returns a Seq of lists | ||
The idea of roundrobin is that the lists don’t need to be equal | 15:22 | ||
If you do (1,2) Z (3,4,5), the 5 disappears: | |||
m: say (1,2) Z (3,4,5) | |||
evalable6 | ((1 3) (2 4)) | ||
guifa | Roundrobin takes the first elements, then the second ones, and so on. But if a value doesn’t exist at that index, it just ignores it: | 15:23 | |
m: say roundrobin (1,2,3), (10,20), (100,200,300,400) | |||
evalable6 | ((1 10 100) (2 20 200) (3 300) (400)) | ||
guifa | leont uzl[m] ^^ hope that helps | 15:25 | |
leont | Not really | ||
(not to be ungrateful for your effort) | |||
uzl[m] | guifa: thanks. It cleared up some things up. | 15:28 | |
guifa | Actually wait | 15:30 | |
leont’s not entirely wrong. I think this is a case of the single argument rule. | |||
m: say roundrobin( [1,2] ); say roundrobin( [3,4], ) | 15:31 | ||
evalable6 | ((1 2)) ((3 4)) |
||
guifa | m: say roundrobin( (1,2) ); say roundrobin( (3,4), ) | ||
evalable6 | ((1 2)) ((3 4)) |
||
guifa | nm ignore me | 15:32 | |
I actually now agree that leont found a bug. It SHOULD be ((1),(2)) and ((3),(4)) | 15:34 | ||
15:36
sena_kun joined
15:37
Altai-man_ left
|
|||
guifa | I’m fairly certain it’s a single argument rule issue that’s causing it. The definition is sub rr (+lol) and that’s getting passed onto to Rakudo::Iterable::RoundrobinIterables | 15:38 | |
15:39
titsuki joined
|
|||
guifa | That means that when you do (1,2),(3,4), you get lol = first item (1,2), and second item (3,4). But if you do rr([1,2]) you get lol = first item 1, second item 2. And then RR’s behavior is correct to give first item of 1 (which is 1) and first item of 2 (which is 2) in a list, as the first item of the sequence | 15:40 | |
15:41
Redfoxmoon joined,
Redfoxmoon left,
Redfoxmoon joined
|
|||
guifa | (lol = list of lists, not the more typical ha) | 15:43 | |
Here’s a way to force it down: | 15:47 | ||
m: my @a = 1,2,3; say roundrobin(@a); my @b = @a,; say roundrobin(@b) | |||
evalable6 | ((1 2 3)) (([1 2 3])) |
||
guifa | of course now it’s interpretting the array as a single scalar element. *sigh* | 15:48 | |
leont | I don't think I've encountered a + sigil before… | ||
guifa | it’s a slurpy | ||
*@a = flatten all iterables into one. **@a = don’t flatten them. +@a = same as **@a, but if there’s only one argument, then flatten it | 15:50 | ||
guifa heads to $day-job | 15:52 | ||
16:10
wamba joined
16:16
patrickz left
|
|||
Altreus | How do I call the default constructor from a subclass? Is there a super keyword? | 16:19 | |
Previously I've called the method on the parent class I want to use it from | 16:21 | ||
mst | Altreus: what are you trying to achieve? | ||
why bother overriding the constructor when you have BUILD and TWEAK | |||
16:22
aluaces left
|
|||
Altreus | I'm trying to reshape the args, because most of them are actually for constructing a property | 16:22 | |
But I did change my mind halfway through | |||
so I will try BUILD and see if it works correctly | 16:23 | ||
mst | I would say 90% likelihood you wanted BUILD in that case | 16:24 | |
BUILD in raky is sort of a combination of BUILDARGS and slot population | |||
Altreus | typo or nickname? :P | 16:28 | |
mst | tupo | ||
16:42
wamba left
16:45
Doc_Holliwood joined
16:55
mowcat joined
17:20
reach_satori joined
17:29
aluaces joined
17:34
Altai-man_ joined
17:36
Kaiepi left
17:37
sena_kun left
17:38
zingzhang joined
17:40
Altai-man_ left
17:41
sena_kun joined,
foo222 joined
17:43
mochan32 joined
17:44
foo222 left
17:46
mochan joined
17:48
aluaces left
|
|||
mochan | Just learning raku. I have a question. Why does the program | 17:49 | |
my $a=3;say $a while $a-- .Int | |||
evalable6 | 2 1 0 |
||
mochan | works and prints three numbers, while the program | 17:50 | |
my $a=3;say $a while $a-- | |||
evalable6 | 2 1 0 |
||
mochan | loops without stopping | ||
leont | It does stop, as shown above by evalable6 | 17:51 | |
17:51
sena_kun left
|
|||
mochan | Sorry. Your are right. I must have made some error yesterday with a similar example. I'll try to recover it. | 17:52 | |
17:52
sena_kun joined
|
|||
lizmat | mochan: if you do things more declarative, it makes it harder to make mistakes | 17:53 | |
m: .say for 2...0 | |||
evalable6 | 2 1 0 |
||
leont | Yes, more declarative code is generally a good idea | 17:59 | |
mochan | I found it. my $a=3; $a.say while {--$a} | 18:00 | |
I guess the braces are wrong. But I expected the block to yield the new value of $a. Actually, $a doesn't change during the infinite iteration. | 18:01 | ||
lizmat | mochan: that's a postfix "while" | 18:08 | |
and a block is true when evaluated as a Bool | |||
so your code effectively says: | |||
my $a=3; $a.say while True | |||
18:09
sarna left
|
|||
lizmat | and that indeed, will only stop when you make it stop | 18:09 | |
18:09
sarna joined,
titsuki left
|
|||
mochan | Ok. Thanks! | 18:10 | |
{ 0 }.Bool returns True, but { 0 } returns 0! | 18:12 | ||
18:12
zingzhang2 joined
|
|||
mochan | (do { 0 }).Bool returns False. | 18:13 | |
18:13
matiaslina left,
uzl[m] left
|
|||
jnthn | Only because a block at statement level is immediately evaluated; this is not true in general. | 18:13 | |
m: my $a=3; $a.say while do {--$a} | |||
evalable6 | 2 1 |
||
18:15
zingzhang left
18:18
mochan32 left
18:21
pecastro left
18:25
matiaslina joined
18:31
cfa joined
18:32
Kaiepi joined
|
|||
cfa | o/ | 18:32 | |
18:33
uzl[m] joined
18:38
clarjon1 joined
18:58
patrickb left
19:07
wildtrees joined
19:08
wildtrees left,
wildtrees joined
|
|||
cfa | leont: ah, that signal snippet is handy; thanks | 19:11 | |
it's a shame that it's necessary though | |||
leont | I perhaps should make it a module | 19:12 | |
cfa | yeah | ||
leont | (with an unless Windows around it) | 19:14 | |
Not sure yet what to call it | |||
What does it say about me that I have 3 consecutive lines with a map in them :-p | 19:20 | ||
19:23
sauvin left
19:24
chloekek joined
19:25
pecastro joined
|
|||
guifa | leont: that you like functional programming lol | 19:31 | |
19:35
Altai-man_ joined
19:38
sena_kun left
19:39
Kaiepi left
19:40
Kaiepi joined
19:47
chloekek left
19:56
TheAthlete joined
|
|||
TheAthlete | Hello! | 19:57 | |
Where can I find the source code of IO:: Socket::Async | |||
cfa | github.com/rakudo/rakudo/blob/mast.../Async.pm6 | 19:59 | |
TheAthlete | Thanks a lot! | 20:00 | |
cfa | TheAthlete: np | ||
leont | You could have asked for a simpler piece of code though | 20:03 | |
Any particular problem you're hitting? | 20:04 | ||
20:05
lucasb left
|
|||
TheAthlete | There are no problems at the moment. I just want to see how the module works from the inside. | 20:07 | |
leont | Much of it is actually implemented in C, hence all the nqp | 20:08 | |
20:15
zingzhang2 left
20:24
domidumont joined
20:27
Itaipu left
20:28
Itaipu joined
20:34
TheAthlete left
20:36
domidumont left
|
|||
cpan-raku | New module released to CPAN! Gnome::Gio (0.2.0) by 03MARTIMM | 21:08 | |
21:19
mensvaga left
21:27
aluaces joined
21:36
sena_kun joined
21:38
Altai-man_ left,
mochan left
21:52
rindolf left
22:20
sno left
22:21
Itaipu left
22:22
sno joined
22:35
Itaipu joined
22:37
Exodist left
22:38
Exodist joined
22:40
Itaipu left
22:41
Itaipu joined
22:44
Black_Ribbon joined
22:50
wamba joined
22:56
wildtrees left
22:58
wildtrees joined
23:35
Altai-man_ joined
23:37
sena_kun left
23:41
cognomin_ joined
23:45
cognominal left
23:55
aborazmeh joined,
aborazmeh left,
aborazmeh joined
|