»ö« 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.
discord6 <Rogue> I'm getting a very strange error when trying to initialize a class 00:30
<Rogue> I have something like class Pixel { has ($.x, $.y) is required; has ($.r, $.g, $.b) is required; } 00:31
<Rogue> when I try to initialize it like Pixel.new(:0x, :0y, :0r, :0g, :0b); is says $!r is required but I did not provide a value 00:32
<Rogue> Ah, it compiles when there is no type constraint on $!, $!g, and $!b 00:33
<Rogue> $!r * 00:34
<Rogue> Why would uint8 not work there?
<Rogue> Looks like github.com/perl6/nqp/issues/446 is the same issue, but I'm on Moar, not JVM 00:36
holyghost I'm going to do an example using Boltzmann-Hawking Models for Game::Bayes 02:29
the meaning is to approximate the Boltzmann function using Hawking temperature with conditional probabilities and Bayesian Statistics 02:30
or vv. 02:32
holyghost Boltzmann-Hawking models, I invented myself, the approximations are functions on the net 02:37
holyghost One could also use Gaussian Support Vector Machine functionaility 02:52
The Boltzman function can be used to predict a gambling machine, so can the Bayesian Statistics in Game::Bayes 02:56
The temperature T = 10 is a good run for the Boltzmann function 02:57
Using Hawking temp, you gain more energy or entropy
The prediction is what it's somewhat about in decision theory. Hence Game::Bayes 02:58
holyghost hi Xliff 04:18
Xliff \o 04:23
lizmat: gist.github.com/Xliff/c6db1e84e9ff...8d60921233
holyghost Xliff, I'm going to refactor pagan somewhat (the game gfx system I'm writing) then after that I send you a mail for debugging the gfx backend 04:45
_If_ you find some time
m: my $l = <0,1,2,3>; if 0..^$l.elems.rand; 04:48
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3my $l = <0,1,2,3>; if 0..^$l.elems.rand7⏏5;
expecting any of:
block or pointy block
holyghost ^^ I guess this is not a bug ?
m: my $l = <0,1,2,3>; 1 if 0..^$l.elems.rand; 04:50
camelia WARNINGS for <tmp>:
Useless use of constant integer 1 in sink context (line 1)
holyghost etc
elems vs. 04:51
Xliff m: my $l; $l = <0,1,2,3>; 1 if 0..^$l.elems.rand; say $l;
camelia WARNINGS for <tmp>:
0,1,2,3
Useless use of constant integer 1 in sink context (line 1)
Xliff m: my $l; $l = <0,1,2,3> if 0..^$l.elems.rand; say $l;
camelia 0,1,2,3
Xliff m: my $l; $l = <0,1,2,3> if 0..^$l.elems.rand; say $l;
camelia 0,1,2,3
Xliff m: my $l; $l = <0,1,2,3> if 0..^$l.elems.rand; say $l; 04:52
camelia 0,1,2,3
Xliff m: my $l; $l = <0,1,2,3> if 0..^$l.elems.rand; say $l;
camelia 0,1,2,3
Xliff m: my $l; $l = <0,1,2,3> if 0..^$l.elems.rand; say $l;
camelia 0,1,2,3
Xliff m: my $l; $l = <0,1,2,3> if 0..^$l.elems.rand; say $l;
camelia 0,1,2,3
Xliff m: my $l; $l = <0,1,2,3> if 0...^$l.elems.rand; say $l;
camelia 0,1,2,3
Xliff m: my $l; $l = <0,1,2,3> if 0...^$l.elems.rand; say $l;
camelia 0,1,2,3
Xliff m: my $l; $l = <0,1,2,3> if 0...^$l.elems.rand; say $l;
camelia 0,1,2,3
Xliff m: my $l; $l = <0,1,2,3> if 0...^$l.elems.rand; say $l;
camelia 0,1,2,3
Xliff Gnolly, what are you trying to do, there?
I thought I could figure it out, but now that I think about it... it doesn't make sense. 04:53
holyghost Xliff, I guess it's abit ambiguous
Xliff You absolutely do NOT want to make a my declaration conditional.
Not unless you are doing something really strange. And if that's the case, the my declaration should be in its own scope. 04:54
So...
holyghost It's from for (my $i = 0; $i < $l.elems.rand; $i++) { ... }
Xliff if $condition { my $var ... }
OK.
holyghost using $i < $l.elems.rand
Xliff So.
holyghost I mean $i < 0..^$l.elems.rand
Xliff for ^$l.elems.pick { 04:55
Or...
for ^($l.elems).pick {
holyghost ok I see, thanks
still the syntax does not work or might mention pick
Xliff my $l = <0 1 2 3>; say (^$l.elems).pick
evalable6 3
Xliff my $l = <0 1 2 3>; say (^$l.elems).pick
evalable6 1
Xliff my $l = <0 1 2 3>; say (^$l.elems).pick
evalable6 2
Xliff Yes. Pick is a member of List and Range 04:56
docs.perl6.org/routine/pick
holyghost The meaning is not to pick but stop the for loop randomly 05:02
with or without $i++ in the for loop
so just $i < $l.elems.rand then
Xliff NO 05:04
Gnolly, it's the SAME THING. 05:05
.pick selects a random number out of the Array.
yoleaux Xliff: You must provide at least two options.
Xliff .pick selects a random number out of the Array.
holyghost ok, Xliff++ 05:06
Xliff my @l = |('a'...'z'), |('A'...'Z');say @l.pick xx 10 05:07
evalable6 (j N X p s D C J i n)
Xliff my @l = |('a'...'z'), |('A'...'Z'); say (@l.pick xx 10).join
evalable6 GkWxtHVWpi
Xliff ^^ Easy random string value. 05:08
holyghost coolness
moritz m: my @l = |('a'...'z'), |('A'...'Z'); say @l.pick(10).join 05:28
camelia AatRpPrlVk
jmerelo releasable6: status 05:38
releasable6 jmerelo, Next release in ≈1 day and ≈13 hours. 3 blockers. 257 out of 628 commits logged (⚠ 3 warnings)
jmerelo, Details: gist.github.com/327f5bed0e3aae8bdb...7f73fb3557
holyghost jmerelo, Game::Bayes is progressing, needs to compile still, though the applications for it are great :-) 05:40
I'm totally cool about the features 05:41
holyghost I have several Loss functions for decision theory, about 3 Bayesian 05:42
I'm developing the examples as the test directory grows
It's basically taking risks in games, Bayesian Learning, Bayesian Inference and loss functionality for that 05:44
holyghost ok, I'm a bit AFK, I worked this night 06:00
m: "123" flip 06:02
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3"123"7⏏5 flip
expecting any of:
infix
infix stopper
statement end
statement modifier
statement mo…
holyghost m: 123 flip
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 031237⏏5 flip
expecting any of:
infix
infix stopper
statement end
statement modifier
statement mod…
holyghost I would need a procedure that flips an Int ... ?
so 123 becomes 321
ZzZombo m: '123'.flip.say
camelia 321
holyghost thanks
ZzZombo m: 123.flip.say
camelia 321
holyghost It's for bringing approximations of probabilities between [0,1] 06:03
1000,1347589560 flip twice for a % 100 percent
I'll make it a perl6 script in the examples 06:04
thanks ZzZombo
ZzZombo So, in the meanwhile, was there anything released for making games, even simple 2D ones, in P6?
NP! 06:05
holyghost I'm working on github.com/theholyghost2/pagan which is Cairo/SDL/SDL2 backends for games, see my TODO.txt there
I mean, I have to debug the gfx backend, move to other game backendsd later on
It needs to be refactored though due to several gfx options 06:06
Maybe later on, me and Xliff will do EGL and GLX interfaces
Xliff Zzombo: Gnome's Clutter can be used for games. 06:08
See github.com/Xliff/p6-Clutter
It's an interface library.
lizmat Files=1275, Tests=108113, 209 wallclock secs (26.93 usr 7.33 sys + 2904.65 cusr 282.01 csys = 3220.92 CPU) 07:20
cpan-p6 New module released to CPAN! App::MoarVM::ConfprogCompiler (0.0.3) by 03TIMOTIMO 07:35
lizmat .tell Xliff commented on your gist: gist.github.com/Xliff/c6db1e84e9ff...8d60921233 07:37
yoleaux lizmat: I'll pass your message to Xliff.
Xliff lizmat: But the point is to have a separate task watching the memory, not the task itself. 07:38
yoleaux 07:37Z <lizmat> Xliff: commented on your gist: gist.github.com/Xliff/c6db1e84e9ff...8d60921233
Xliff More to the point, I thought it was a great example of a Perl6 one-liner that could be converted to a quick-n-dirty script. 07:40
Your point is well taken, but a bit off the mark from my intent.
lizmat you could make it into a module, like snapper
which you could load externally 07:41
Xliff I could. That wasn't the point of the gist, though. :)
lizmat ok, sorry if I didn't get it :-)
Xliff Was just something I thought might be nice for the weekly.
I was thinking about making an addendum of getting it to work on Windows. Needless to say, the Windows version would be a lot less cleaner. 07:42
lizmat: Replies to your comments. TIA for the discussion! :) 07:49
nine .tell pmurias In general we hold the top level script/program or even it's caller responsible for setting up the required repository chain. A "use lib" in a script doesn't hurt. 09:54
yoleaux nine: I'll pass your message to pmurias.
Geth ¦ problem-solving: AlexDaniel assigned to jnthn Issue %0 and &0 should probably be syntax errors github.com/perl6/problem-solving/issues/44 10:28
scimon www.khanate.co.uk/blog/2019/06/19/p...llenge-13/ : Wroted a thing. 10:47
sena_kun .weekly www.khanate.co.uk/blog/2019/06/19/p...llenge-13/ 10:55
hmm...
.note www.khanate.co.uk/blog/2019/06/19/p...llenge-13/
hmmmmm...
weekly: www.khanate.co.uk/blog/2019/06/19/p...llenge-13/ 10:57
notable6 sena_kun, Noted!
Xliff o/ 11:08
xinming releasable6: status 11:10
releasable6 xinming, Next release in ≈1 day and ≈7 hours. 3 blockers. 257 out of 628 commits logged (⚠ 3 warnings) 11:10
xinming, Details: gist.github.com/d6ffa13953c4a55862...1933f479f5
Geth ¦ problem-solving: AlexDaniel self-assigned Ecosystem issues and a corresponding dev github.com/perl6/problem-solving/issues/45 11:37
cpan-p6 New module released to CPAN! Term::TablePrint (1.4.9) by 03KUERBIS 13:08
Xliff Can you do a BEGIN block in a class definition? 13:20
m: class A { BEGIN say ::CLASS.^name }; A.new
camelia 5===SORRY!5=== Error while compiling <tmp>
No such symbol 'CLASS'
at <tmp>:1
------> 3class A { BEGIN say ::CLASS7⏏5.^name }; A.new
Xliff m: class A { BEGIN say ::?CLASS.^name }; A.new
camelia A
Xliff m: class A { BEGIN say $*CLASS.^name }; A.new 13:34
camelia Failure
Xliff m: class A { BEGIN say $?CLASS.^name }; A.new
camelia A
Xliff m: class A { BEGIN say ::?CLASS.WHAT.^name }; A.new 13:36
camelia A
Xliff What's the best way to refer to a class if it is the only thing defined in a compunit? 13:40
timotimo refer to? from what context? 13:43
is there something like UNIT:: perhaps?
Xliff Well, I think I did it.
Let me test and commit so I can show you.
Xliff timotimo: github.com/Xliff/p6-Amazon-AWS-EC2...ribute.pm6 13:48
Note the BEGIN block at the bottom.
I'm trying to make it so that BEGIN block can be applied to all Action classes without change. 13:49
Even if it means using the unusual class declaration at the top.
Is there a better way to accomplish this?
timotimo maybe an EXPORTHOW could be of use here 13:50
Xliff It looks like that constant hack does the job, though. 13:51
timotimo if you're guaranteed to have a BUILD submethod, you can search for a class in ::.values or whatever that has a code location of "current filename" for its BUILD submethod :) :) 13:53
Xliff Wouldn't that be $?FILE? 13:54
Er... $?FILE <interrogative>
timotimo: That's a thought, but wouldn't that be more of a hack than using myclass? :) 13:55
timotimo possibly 13:56
timotimo but maybe it'd let you only put something at the end, not have to put something at the front as well 13:56
Xliff Good point. But for now, myclass is easier to understand. ;)
timotimo sure 13:57
AFKBBL
Xliff BBLAFKBLT 14:00
timotimo more opportunities for hilarious results: python's "strip" method takes a string that it interprets as a list of characters. any series of only those characters are removed from the start and end 16:18
except of course python doesn't get characters right
so if you put in aeioü (and the ü is in NFD) then it will remove aeiou as well as all of those with diaeresis on top
jmerelo squashable6: status 16:28
squashable6 jmerelo, Next SQUASHathon in 15 days and ≈11 hours (2019-07-06 UTC-14⌁UTC+20). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
jmerelo releasable6: status
releasable6 jmerelo, Next release in ≈1 day and ≈2 hours. 5 blockers. 257 out of 629 commits logged (⚠ 3 warnings)
jmerelo, Details: gist.github.com/d7c0c2dd6980e0f233...615237274d
timotimo oh? repl.it has a "multiplayer" mode? has anybody given that a try? 16:44
oh, no perl6 in there 16:45
i could have sworn...
jmerelo Anyone at #TPCiP? 18:42
cpan-p6 New module released to CPAN! ProcStats (0.1.0) by 03LEMBARK 19:40
ugexe if only we had that built in 19:41
oh wait
timotimo it's not quite the same as Telemetry 19:48
ugexe just use the nqp::getrusage directly like the module does 19:49
timotimo nqp::getrusage doesn't give you the labels for free, and doesn't handle the first four entries really being 2 entries 19:51
ugexe maybe it should have a better api then instead of having an api tailored to just telemtry 19:54
timotimo it has ProcStats now 19:57
cpan-p6 New module released to CPAN! ProcStats (0.1.1) by 03LEMBARK 20:57
ugexe sure, but thats now how any other api is treated 21:02
s/now/not/
lizmat weekly: dev.to/antoniogamiz/gsoc-2019-1k1h 21:36
notable6 lizmat, Noted!
perryprog Hello hello! 21:58
timotimo greet greet 22:00
guifa is there any way to get [X+] to NOT act upon receiving a single list? 22:11
e.g.
[X+] (1,2,3) xx $foo
guifa Things are peachy for $foo > 1; but $foo == 1 just sums 1,2,3 22:12
MasterDuke guifa: that's a known "thing". pretty sure there's a rakudo or problem-solving issue about it
guifa Ah, is it considered a bug? 22:13
guifa is asking for code golf :-)
MasterDuke github.com/rakudo/rakudo/issues/2025 i think 22:14
timotimo perryprog: what can we do for you today? :) 22:34
perryprog Just saying hi :). I'm slowly stepping into the ocean of perl6 since it seems really nice for miscellaneous tasks. 22:35
Currently I've just been reading various entries from rosettacode.org/wiki/Category:Perl_6 22:36
timotimo cool 22:38
i'm pretty proud of the "galton board" one i made :) :)
perryprog Yeah I've heard great things about the author of that one. 22:39
;)
guifa MasterDuke: codegolf.stackexchange.com/a/187124/30284 22:47
Something makes me happy being able to do a brute force that still beats everyone who is doing fancy formulae fro compressed values and everything — and beating a lot of the golf specific languages too
timotimo perryprog: oh, that's a nice thing to say :) 23:16
TreyHarris This feels like an FAQ, but I don't see it documented in any of the 5to6 docs... In Perl 5, a pretty common usage pattern for *nix systems programming was to write a program with an infinite loop, using "head" or closing the pipe on input. I can't figure out how to do this in Perl 6 without getting a nasty multiline backtrace starting with "Broken pipe". I tried catching SIGPIPE, and I can, but even if I exit 23:19
0 in the handler I still get the backtrace
*s/using "head"/breaking tho look using "head"/ 23:20
er, "the loop" even...
I also tried a catch-all catch in the body of the loop and the scope immediately outside the loop, with the same result as handling SIGPIPE 23:22
timotimo can you paste the output, maybe including your command and how exactly to run it? 23:25
TreyHarris For the simplest example, here's an attempt at reimplementing the Unix 'yes' command: gist.github.com/489a71a643511895ac...963eecc973 23:28
The Perl 5 equivalent runs without complaint
perryprog oh timotimo, have you seen the Julia galton board entry? It's super elegant. rosettacode.org/wiki/Galton_box_animation#Julia 23:33
perryprog Yours is quite nice as well of course, albeit a bit over my head. 23:37
timotimo mhm, it's a lot more code, but not only does it animate the falling balls in half steps for more smoothness, but it also has multiple balls on the board at the same time and supports abritrary sizes of boards 23:47
oh, cool, someone took the perl 6 version and built a perl 5 version out of it 23:49
leont perryprog: can't you just catch that exception? 23:50
TreyHarris I'm looking at the IO types and not finding anything that will help me here... not without just creating a new problem of deadlock 23:51
leont: were you meaning to direct that to me?
nadim_ TreyHarris: you need to catch SIGPIPE
leont Erm, yeah. Sorry
TreyHarris nadim_: As I said, I tried that; the handler ran, but the backtrace was still printed. Perhaps I did it wrong? Let me Gist that version. 23:53
timotimo annoyingly, when it's got "| head" attached to it, it isn't as straightforward to gdb-debug 23:54
even if you catch the exception from the "say" and sigpipe, there's still an exception from trying to write bytes to stdout that gets output on stderr 23:55
but that's also an exception that gets thrown regularly
it could very well be that it's coming from the machinery that makes MAIN work, which you can't easily put an exception handler around 23:56
nadim_ is MAIN needed?
leont An unhandled SIGPIPE should kill the process. Or is perl6 doing something odd there? 23:57