»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋 Set by Zoffix on 25 July 2018. |
|||
holyghost | I have a risk function in Bayes::Learn | 00:15 | |
00:19
ctilmes left,
ctilmes joined
|
|||
holyghost | It calculates loss on a conditional probability (on a decision, the cond p) | 00:24 | |
00:28
zachk left
00:53
w_richard_w joined
00:54
zacts joined
00:59
zacts left
|
|||
ugexe | Xliff: now that i think about it im not sure the optimal build order trick even works anymore since the hash randomization | 00:59 | |
01:05
aborazmeh joined,
aborazmeh left,
aborazmeh joined
|
|||
Xliff | ugexe: For CURI? | 01:05 | |
ugexe: That's OK, since I also use it for stats tracking. | |||
01:10
Kaiepi left
01:13
Kaiepi joined
01:16
lucasb left
01:23
MasterDuke joined
01:24
MasterDuke left,
MasterDuke joined
01:31
DarthGandalf left
01:32
buffet_ joined,
khisanth_ left
01:33
buffet left
01:40
_jrjsmrtn joined,
__jrjsmrtn__ left
01:46
khisanth_ joined
01:52
aborazmeh left
|
|||
cpan-p6_ | New module released to CPAN! Bayes::Learn (0.2.3) by 03HOLYGHOST | 01:55 | |
holyghost | ^-- risk functionality is in | 01:57 | |
01:57
epony left
02:26
Sgeo__ joined
02:29
Sgeo_ left
02:45
adu joined
|
|||
discord6 | <Tyler (Aearnus)> aearnus.github.io/2019/04/08/gadts-in-perl-6 | 02:48 | |
03:13
Cabanossi left,
Cabanossi joined
03:18
epony joined
03:24
netrino left
03:40
DarthGandalf joined
03:53
jeromelanteri joined
04:17
kurahaupo left,
kurahaupo joined
04:27
hamhu3 left,
hamhu3 joined
04:33
zacts joined
04:46
jaldhar joined
|
|||
Xliff | Tyler: I almost smell Python in that post. :) | 04:52 | |
04:53
jaldhar_ joined
04:54
jaldhar left
05:07
isomorphismes left
05:09
isomorphismes joined
05:10
grumble left
05:16
grumble joined
05:17
zacts left
05:18
zacts joined
05:24
robertle left
05:25
Sgeo_ joined
05:27
zacts_pi joined
05:28
Sgeo__ left,
zacts left
|
|||
holyghost | If I do not continue on Bayes::Learn tomorrow, I might write the start of the docs for it or the audio effects of Soundn::Tina (which is not yet published IIRC) | 05:34 | |
05:34
sauvin joined
05:36
zacts_pi is now known as zacts
|
|||
holyghost | Soundn::Tina is command line sound software based on WAV files | 05:36 | |
e.g. mixing | |||
of samples | 05:37 | ||
not music itself | |||
05:37
jeromelanteri left
05:45
MidCheck left
05:46
cpan-p6_ left
05:47
cpan-p6 joined,
cpan-p6 left,
cpan-p6 joined
05:54
vrurg left,
kurahaupo left
05:55
kurahaupo joined
|
|||
Elronnd | can perl6-j interface with java? | 05:56 | |
06:06
Sgeo joined
|
|||
Xliff | You would have to look into the jvm backend to know for sure. | 06:08 | |
06:08
zacts left,
Sgeo_ left
|
|||
holyghost | As I comprehend 'interface', there's probably class files (I develop on Moar) but no inline code | 06:09 | |
06:10
hamhu3 left
|
|||
holyghost | Learn java bytecodes I guess :-) | 06:11 | |
I read that document from Sun back in the day | |||
Xliff | Elrond: www.slideshare.net/tokuhirom/perl6-meets-jvm -- see slide 78 | ||
discord6 | <Tyler (Aearnus)> > <holyghost> Learn java bytecodes I guess :-) aphyr.com/posts/341-hexing-the-tec...-interview | 06:12 | |
holyghost | ^-- it's a helper bot ? | 06:13 | |
Xliff | tl;dr: use java::util::zip::CRC32:from<java>; my $crc = CRC32.new(); $crc.update($_) for 'Hello, Java'.encode('utf-8'); $crc.getValue.say | ||
For jar files... | 06:14 | ||
use MyClass:from<java>:jar<myjar.jar> | |||
holyghost | thanks Xliff, so there's some form of inline code :-) | ||
Xliff | This is from YAPC 2016 | 06:15 | |
Elronnd | Xliff: neat! Thanks! | ||
Xliff | Elronnd: yw | 06:28 | |
06:35
hamhu3 joined
06:38
hamhu3 left
06:39
hamhu3 joined,
khisanth_ left
06:47
domidumont joined
06:56
abraxxa joined
|
|||
Geth | doc: fb1dbc99aa | (JJ Merelo)++ | doc/Language/enumeration.pod6 Minor changes |
06:57 | |
synopsebot | Link: doc.perl6.org/language/enumeration | ||
07:07
khisanth_ joined
07:18
rindolf joined
07:26
adu left
07:30
robertle joined
07:35
eseyman left
07:36
isomorphismes left
07:37
isomorphismes joined
07:41
Cabanossi left
07:46
Elronnd left,
patrickb joined
07:49
Cabanossi joined
07:50
scimon joined
07:54
elronnd joined
07:55
Voldenet left
08:01
Voldenet joined,
Voldenet left,
Voldenet joined
08:03
w_richard_w left
08:10
MidCheck joined
08:11
ravenousmoose_ joined
08:12
isomorphismes left
08:14
ravenousmoose left
08:15
zakharyas joined
08:23
elronnd is now known as Elronnd
08:26
dakkar joined
08:44
isomorphismes joined
|
|||
patrickb | m: class P {has $.x = 0; submethod BUILD() { $!x }}; say P.new(x=>5).perl | 09:08 | |
evalable6 | P.new(x => Any) | ||
patrickb | m: class P {has $.x = 0; submethod BUILD() { #`[$!x] }}; say P.new(x=>5).perl | ||
evalable6 | P.new(x => 0) | ||
patrickb | Is the above a bug? | ||
How is accessing a variable even able to have any effect in the above code? | |||
moritz | having a BUILD submethod disables the automatic setting of attributes | 09:11 | |
LTA, but unavailable, I've been told | 09:12 | ||
09:13
cpan-p6 left
09:14
cpan-p6 joined,
cpan-p6 left,
cpan-p6 joined
09:15
TreyHarris left
09:17
sena_kun joined
|
|||
patrickb | moritz: But both of the above examples have a BUILD submethod. Both are not initialized with the passed variable. I understand that. | 09:19 | |
moritz: My question is why in one of the two above the default is not set. | |||
Or why it is set in the other. I would expect the two to behave the same. | 09:20 | ||
moritz | yes, that's weird, might be a bug | 09:22 | |
patrickb | I'll rakudobug. | ||
Out of curriosity: Is it even possible in Perl 6 to determine whether a variable has been accessed before or not? | 09:23 | ||
The above code behaves in such a way. I wouldn't even know how to implement such behavior... | 09:24 | ||
moritz: Thanks for your help! | 09:25 | ||
09:30
buffet_ is now known as buffet
09:32
TreyHarris joined
|
|||
patrickb | bisectable6: class P {has $.x = 0; submethod BUILD() { $!x }}; say P.new(x=>5).perl | 09:33 | |
bisectable6 | patrickb, On both starting points (old=2015.12 new=dc02335) the exit code is 0 and the output is identical as well | ||
patrickb, Output on both points: «P.new(x => Any)» | |||
patrickb | bisectable6: class P {has $.x = 0; submethod BUILD() { #`[$!x] }}; say P.new(x=>5).perl | ||
bisectable6 | patrickb, On both starting points (old=2015.12 new=dc02335) the exit code is 0 and the output is identical as well | ||
patrickb, Output on both points: «P.new(x => 0)» | |||
jnthn | patrickb: So far, that's been implemented by having touching an attribute vivifying it; the fact there's then an object there rather than a NULL (used as a sentinel) is used to provide the "is this initialized" test | 09:35 | |
Even an assignment is actually a case of read/vivify the Scalar container, then assign into it | 09:37 | ||
09:38
rindolf left
|
|||
jnthn | However...this approach has its issues. One is that which you've noticed. Another is that it doesn't work for native attributes since those can't be NULL. And another, which will probably actually motivate change, is that having every attribute access have to be NULL-checked and reacted to massively bloats our JIT-compilation output. | 09:38 | |
The question is what to do instead | 09:39 | ||
And that will have minimal fallout on existing code | |||
09:39
DarthGandalf left
|
|||
patrickb | I'd say either initialize attributes to default values before BUILD is called (then build can overwrite if wanted, but still have default initialization), or just don't touch attributes at all of a BUILD is found. | 09:41 | |
jnthn | Well, the first thing you just described is exactly the behavior of TWEAK :) | 09:42 | |
The second is a possibility, but would probably cause extensive breakage | |||
patrickb | I'm still in the process of wrapping my head around how object construction works, so take my opinions as a perspective from the outside. :-) | 09:44 | |
09:50
rindolf joined
09:51
Black_Ribbon left
|
|||
patrickb | I added this conversation to the ticket github.com/rakudo/rakudo/issues/2832 | 09:53 | |
jnthn: Thanks for the extensive explanation! | 09:55 | ||
timotimo | jnthn: how well could it work to log whether a scalar had to be vivified in the spesh log and if we don't see that ever, we make a null check cause a deopt rather than vivifying? that could make the jit output smaller perhaps? or do we already just call out to a C function when we realize we'd have to vivify? | 09:56 | |
jnthn | patrickb: that the spesh log exists isn't a Perl 6 level thing; we'd need a solution that'll work on JVM and JS and so on too | 10:00 | |
patrickb | timotimo: ^ That's for you. | ||
jnthn | And doing a deopt in every BUILD method is not going to go so well performance wise ;) | 10:01 | |
oh, that wasn't quite what you suggested | |||
But anyway, the code sequence for a deopt is not zero-length either :) | |||
I sometimes wonder if we can just keep a bit field of what we initialized, and compile attribute access inside of a BUILD to tweak the bit field too | 10:02 | ||
Xliff | Why is evalable6 so shy. Priv message and he says "It's too private in here" | ||
m: my $a = -> $a, $b { }; say $a.signature | 10:03 | ||
evalable6 | ($a, $b) | ||
jnthn | I think to keep people from abusing it | ||
Xliff | m: my $a = -> $a, $b { }; say $a.signature.arity | ||
evalable6 | 2 | ||
Xliff | OK. That will work for a start. | 10:04 | |
Trying to think ahead of a problem, for once. | |||
m: my $a = -> $a, $b { }; say $a.signature.params | |||
evalable6 | (Mu $a Mu $b) | ||
Xliff | Niice. | ||
patrickb | Xliff: perlbot seems to do the job: /msg perlbot r: my $a = -> $a, $b { }; say $a.signature.params | 10:05 | |
Xliff | Yah.. but that "r:".... *shudder* =) | ||
Thanks, patrickb | |||
patrickb | :-P | ||
Xliff | m: my $a = -> $a, $d { }; $a.signature.params[0].type.say | 10:06 | |
evalable6 | (Mu) | ||
Xliff | Also... perlbot has a noticeable delay as opposed to evalable6. | ||
Beggars can't be choosy, though. | 10:07 | ||
10:08
domidumont left
10:19
gregf_ joined
|
|||
timotimo | Xliff: i think you can go to #whateverable and eval loads of stuff there | 10:24 | |
10:30
dakkar left
|
|||
Xliff | timotimo++ | 10:31 | |
Now to go ZZzzzz | 10:32 | ||
10:42
dakkar joined
10:47
xenowoolfy joined
10:52
xenowoolfy left
11:08
AlexDaniel left
11:11
zakharyas left
11:21
kensanata joined
|
|||
Xliff | \o/ | 11:22 | |
WTF is a **@list?? | |||
Xliff said sleep. He LIED! | |||
timotimo | it'll not flatten unlike *@list | 11:23 | |
Xliff | Wouldn't that be @list? | ||
Or is that still "Slurpy, but do not flatten" | 11:24 | ||
timotimo | right | ||
there's also +@list, which is "do single-argument-rule semantics" | |||
i.e. if only one list gets passed, that becomes what's passed, otherwise things will be slurpy-flattened | |||
tyil | if I remember correctly, there was an experimental module which allowed one to do grammar testing/debugging in a GTK window | 11:41 | |
if anyone knows what I'm talking about, could you please give me a link to it | 11:42 | ||
timotimo | aye, it's Xliff's | ||
github.com/Xliff/p6-VisualGrammar | 11:43 | ||
tyil | sweet | ||
thanks timotimo :D | |||
timotimo | NP | ||
rakudo will take many, many minutes to precompile the gtk module that goes with it, though | 11:44 | ||
tyil | that's not a problem, I remembered it would take a while, and I want to try some grammar stuff tomorrow | 11:48 | |
so I wanted to prepare for that in advance | |||
timotimo | OK, cool | ||
11:49
aborazmeh joined,
aborazmeh left,
aborazmeh joined
11:56
xenowoolfy joined
11:58
xenowoolfy left
12:11
araraloren joined
12:15
pistacchio left
|
|||
tyil | Xliff: github.com/Xliff/p6-VisualGrammar/issues/1 does this show enough information for you to work with? | 12:23 | |
12:25
robertle left
12:27
robertle joined
12:31
netrino joined
12:38
DarthGandalf joined
12:46
Kaiepi left
12:47
Kaiepi joined
12:49
MasterDuke left
13:00
MidCheck left
13:03
zakharyas joined
13:12
Kaiepi left,
aborazmeh left
13:16
Kaiepi joined
13:19
vrurg joined
13:23
rindolf left,
kurahaupo_ joined
13:25
rindolf joined
13:27
kurahaupo left
13:30
zacts joined
13:38
Kaiepi left
13:40
Kaiepi joined,
skids joined
13:41
zacts left
14:01
demanuel left
|
|||
Kaiepi | m: say Array[Int].^parameterize(Str) ~~ [1] | 14:02 | |
evalable6 | True | ||
Kaiepi | m: say Array[Int].^parameterize(Str) ~~ ['a'] | ||
evalable6 | True | ||
Kaiepi | m: say Array[Int].^parameterize(Str) ~~ ['a', 1] | ||
evalable6 | True | ||
Kaiepi | m: say (Array[Int].^parameterize(Str)).^name | 14:03 | |
evalable6 | Array[Int][Str] | ||
Kaiepi | m: say Array[Int][Str] | 14:04 | |
evalable6 | (exit code 1) Use of Nil in string context in block <unit> at /tmp/RhPnbZTcZt line 1 Unable to call postcircumfix [ (Str) ] with a type object Indexing requires a defined object in block <unit> at /tmp/RhPnbZTcZt line 1 |
||
14:27
MilkmanDan left
14:29
MilkmanDan joined
|
|||
El_Che | sena_kun: yes? | 14:32 | |
sena_kun | El_Che, o/ | 14:33 | |
El_Che | hello | ||
sena_kun | I've started to flesh out client's api for LDAP, so thought I can ping you for some suggestions or maybe ideas about how wrong/okayish it seems. | ||
see github.com/Altai-man/cro-ldap/blob...-client.md | |||
yes, not all methods are filled out yet | 14:34 | ||
El_Che | ah nic | ||
e | |||
the react example is nice | |||
sena_kun | right now I rely heavily on old Net::LDAP in terms of API, which is, well, quite intuitive to me. | ||
El_Che | it is | 14:35 | |
sena_kun | but I don't know its issues or maybe some papercuts, as I've never used it | ||
El_Che | partly becasue the lack of types maybe | ||
sena_kun | so if there are things we can do better because we start from scratch, I'd like to do it | ||
El_Che | sena_kun: it's main issue is that it looks abandonned to me | ||
14:36
powerbit left
|
|||
El_Che | yes, make it as perl6-y as possible, imho | 14:36 | |
sena_kun | El_Che, can you put up a small review/list of ideas or something like this based on the docs? maybe into a gist or just a ticket | ||
El_Che | I'll make a not to have a look at it | ||
e | |||
if there is code available I would like to write a small samble program | 14:37 | ||
sena_kun | I am now struggling with some ASN::META re-design to handle recursive search filters, and once this bootstrapping is done, I'd be able to continue with the client by the docs. | ||
El_Che | ok | 14:38 | |
oh, have a look at extended operations, also "relax" | |||
sena_kun | El_Che, well, API and the actual implementation _are_ different right now... What works is in the tests, see github.com/Altai-man/cro-ldap/blob...4-client.t | ||
El_Che | many libs out there in many languages miss that | ||
sena_kun | yes, saw that, well... we'll see once basic stuff like search/update/bind will be in place. | 14:39 | |
El_Che | I have this example fresh in mind, because I migrated it to new code yesterday: | ||
sena_kun | yes, code examples of existing code are very welcome | 14:40 | |
El_Che | look for changes in sambaPwdLastSet (is set by our IAM system) and change pwdLastSet accordingly | ||
the latter is an operational attribute, so you're not allowed to change it without extending operations | |||
maybe I can give you some p5 code | 14:41 | ||
sena_kun | El_Che, can you share the code? yes, even p5 will do. | ||
El_Che | I will look it up | ||
I actually migrated the setup to a tailer of the audit_db.log, so a modify is done when a match is found by... regex | 14:42 | ||
don't shoot me :) | |||
but I want a fallback to query the db and do mass modifies just to be sure | |||
sena_kun | El_Che, I am only interested in LDAP-related parts as I am implementing it and literaly have no experience with its usages in real world(and in imaginary worlds too), so... | 14:43 | |
El_Che | first part is generic (pricipal task is sending REST calls from ldap events in the logs), so not interesting to you | ||
I'll look the 2nd part up, as an example of a relaxed operation | |||
because the tailer works that well, I haven't had the need to do the mass live db update yet | 14:44 | ||
but I will recover the code, make it standalone and working | |||
should'nt be too much work | |||
it's a typical real world scenario for me | 14:45 | ||
sena_kun looks up Net::LDAP::Control::Relax | |||
14:47
kurahaupo_ left,
kurahaupo joined
14:49
unclechu joined
|
|||
unclechu | hey guys, please remind me, is there any way to mark subroutine argument as a constant? | 14:50 | |
14:50
TeamBlast left
|
|||
unclechu | i tried something like `Int \foo` but it didn't work | 14:50 | |
moritz | they are by default | ||
14:50
Kaiepi left
|
|||
moritz | m: sub f(Int $x) { $x = 42 }; my $a = 23; f($a) | 14:50 | |
evalable6 | (exit code 1) Cannot assign to an immutable value in sub f at /tmp/ZceuKuJhns line 1 in block <unit> at /tmp/ZceuKuJhns line 1 |
||
araraloren | m: sub f(Int \x) { x = 42 }; my $a = 23; f($a) | 14:51 | |
evalable6 | |||
moritz | however, note that this doesn't go deep into objects. If you pass a hash for example, you can still modify the hash itself, just not assign to the variable | ||
well, not with \ | |||
araraloren | m: sub f(Int $x is raw) { $x = 42 }; my $a = 23; f($a) | 14:52 | |
evalable6 | |||
moritz | don't use it if you want it read-only | ||
araraloren | so what's the `is raw` doing ? | ||
14:52
TeamBlast joined
|
|||
moritz | docs.perl6.org/type/Parameter#method_raw | 14:53 | |
14:54
Kaiepi joined
|
|||
araraloren | what's the difference between the \x in argument list and the declaration `my \x = 22;` | 14:57 | |
m: my \x = 22; x = 42; | |||
evalable6 | (exit code 1) Cannot modify an immutable Int (22) in block <unit> at /tmp/0zKP8UrsNV line 1 |
||
moritz | that's the difference | ||
araraloren | oh wait | ||
m: my $z = 22; my \x = $z; x = 42; | 14:58 | ||
evalable6 | |||
araraloren | I get it :) | ||
unclechu | moritz: thanks | 15:01 | |
15:15
Kaiepi left
15:16
Kaiepi joined
15:21
hamhu3 left
15:23
hamhu3_ joined
15:27
hamhu3_ left
15:28
hamhu3 joined
15:29
patrickb left
15:30
vrurg left
15:33
vrurg joined
15:35
kensanata left,
vrurg left
15:36
vrurg joined
15:39
MidCheck joined
15:45
domidumont joined
15:47
robertle left
|
|||
unclechu | what do i usually do when i want to return few values of different types from a subroutine? | 16:02 | |
jnthn | Just return them? `return $foo, $bar, $baz;` doesn't care about their types in any sense. I often find it better to declare a small class to hold the values, though. | 16:05 | |
sena_kun | 1)wrap in a list; 2)create a class | ||
unclechu | jnthn: does it mean you return them as a list? | 16:06 | |
jnthn | Yes | ||
m: sub foo() { return 1,"foo",3 }; my ($a, $b, $c) = foo(); .say for $a, $b, $c | |||
evalable6 | 1 foo 3 |
||
unclechu | jnthn: sena_kun: thanks | 16:09 | |
Kaiepi | m: sub foo(Array[Str] @a) { @a }; say foo [1,2,3] | 16:18 | |
evalable6 | (exit code 1) Type check failed in binding to parameter '@a'; expected Positional[Array[Str]] but got Array ($[1, 2, 3]) in sub foo at /tmp/8CS9k5sz_9 line 1 in block <unit> at /tmp/8CS9k5sz_9 line 1 |
||
Kaiepi | m: sub foo(@a where Array && *.^parameterize(Str)) { @a }; say foo [1,2,3] | 16:19 | |
evalable6 | [1 2 3] | ||
Kaiepi | finally found a solution for a quirk that's been annoying the shit out of me for ages but it's awkward | ||
jnthn | What does that solve? | 16:20 | |
araraloren | m: sub foo(Str @a) { @a }; say foo [1,2,3] | 16:21 | |
evalable6 | (exit code 1) Type check failed in binding to parameter '@a'; expected Positional[Str] but got Array ($[1, 2, 3]) in sub foo at /tmp/19m8jtHZCD line 1 in block <unit> at /tmp/19m8jtHZCD line 1 |
||
Kaiepi | it makes it so i can type function parameters without having to type the arguments passed | ||
jnthn | sub foo(@a where Array && *.^this-never-runs-i-think { @a }; say foo [1,2,3] | ||
m: sub foo(@a where Array && *.^this-never-runs-i-think { @a }; say foo [1,2,3] | |||
evalable6 | (exit code 1) 04===SORRY!04=== Error while compiling /tmp/evlqy2COy3 Unexpec… |
||
jnthn, Full output: gist.github.com/8014b0886f753c9f6d...ace3873039 | |||
Kaiepi | specifically parameterizable parameters | ||
jnthn | m: sub foo(@a where Array && *.^this-never-runs-i-think) { @a }; say foo [1,2,3] | ||
evalable6 | [1 2 3] | ||
Kaiepi | oh | ||
jnthn | That code is equivalent to @a where Array && True | 16:22 | |
araraloren | interesting | ||
jnthn | Since *.foo is a lambda, and defined, and definedness is the default True | ||
I think what you're looking for is | |||
m: sub foo(@a where .all ~~ Int) { @a }; say foo [1,2,3] | |||
evalable6 | [1 2 3] | ||
jnthn | Or some such | ||
16:22
dogbert17 left
|
|||
Kaiepi | ohhh | 16:22 | |
i keep forgetting about junctions | 16:23 | ||
jnthn | m: sub foo(@a where .all ~~ Int) { @a }; say foo [1,'x',3] | ||
evalable6 | (exit code 1) Constraint type check failed in binding to parameter '@a'; expected anonymou… | ||
jnthn, Full output: gist.github.com/26ce837ed46a9b89e3...fbdb7bbd6d | |||
araraloren | night #perl6 | 16:25 | |
16:25
araraloren left
|
|||
Kaiepi | m: subset Foo where .all ~~ Int; use nqp; say nqp::getattr(Foo.HOW, Metamodel::SubsetHOW, '$!refinement') | 16:25 | |
evalable6 | -> ;; $_ { #`(Block|94358661318128) ... } | ||
Kaiepi | m: my constant Foo = Metamodel::SubsetHOW.new_type: :name<Foo>, :refinee(Any), :refinement({ .all ~~ Int }); sub foo(Foo @a) { @a }; say foo [1,2,3] | 16:26 | |
evalable6 | (exit code 1) Type check failed in binding to parameter '@a'; expected Foo but got Array ($[1, 2, 3]) in sub foo at /tmp/bBDaCWrRhT line 1 in block <unit> at /tmp/bBDaCWrRhT line 1 |
||
jnthn | `Foo @a` means `Positional[Foo]`; you'd need to use a Scalar or \ parameter there to have the `Foo` apply to all of it | ||
And set the refinee to List or some such | 16:27 | ||
Kaiepi | m: subset Foo where .all ~~ Int; use nqp; say nqp::getattr(Foo.HOW, Metamodel::SubsetHOW, '$!refinement')() | ||
m: subset Foo where .all ~~ Int; use nqp; say nqp::getattr(Foo.HOW, Metamodel::SubsetHOW, '$!refinement')([1,2,3]) | |||
16:27
Kaiepi left
|
|||
evalable6 | (exit code 1) Too few positionals passed; expected 1 argument but got 0 in block <unit> at /tmp/6SgTYV_L5o line 1 |
16:27 | |
True | |||
jnthn | I think there's a .refinement method to save the getattr :) | 16:28 | |
16:29
scimon left
16:30
Kaiepi joined
16:31
AlexDaniel joined
|
|||
tony-o | does coke still hang about in irc? | 16:33 | |
sena_kun | tony-o, no, but you can send him an e-mail. | 16:36 | |
16:37
dakkar left
|
|||
unclechu | how do i declare block to just isolate scope of names/variables? | 16:39 | |
sena_kun | just {} | 16:40 | |
m: if True { my $a = 10; { my $a = 5; say $a; }; say $a; } | |||
evalable6 | 5 10 |
||
unclechu | ah, okay, thanks | 16:41 | |
16:45
hasuwiz joined
|
|||
hasuwiz | Good evening, #Perl6 | 16:45 | |
16:46
daemon left
|
|||
sena_kun | hasuwiz, evening. | 16:49 | |
16:52
Kaiepi left
16:53
kurahaupo left,
kurahaupo joined
16:55
Kaiepi joined
16:56
adu joined
|
|||
holyghost | I forgot the Loss function in Bayes::Learn - Action.pm6, I'll upload tomorrow | 17:12 | |
17:16
vrurg left,
vrurg joined
17:19
pukku joined
17:22
jaldhar_ left
|
|||
pukku | Hi! I just read the article at indiestack.com/2019/04/toggle-syst...cale-mode/ about using Python to automate changing a value on macOS. I thought that it should be possible to do this without Python, and I remembered that Perl 6 had some sort of native FFI system. I played around a bit, and eventually got this far: gist.github.com/remorse/1d29281cbf...7faf1a17a9 | 17:22 | |
This doesn't work, because it seems like I need to tell Perl 6 what the parameters to `UAGrayscaleSetEnabled` are, but I don't know them myself (I'm only guessing, incidentally, on the `returns int32` part for `UAGrayscaleIsEnabled`). | 17:23 | ||
Given that the Python code seems to be able to just know this, is there something that Perl 6 can do to just work? | 17:24 | ||
(Incidentally, Perl 6 doesn't seem to understand the library format of the combined library the way that Python does; I wound up having to find a `.dylib` with the right symbols, with the name `libXXX.dylib`) | 17:25 | ||
17:27
lucasb joined
|
|||
unclechu | hey guys, how do i do real parallelism, Supply::tap seems to work in single thread. | 17:34 | |
? | |||
timotimo | yes, supplies are for managing parallelism, they don't introduce any by themselves | ||
how to parallelize is very dependent on what exactly you have | 17:35 | ||
17:35
DarthGandalf left
|
|||
timotimo | like, are individual tasks completely separate, or do they share some data? is order important for something? | 17:35 | |
if your task is equivalent to just running map over a long list and no data is shared, you can just .hyper.map, perhaps specifying the size of batches that it should split the work into in the hyper method call | 17:36 | ||
unclechu | timotimo: well, Supply::throttle(4, ...) loads all my cpu cores, so it looks like it is what i'm looking for? | 17:37 | |
timotimo: no, my data is completely indedendent | |||
it's completely free to make it parallel | 17:38 | ||
timotimo | in that case hyper could be a little simpler than supply.throttle | 17:40 | |
pukku: i would blindly assume that SetEnabled takes a single int32 | |||
17:41
zakharyas left
|
|||
timotimo | it's quite strange that you don't get a single relevant search result except that post you linked to | 17:41 | |
17:42
Kaiepi left
|
|||
pukku | It's an internal, private API call, that isn't supposed to be exposed to anyone outside Apple. I'm not even really interested in it, except for seeing if Perl 6 can do something similar to Python. | 17:43 | |
That works! | |||
sena_kun | m: 1.new.say; | 17:45 | |
evalable6 | 0 | ||
unclechu | timotimo: i believe there was an operator for "hyper", like .», is it gone? | ||
sena_kun | eeeeeeh. ok, TIL, though it was obvious all along. | ||
pukku | I'm still wondering how Python can just know what is allowed, without having to be told. | ||
17:46
Kaiepi joined
|
|||
pukku | I guess, according to the documentation, that it just assumes you know what you are doing, and doesn't enforce anything. | 17:48 | |
timotimo | it still exists, but it doesn't automatically parallelize yet | ||
it's ». or >>. | |||
yes, it's quite possible that it just takes the name of the method you call and the arguments you pass and just turns them into the best equivalent for C that it knows | 17:49 | ||
17:49
MidCheck left
|
|||
unclechu | timotimo: so as hyper, it seems it's single threaded, only one cpu core is loaded for `.hyper.map` | 17:49 | |
timotimo | the default batch size is rather small. if the work is very fast, spinning up more threads would be wasteful, so it won't do it | ||
so you'd want to .hyper(batch => 10000).map(...) so it'll do 10k items from the list at once | 17:50 | ||
pukku | From the documentation "By default functions are assumed to return the C int type". | ||
Also: "ctypes tries to protect you from calling functions with the wrong number of arguments or the wrong calling convention. Unfortunately this only works on Windows. It does this by examining the stack after the function returns, so although an error is raised the function has been called. To find out the correct calling convention you have to look into the C header file or the documentation for the function you want to call." | |||
unclechu | timotimo: i think it would be better to set batch size to cpu cores count, am i right? | 17:51 | |
timotimo | no, perhaps that's the degree parameter you're thinking of | 17:52 | |
Xliff | tyil: No joy? Let me see if I can figure things. | ||
timotimo | pukku: that sounds like the calling convention used on windows leaves some data around that'll let you figure out if you were doing it right, like perhaps it inspects callee-saved registers to see if your arguments are in there or not? | 17:53 | |
gotta run for now | |||
pukku | Probably -- that rapidly passes beyond my knowledge. | ||
timotimo | calling conventions can be a fascinating read | ||
pukku | timotimo: thanks for the help! | ||
timotimo | and quite frustrating if you've got to implement them yourself | ||
17:54
bhm left
|
|||
timotimo | moarvm's jit has code to turn a list of things that want to be passed into the right instructions to place the data in registers and other places | 17:54 | |
doesn't help that even the same platform sometimes has multiple different calling conventions, like stdcall vs fastcall and i think there's also "thiscall" for C++ method calls? | |||
anyway, bbl | |||
pukku | Thanks! | 17:55 | |
ugexe | pascals triangle polyglot (not very exciting): gist.github.com/ugexe/94f0b84848ed...14a08674c7 | 17:57 | |
it did bring up the challenge of handling the difference in flattening through | |||
otherwise it could just be = (1, @foo, 1) | 17:58 | ||
not having as much luck with the hamming numbers though | 17:59 | ||
since what i can do with a hashref is limited | |||
unclechu | timotimo: well, anyway, Supply::throttle(CPU_CORES_COUNT, ...) gets best time results | ||
timotimo | OK! | 18:00 | |
18:01
lgtaube left
|
|||
ugexe | isn't that just Supply.rotor(CPU_CORES_COUNT) unless start { } is used to schedule work? | 18:02 | |
if so then its probably not too surprising its faster if its truely doing it single threaded (and your logic does not benefit from multiple threads as-is) | 18:03 | ||
unclechu | no, .hyper.map also get all cores loaded, but not that stable | 18:04 | |
ugexe | what do you mean not stable? its causing unstable results, or unstable timing? | 18:05 | |
unclechu | unstable cpu cores usage | 18:06 | |
18:06
pukku left
|
|||
unclechu | in some gaps some cores just not loaded | 18:06 | |
ugexe | because you have not presented enough work for the compiler to feel adding more threads is a benefit | ||
.map.hyper(:batch(1), :degree(4)) | 18:07 | ||
unclechu | if anyone wonders what i am doing, i'm just having fun with magic numbers: gist.github.com/unclechu/b38ce477a...9a8cb6c9d3 | ||
ugexe | er, .hyper(:batch(1), :degree(4)).map({ ... }) | 18:09 | |
unclechu | ugexe: wow thanks, now this gets best results | 18:11 | |
Kaiepi | $*KERNEL.cpu-cores is wrong on my machine | 18:12 | |
well | |||
sort of | |||
it's right about physical cores, but doesn't take into account whether they're all enabled or not | |||
unclechu | well, once, not always, i'm not sure, it needs more benchmarks to decide what would be faster | 18:14 | |
ugexe | unclechu: you would tune :batch(...) and :degree(...) until you find a size that works optimally with the work you are processing | 18:15 | |
:batch is how many each thread will get to work on before it feeds the next thread | |||
:degree is the max number of threads it will do this for | |||
18:19
lgtaube joined
|
|||
ugexe | Kaiepi: im going to take a wild guess and say there isn't a very portable way to do that | 18:20 | |
Kaiepi | i doubt it | 18:22 | |
tony-o | ugexe: i have a hamming polyglot | ||
Kaiepi | on openbsd it'd depend on whether the meltdown patch is installed | ||
tony-o | gist.github.com/tony-o/0999977b7c5...33031c988b | 18:23 | |
^ hamming numbers polyglot | 18:24 | ||
ugexe | ah cool. i was over complicating things | 18:26 | |
18:26
sauvin left
|
|||
tony-o | what was yours looking like? | 18:26 | |
Kaiepi | that reminds me, i wrote support for getting the amount of free memory and the total amount of memory available on the system a while ago but forgot to make a pullreq for it | ||
18:27
Sgeo left
|
|||
tony-o | i tried to recurse at first but couldn't recall how to polysub and was too lazy to look | 18:27 | |
ugexe | i was using a hash to index, and a hash splice to read multiple keys (2, 3, 5) | ||
hash slice^ | |||
tyil | Xliff: that error is all I got, but it doesn't exit after showing that | 18:28 | |
18:28
Sgeo joined
|
|||
tyil | and a small list of modules I had to install | 18:28 | |
Xliff | I'm working on it, right now. | 18:29 | |
tyil | thanks :> | ||
tony-o | yours probably has nicer output then mine | 18:30 | |
Xliff | I've fixed the error, but colors (aside from RED) are no longer working. | ||
tyil | hmm | ||
it's better than not working I guess :p | 18:31 | ||
18:31
domidumont left
|
|||
tyil | can I just pull and retry? | 18:31 | |
18:31
jdoege joined
|
|||
tony-o | what are you colorizing Xliff ? | 18:31 | |
Xliff | Grammar rules | 18:32 | |
github.com/Xliff/p6-VisualGrammar/.../README.md | |||
jdoege | Hi all! Is there a builting way to generate n of m permutations? so that given < 1, 2, 3> and 2 as inputs you get back ( (1,2), (1,3), (2,3) )? | ||
Xliff | ^3.comb(2) | 18:33 | |
tony-o | m ^3.comb(2).perl.say; | ||
Xliff | m: ^3.permutation(2) | ||
evalable6 | (exit code 1) Potential difficulties: Precedence of ^ is looser than method call; plea… |
||
Xliff, Full output: gist.github.com/20c4982bfa2b30deb9...f659ccf132 | |||
tony-o | m: ^3.comb(2).perl.say; | 18:34 | |
evalable6 | Potential difficulties: Precedence of ^ is looser than method call; please parenthesiz… |
||
tony-o, Full output: gist.github.com/0433b0aafafdc03694...79e1d81b56 | |||
Xliff | m: (^3).comb(2).say | ||
evalable6 | (0 1 2) | ||
Xliff | m: (^3).permutations(2).say | 18:35 | |
evalable6 | (exit code 1) Cannot resolve caller permutations(List:D: Int:D); none of these signatures match: (List: *%_ --> Seq:D) in block <unit> at /tmp/2F_3DZXOky line 1 |
||
jdoege | < 1, 2, 3>.comb(2).permutations | ||
? Not quite | |||
m: < 1, 2, 3>.comb(2).permutations | |||
Xliff | m: (^3).comb(2).permutations | ||
evalable6 | |||
Xliff | m: (^3).comb(2).permutations.say | 18:36 | |
evalable6 | ((0 1 2) (0 2 1 ) (1 0 2) (1 2 0 ) (2 0 1 ) (2 1 0 )) | ||
Xliff | m: (^3).permutations.say | ||
evalable6 | ((0 1 2) (0 2 1) (1 0 2) (1 2 0) (2 0 1) (2 1 0)) | ||
lucasb | m: say (^3+1).combinations(2) | ||
evalable6 | ((1 2) (1 3) (2 3)) | ||
Elronnd | on freebsd with the jvm backend, I'm having trouble building. There were a couple weirdnesses I commented out because I didn't want to deal with, but I'm stumped on this one. This command "/home/elronnd/.perl6/bin/perl6-j -Ilib bin/zef install ." fails with 'Unhandled exception: Wrong number of arguments passed; expected 1..1, but got 1', but with perl6-m it works fine | ||
Xliff | m: (^3).combinations(2).say | ||
evalable6 | ((0 1) (0 2) (1 2)) | ||
18:38
domidumont joined
18:39
domidumont left
|
|||
jdoege | Thank you very much. Combinations seems to do the trick. | 18:40 | |
18:47
atroxaper joined,
domidumont joined
18:48
domidumont left,
jdoege left
18:54
Black_Ribbon joined
|
|||
tony-o | guifa: you might comment here to further discussion (or open a new issue here) as AlexDaniel commented github.com/perl6/problem-solving/issues/4 - in regards to getting round adverbs merged | 19:04 | |
atroxaper | timotimo: hello. Specially for you - journald writer for LogP6 :) github.com/atroxaper/p6-LogP6-Writer-Journald | 19:07 | |
yoleaux | 8 Apr 2019 11:43Z <lizmat> atroxaper: would love to see a blog post about LogP6 | ||
Xliff | tyil: If you pull from p6-GtkPlus and p6-VisualGrammar, things should now work. Let me know if there are other problems. | 19:08 | |
atroxaper | lizmat: hello. I'll try to write a blog, sure. | ||
tyil | Xliff: will do, thanks! | 19:09 | |
guifa | tony-o Hmm interesting. some of those do seem to be a bit more involved. Round is already present, though | ||
Xliff | tyil: Also adjusted the docs so that new users won't miss those missing modules you encountered. Sorry about that. | ||
Thanks for pointing it out! | 19:10 | ||
tyil | no worries :) | ||
I was aware going into this that it's still pre-production level, but I think a tool like this could be great when trying to make a grammar | |||
tony-o | a separate discussion would be fine too | ||
Xliff | tyil: Yes. I have a very complex one in development. =) | 19:11 | |
github.com/Xliff/perl6-Parser-Sql | |||
tyil | nice | 19:14 | |
Xliff: Failed to open file /home/tyil/.local/src/p6-VisualGrammar/tg.g: No such file or directory | 19:16 | ||
(also Stage parse : 361.950) | |||
Xliff | OK. | 19:18 | |
Pull from VG | |||
That really shouldn't be an error. Those files were never supposed to be there. lol | |||
19:19
cpan-p6 left,
cpan-p6 joined,
cpan-p6 left,
cpan-p6 joined
|
|||
tyil | I touched tg.g and aaaa.txt | 19:19 | |
cpan-p6 | New module released to CPAN! LogP6-Writer-Journald (1.3.1) by 03ATROXAPER | ||
tyil | and it started up | ||
19:19
apathor joined
|
|||
tyil | it says No such method 'parse' for invocant of type 'Any', is that normal when there's nothing written out yet | 19:20 | |
Xliff | Yeah. I may need to initialize the buffers to '' on startup if there isn't a file. | 19:21 | |
I don't know why that's not done for an empty file, though. | |||
*shrug* | |||
tyil | I didn't specify any file anywhere yet | 19:22 | |
so perhaps it's because there's no empty file either? | |||
Xliff | Yeah. It's been a long time since I've messed with this. It's been in maintenance mode for months. | ||
So if you would: play around with it and create issues. They'll multiply like bunnies. | 19:23 | ||
tyil | will do :) | ||
for now, a very basic example seems to work | 19:26 | ||
I also have a bug available for you, which I'll work out later when I'm less tired :> | 19:27 | ||
19:31
ctilmes left
|
|||
Xliff | Issue it. I will be checking now that I know VG is being used! :D | 19:32 | |
(and then there were 2 -- it all goes down hill from there) | |||
19:35
kurahaupo left
19:36
kurahaupo joined
19:42
zacts joined
19:43
Kaypie joined
19:50
Kaypie left
20:01
rindolf left
20:11
rindolf joined
|
|||
timotimo | atroxaper: oh jeez, i should really get on that var args for nativecall thing ... | 20:15 | |
atroxaper: is it fine that when there's no sendXY for the number of fields that it'll just not log at all? | 20:21 | ||
20:23
StopThisPsuedoHa joined
20:31
sortiz joined
|
|||
sortiz | \o #perl6 | 20:34 | |
timotimo | 6lrep# o/ | ||
20:35
hasuwiz left,
hasuwiz joined
|
|||
sortiz | timotimo: About varargs, post my PoC, I'm working in a prototype, hope to be usable soon. | 20:37 | |
timotimo | i mean to build actual proper support | ||
var args is a little more than just calling the function as if it had that amount of arguments | |||
sortiz | Yep, its clear, and much desired. | 20:38 | |
Xliff | timotimo: If you bring varargs to perl6 I will have your children! | 20:39 | |
That's the '...' params, right? | |||
timotimo | aye | ||
Xliff | It will be interesting to see how that can work. | 20:40 | |
Coz for many, it's variant parameters. | |||
20:40
domidumont joined
|
|||
Xliff | So something like (Object $o, $Int $i, Str $n, ...) | 20:41 | |
timotimo | it'll just pretend you had a signature with the types that were actually supplied | ||
Xliff | Ooh. | 20:42 | |
OK. And you can do that without creating a nativecall def for each variant. | |||
timotimo | for the API on the perl6 side i'm expecting to provide just support for *@foo which will just straight-up varargs and for something like "is-first-var-arg" | ||
yes | |||
it'll be effortless from the perl6 side | |||
Xliff | My GtkPlus code will thank you! | ||
(maybe it will have your children, instead) | 20:43 | ||
But that way makes sense. | |||
20:43
domidumont left
|
|||
timotimo | what i don't know yet is how va_list parameters are implemented with libffi and dyncall | 20:43 | |
Xliff | Good luck! If you need flunkies, let me know. | ||
timotimo | i don't know what a flunkie is :) | 20:44 | |
Xliff | Henchman. Minions. Fodder. Etc | ||
timotimo | aah | ||
Xliff | I may regret cluing you in, later.... | ||
timotimo | flip the switch, igor! | ||
oh, have you ever listened to Igorrr? | 20:45 | ||
Xliff | Errr... no. | ||
Should I have? | |||
timotimo | it's ... excentric? | 20:46 | |
Xliff googlexs. | |||
.... | |||
Rock opera?!? | |||
timotimo | maybe don't play it loudly | ||
i wouldn't consider that rock opera, though the wikipedia page says there's some operatic singing? | 20:47 | ||
Xliff | Yes. There is. | ||
timotimo | > Igorrr's sound combines breakbeats, heavy metal riffs, extreme tempo changes, and operatic singing coupled with screaming/growling, among other elements, to create what AllMusic describes as "an intense, disturbing, and undeniably distinct experience". | ||
that is a very apt description | 20:48 | ||
Xliff | It's like Electronica, Heavy Metal and Opera jumped into a mosh pit, and this is what came out! | ||
Definitely unique? | |||
.oO( I'm still conf00sled! ) |
20:49 | ||
timotimo | i haven't heard anything like it ever since i heard a bit of that | ||
but tbh i really only listened to one album more than twice | |||
Xliff | www.youtube.com/watch?v=vS7X5nuvjHo | ||
timotimo | moissisure is the album i know a little | ||
20:55
cpage left
20:56
silug left
|
|||
sena_kun | there is no easy way to just say "export from this module A everything that it imports" without explicitly mentioning everything in EXPORT, right? | 21:03 | |
Xliff | I wish | 21:09 | |
sena_kun | :| | ||
21:10
skids left
|
|||
timotimo | you don't have to explicitly mention it, you can probably loop over the things in it | 21:13 | |
sortiz | sena_kun: The easy way I found: github.com/salortiz/NativeLibs/blo...s.pm6#L157 | ||
(But trait_mod:<is> that is now special cased) | 21:14 | ||
21:15
Sgeo_ joined
|
|||
sortiz | bbl | 21:16 | |
21:16
sortiz left
21:17
Sgeo left
21:21
cpage joined
21:27
kurahaupo left,
ctilmes joined,
kurahaupo joined
21:28
cpage left
21:30
netrino left
21:32
Sgeo_ left,
zacts left
|
|||
SmokeMachine | sena_kun: this is how it’s done on Red: github.com/FCO/Red/blob/master/lib/Red.pm6#L50 | 21:43 | |
sena_kun | hmm, nice, but I don't have prefixes of external symbols, its just `success` enum piece or `AddRequest`, not a `Foo::Bar::success` and `Foo::Bar::AddRequest`. | 21:44 | |
well, anyway, the list is not even tremendously long, so I guess I'll be ok with it. | |||
have a lot of more urgent issues to deal with, in any case. ;) | |||
21:48
[particle] left
21:50
adu left,
adu joined,
adu left
21:51
adu joined,
adu left
21:52
adu joined,
adu left,
adu joined
21:53
adu left
22:06
cpage joined
22:07
skeptycal joined
22:08
[particle] joined
22:09
skeptycal left
22:11
zachk joined
22:12
zachk left,
zachk joined
22:20
[particle] left
|
|||
tony-o | sena_kun: what are you trying to do? | 22:20 | |
sena_kun | tony-o, related to what? my question about neater symbol exporting? or right now? | ||
22:20
[particle] joined
|
|||
sena_kun | right now I am thing to implement recursive ASN types and it is not too much fun. | 22:21 | |
about exporting - right now I am having github.com/Altai-man/cro-ldap/blob.../Types.pm6 and all those pushes are somehow irritate me and doesn't look too clean. | 22:22 | ||
s/irritate/irritating/ | |||
22:28
zacts joined
|
|||
tony-o | yes the symbol exporting | 22:29 | |
22:34
someuser joined
|
|||
StopThisPsuedoHa | hi | 22:37 | |
22:41
zachk left
22:42
zachk joined
22:54
Sgeo joined
23:02
someuser left
23:12
sena_kun left
23:14
rindolf left
23:42
Sgeo_ joined
23:45
Sgeo left
23:50
StopThisPsuedoHa left,
aborazmeh joined,
aborazmeh left,
aborazmeh joined
|
|||
guifa | That face when you read a standard and the eamples don’t follow the standard | 23:53 |