»ö« 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.
ctilmes_ I stand corrected -- it does not work 00:00
I went back to the module I thought I used it in -- I mapped the same symbol to multiple different subs, then had multi methods call the right sub 00:01
guifa If you have a multidimension hash, is there a better way to loop through several dimensions while capturing each level’s key other than for %h.keys -> $a { for %h{$a}.keys -> $b { for %h{$a}{$b}.keys -> $c { do something }}} ? 00:06
Juerd guifa: I don't know. I suspect not. 00:10
guifa: But note that the term "multidimensional hash", although conceptually sufficient to describe the thing, is actually a hash with hashes in it.
guifa: The easiest generic approach is probably a recursive function, although that has its obvious limits. 00:11
Or a stack of things to iterate over 00:12
guifa Yeah. I may come up with a generic solution fo some sorts where I could do
for %hash.multilevel(3) -> $level-1, $level-2, $level-3 { … } 00:13
guifa . o O ( actually, that’d be a really useful hash util function, come to think of it ) 00:14
Juerd my %hoh = foo => { bar => 1, xyzzy => { quux => 42 }, baz => { aoeu => { snth => 23 } } }; my @stack = :%hoh; while @stack { my $p = @stack.shift; for $p.value.pairs -> $p { when $p.value ~~ Hash { @stack.append: $p; }; say "$p.key() is $p.value()"; } } 00:25
evalable6 bar is 1
quux is 42
snth is 23
Juerd If you only care about values 00:29
my %hoh = foo => { bar => 1, xyzzy => { quux => 42 }, baz => { aoeu => { snth => 23 } } }; say gather { %hoh.deepmap({ $_ }) }
evalable6 ()
Juerd Er
my %hoh = foo => { bar => 1, xyzzy => { quux => 42 }, baz => { aoeu => { snth => 23 } } }; say gather { %hoh.deepmap({ .take }) }
evalable6 (23 1 42)
guifa Juerd: this is what I went with. 00:55
tio.run/##1ZJNTsMwEIXX9immlSvFyK1U...lrq0mnbdb8
err copied wrong version 00:56
Xliff m: ㄱ.uniname.say 00:57
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/FOFbWiNwdS
Undeclared routine:
ㄱ used at line 1
Xliff u: ㄱ
unicodable6 Xliff, U+3131 HANGUL LETTER KIYEOK [Lo] (ㄱ)
Xliff Is that the HANGUL equivalent of A?
guifa tio.run/##1VJLTsMwEF3bp5hWrpQgt1Kp...aizpU3b/gE
Corrected one
Korean equivalent of K 00:58
Xliff Why K?
And what are the others? =)
guifa First letter of their alphabet :P
Xliff So it is the equivalent of A
guifa Well, in the ordinal sense yes :-)
Xliff Hahaha! :) 00:59
guifa That multikey function is going to help out so much with parsing the CLDR where I sometimes have a 6-level nested hash :( 00:59
Xliff guifa: Nice! Good luck! 01:32
guifa I’m like this close || to releasing a huge update for number formatting.
Probably release it tomorrow at some point 01:33
Geth doc: daee46f091 | (JJ Merelo)++ | doc/Language/operators.pod6
Comments >> on list of Callables, closes #1643
05:47
synopsebot Link: doc.perl6.org/language/operators
discord6 <Tyler (Aearnus)> hey y'all, i wrote some code to manipulate notes & chords on a stringed instrument (not in perl6) github.com/Aearnus/chord-finder/bl.../Chords.hs is there any module like this in perl6 though? i'd much rather be writing my full application in that 05:52
jmerelo Tyler: not as far as I know... Check out modules.perl6.org 06:02
masak aearnus: cool! 06:04
aearnus: github.com/Aearnus/chord-finder/bl...rds.hs#L31 -- surely there must be some shorter way to write that in Haskell? some kind of abstraction that means "N iterated `succ` calls" 06:05
aearnus: something based on hackage.haskell.org/package/base-4...#v:iterate maybe 06:12
discord6 <Tyler (Aearnus)> jmerelo: thanks for that link! 06:22
<Tyler (Aearnus)> masak: there's the incNote function there that I should be using but I haven't rewritten it yet :^)
masak aearnus: it felt like a case of (f^n)(x) if you know what I mean :) 06:23
discord6 <Tyler (Aearnus)> indeed it does... is that something perl6 can do? 06:24
masak m: multi infix:<**>(&fn, Int $n) { -> $v { my $result = $v; $result.=&fn() for ^$n; $result } }; sub inc($n) { $n + 1 }; say (&inc ** 30)(12) 06:51
evalable6 42
masak aearnus: ^ 06:52
discord6 <Tyler (Aearnus)> ah, sweet! 07:05
moritz m: sub inc($n) { $n + 1 }; say ([o] &inc xx 10)[12] 07:17
evalable6 (exit code 1) Index out of range. Is: 12, should be in 0..0
in block <unit> at /tmp/cQ9_3fWbJv line 1
moritz m: sub inc($n) { $n + 1 }; say ([o] &inc xx 10)(12)
evalable6 22
moritz using the built-in o operator for function composition in reduce mode :D 07:18
discord6 <Tyler (Aearnus)> 😮 07:19
moritz today, I feel like a functional wizard :D 07:21
masak moritz: you will always be my functional wizard <3 07:38
like the one on the cover of the SICP book
moritz masak: :-) 07:39
masak "behold, the holy eval/apply ball!"
moritz I usually get the impression that you work much better with all that functional stuff than me
masak that's very nice of you to say 07:40
I'm just an amateur, really. but a dedicated one.
I went back not long ago and re-read nothingmuch's Harrorth diary, and discovered to my delight that Haskell (up to and including the Writer monad) isn't weird black magic to me anymore 07:41
discord6 <Tyler (Aearnus)> it's kind of my style to get familiar enough with a language to destroy it in awful, black magick-y ways 07:42
<Tyler (Aearnus)> perl6 included
<Tyler (Aearnus)> this was my Haskell magnum opus github.com/Aearnus/type-level-fib/...er/main.hs 07:43
moritz so far, I have had tried three incursions in Haskell land 07:44
in the first, everything was weird, and I didn't understand much 07:45
in the second, things up to and excluding monads made sense
in the third, I had the feeling that I understood monads and their purpose, but I still couldn't manage to get any program to compile that contained monads
El_Che moritz: you're on a higher plain of existence now. I wonder if you can hear me 07:47
discord6 <Tyler (Aearnus)> m: role Monad[::A] { only method bind((&f where (.signature.elems ~~ 1 and .returns ~~ :(::A))) --> ::A) { ... }; only method wrap(::T --> Monad[::A]) { ... } } 07:48
moritz El_Che: I bounced back right to this plane of existence after the haskell compiler told me in no uncertain terms "no, you just *think* you understood it"
discord6 <Tyler (Aearnus)> 😠 evalable6 doesn't work through IRC-discord boundaries
El_Che hehe
moritz m: role Monad[::A] { only method bind((&f
where (.signature.elems ~~ 1 and .returns ~~ :(::A))) -->
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/PR9AK0XRPo
Malform…
moritz, Full output: gist.github.com/3cf4a6fb0f23af036c...f36c60c6bd
moritz eeks
m: role Monad[::A] { only method bind((&f where (.signature.elems ~~ 1 and .returns ~~ :(::A))) --> ::A) { ... }; only method wrap(::T --> Monad[::A]) { ... } } 07:49
evalable6
discord6 <Tyler (Aearnus)> looking back on it, i don't think that code's even right
kawaii I assume unpublishing a module from the ecosystem is as simple as making a PR to that repo to remove the line to the module 08:43
moritz that's correct
lizmat kawaii: and if it's on CPAN, remove all of the distributions from CPAN 08:44
SmokeMachine Is there a way where I could modify the Scalar class to call one of its methods without need to call `.VAR`? 10:52
timotimo all method calls will decont before invoking, unless you put a .VAR in front, i believe 10:53
SmokeMachine m: subset Bla of Any; my Bla $a = 42; say $a.VAR.of
evalable6 (Bla)
SmokeMachine timotimo: Im trying to create a type of subset with methods... I was thinking on creating a fallback on Scalar if its `.of` is of this kind of subset it would run its methods... 10:55
so I could do something like: every value that match this subset automatically has this method... 10:57
atroxaper Does somebody know how WRITE/READ methods work in IO::Handle? Can not find code for that in Rakudo/MoarVM/nqp. I want to write my IO::Handle for writing and worry about buffering. Need I '.out-buffer = False' in case I need to turn it off in custom IO::Handle? 11:00
SmokeMachine class C {method ble { 42 }}; protocol Bla { method ble { ... }; method say-ble { say self.ble } }; my Bla $a = C.new; $a.say-ble # prints 42
Im trying to make this possible...
it looks like a role, but its different from a role because I don need to do `class C does Bla`...
timotimo that's not how that works :) 11:01
if you don't assign the value to something that is .of that subset, it won't have the methods
timotimo how do y'all feel about adding methods to Buf that is a combination of buf8.new and .write-[u]int[8|16|32|64|128], and maybe also adding .write-* and .read-* to IO::Handle? 11:29
SmokeMachine timotimo: do you know where it is deconted? 12:19
timotimo somewhere in code gen / compilation i guess? 12:20
SmokeMachine do you know where the .VAR is implemented? 12:21
jnthn SmokeMachine: It's a primitive, grep for `p6var` 12:24
SmokeMachine jnthn: thanks
I think my example will have to be used like: `Bla.say-ble: $a` 12:26
SmokeMachine m: subset Bla of Any; multi infix:<call>($var is raw where { .VAR.of ~~ Bla }, $meth) { $var.VAR.of."$meth"($var) }; my Bla $a = 42; $a call "ble" # maybe I'll need something like this... 12:41
evalable6 (exit code 1) No such method 'ble' for invocant of type 'Bla'
in sub infix:<call> at /tmp/IouxH_nQ8u line 1
in block <unit> at /tmp/IouxH_nQ8u line 1
12:41
SmokeMachine is there any way to remove the needed " from the method name without macros and is parsed? 12:43
jnthn No 12:48
Well, unless you have a method ref rather than method name in $meth 12:49
SmokeMachine I mean on the infix call... 12:51
my %m = bla => my method bla() { "bla: { self }" }; subset Bla of Any; multi infix:<!!>($var is raw where { .VAR.of ~~ Bla }, $meth) { %m{$meth}.assuming: $var }; my Bla $a = 42; say ($a!!"bla")()
evalable6 bla: 42
jnthn Oh, no, that's certainly in langauge tweak territory 13:01
jmerelo releasable6: status 15:20
releasable6 jmerelo, Next release in ≈8 days and ≈3 hours. 12 blockers. 0 out of 197 commits logged
jmerelo, Details: gist.github.com/c8e47d33810232343e...3f7f519b94
Woodi hi #perl6 15:33
sena_kun o/
Woodi C++ have RVO optimisation and looks like using pointer to variable that will be assigned when function returns. so function do not need to create tmp value + one less copy... do we have such thing in Moar ? en.wikipedia.org/wiki/Copy_elision 15:38
sena_kun Woodi, perhaps #moarvm?
Woodi right... 15:39
jmerelo If no one is against, next Squashathon is going to be about... 15:54
... wait for it ...
... documentation
jmerelo I know last one wasn't very successful, but lately there's been very little movement there. Last commit by non-me was 4 days ago, and this last month has seen the lowest number in contributions in like years. 15:56
So we need more people there. And a good introduction might be a squashathon.
So if no one is against it, I think that's going to be it. I will push the rest of the planned squashathons down one month.
Geth docker: 60f1dd961d | (Jeremy Studer)++ | Dockerfile
Update Rakudo Star version to 2019.03

This updates the Rakudo Star version to 2019.03 from 2018.10.
The maintainer for Rakudo Star changed between 2018.10 and 2019.03 so the existing fingerprint used to retrieve the key and verify the tarball is not valid for the new release. Updating to include the new ... (5 more lines)
15:59
docker: d203319367 | (Jeremy Studer)++ | Dockerfile
Remove branching fingerprint selection

It is unnecessary. It is much easier to just include multiple fingerprints.
docker: 2c1918ca12 | (Jeremy Studer)++ (committed using GitHub Web editor) | Dockerfile
Merge pull request #24 from jstuder-gh/update_to_2019.03

Update Rakudo Star version to 2019.03
16:00
Geth doc: 21b82802cd | (JJ Merelo)++ | doc/Type/Metamodel/ConcreteRoleHOW.pod6
Adds stub for ConcreRoleHOW, although there's not much of it
16:19
synopsebot Link: doc.perl6.org/type/Metamodel::ConcreteRoleHOW
jmerelo squashable6: status 17:02
squashable6 jmerelo, Next SQUASHathon in 20 days and ≈18 hours (2019-05-04 UTC-14⌁UTC+12). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
Xliff m: my $a = 0; say $a.WHAT; say $a.WHERE; say $a.WHY; say $a.WHEN; say $a.HOW 17:54
evalable6 (exit code 1) (Int)
No such method 'WHEN' for invocant of type 'Int'. Did you mean any of …
Xliff, Full output: gist.github.com/030caa5008b1b10667...7c2a5430ec
Xliff m: my $a = 0; say $a.WHAT; say $a.WHERE; say $a.WHY; say $a.HOW
evalable6 (Int)
140223334613584
No documentation available for type 'Int'.
Perhaps it can be found at docs.perl6.org/type/Int
Perl6::Met...sHOW.new
»
Xliff m: my $a = 0; say $a.WHAT; say $a.WHERE; say $a.HOW 17:55
evalable6 (Int)
139648950334032
Perl6::Metamodel::ClassHOW.new
Xliff .WHEN should return when the value was created. 17:55
Or at least something silly like "42"
jmerelo Xliff: there's a new problem-solving repo to propose that kind of things... :-) 18:01
Xliff Oh? What's the link?
Going to shoot stuff. BBL
jmerelo Xliff: github.com/perl6/problem-solving :-) Sorry... 18:39
.tell Xliff github.com/perl6/problem-solving :-) Sorry... 18:40
yoleaux jmerelo: I'll pass your message to Xliff.
Xliff m: my %h; %a<a> = 1; %a<b> = 2; say %a<a>.WHERE; say %a<b>.WHERE 19:51
yoleaux 18:40Z <jmerelo> Xliff: github.com/perl6/problem-solving :-) Sorry...
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/Fa_bsgbFfD
Variable '%a' is not declared
at /tmp/Fa_bsgbFfD:1
------> 03my %h; 08⏏04%a<a> = 1; %a<b> = 2; say %a<a>.WHERE; s
Xliff m: my %a; %a<a> = 1; %a<b> = 2; say %a<a>.WHERE; say %a<b>.WHERE
evalable6 139630733337208
139630733337248
Xliff OK. .WHEN created. 19:53
m: $a.HOW.say 19:56
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/mgWIprlmsm
Variable '$a' is not declared
at /tmp/mgWIprlmsm:1
------> 03<BOL>08⏏04$a.HOW.say
Xliff m: my $a = 1; $a.HOW.say
evalable6 Perl6::Metamodel::ClassHOW.new
Xliff nqp ops list? 20:18
Is there one?
Xliff nevermind 20:19
github.com/perl6/nqp/blob/master/d...s.markdown
time perl6 -e 'use nqp; class Foo { has $.WHEN = nqp::time_n(); }; for 1..1000000 { Foo.new }' 20:21
Geth doc: 9bc4630da6 | Coke++ | doc/Language/js-nutshell.pod6
whitespace
20:28
synopsebot Link: doc.perl6.org/language/js-nutshell
doc: 5a3a5f4417 | Coke++ | doc/Language/js-nutshell.pod6
avoid variable redecl. errors when compiling
doc: ef7677f904 | Coke++ | 2 files
learn new words
patrickb Just implemented support for zsh, fish and sh in rakudobrew \o/ 22:00
Xliff \o 22:12
guifa Is there any particular reason NOT to use hyper if there are no side effects in the block? Performance penalty if it’s constantly used with small loops? 22:50
AlexDaniel guifa: I don't see any other reason 23:07
AlexDaniel weekly: over 31000 commits in rakudo! github.com/rakudo/rakudo 23:13
notable6 AlexDaniel, Noted!
ugexe well its eager for one
ugexe and i'd say its not just the size of the loop, but more importantly if the work being done lends itself to the overhead 23:14
discord6 <Tyler (Aearnus)> guifa:'sometimes the overhead of starting extra threads just isn't worth it 23:25
timotimo every thread has its own nursery, which starts small, but it grows to 2 * 4 megabytes 23:45