»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
Geth doc: 2e71131a7d | (Will "Coke" Coleda)++ | 2 files
Test examples in doc/language/testing.pod6

Part of #1387
00:13
lookatme morning 00:48
jeromelanteri zengargoyle, no problem... by the way, the application create it and you can put what ever you want inside who respect the structure 01:27
yoleaux 30 Jul 2017 21:51Z <zengargoyle> jeromelanteri: could you add an example my_pl6.yml file to your repo?
30 Jul 2017 21:56Z <zengargoyle> jeromelanteri: or you could email me zengargoyle at gmail.com if my_pl6.yml is sensitive data....
Geth doc: ceec98b52e | (Will "Coke" Coleda)++ | 2 files
Test Perl 6 code in ruby nutshell doc.

Found several issues in the P6 code.
Part of #1387
01:29
mspo is there a way to print out the site dir's path? 01:59
[Coke] the site? 02:04
mspo as in the part of the $*REPO.repo-chain 02:09
that is global
[Coke] m: say $*REPO.repo-chain[0].writeable-path.say 02:14
camelia "/home/camelia/.perl6".IO
True
[Coke] (one too many says) 02:15
m: .writeable-path.say for $*REPO.repo-chain
camelia "/home/camelia/.perl6".IO
"/home/camelia/rakudo-m-inst-1/share/perl6/site".IO
"/home/camelia/rakudo-m-inst-1/share/perl6/vendor".IO
"/home/camelia/rakudo-m-inst-1/share/perl6".IO
No such method 'writeable-path' for invocant of type 'CompUnit::Rep…
mspo m: say CompUnit::RepositoryRegistry.repository-for-name("site") 02:16
camelia inst#/home/camelia/rakudo-m-inst-1/share/perl6/site
mspo that's what I wanted
well sort of 02:22
lookatme ugexe, are you in around 02:32
mspo I'm trying to install zef into a DESTDIR 02:39
and not just sed that repository-for-name("site") call :)
joy hello, i have a small question , can the value returned by an 'if' be assinged? something like let x = if var<1 { 1} else { 2}; 02:46
lookatme let x = do if 02:47
m: my $x = do if 1 { 1 } else { 2 }; say $x;
camelia 1
lookatme joy, ^^
joy lookatme: thank you much 02:48
lookatme welcome 02:49
joy kind of like 'do' converts the statement into an expression
by wrapping inside a block
jeromelanteri what is the diference between associative hash and hash ? 03:36
jeromelanteri because, i do: my %failed; then call function f(%failed); who has been defined like: sub f(Hash %f is required) { } 03:38
geekosaur that sounds a bit confused. Associative is a role; Hash is an implementation of it
jeromelanteri and get error Type check failed
geekosaur and Hash %f doesn['t mean what you think
"Hash %f" means an Associative whose values are Hashes 03:39
jeromelanteri geekosaur, ok but i not understand, i do define a Hash, then pass it in arg for a function who ask for a Hash... and it faile due to wrong type
geekosaur % already does what you want
jeromelanteri geekosaur, so... how do you just define a Hash ?
or better... how do you said you want a Hash as argument ? instead of "associative Hash ? 03:40
(define the constraint of argument...) 03:41
geekosaur do you really need to exclude other things that do Associative?
jeromelanteri geekosaur, i asked you what i would like to do
geekosaur again, Associative is a role. Hash is one class that does that role. *Every* Hash is Associative. % expresses the Associative role. 03:42
lookatme "Hash" before %f is a constraint
type constraint
m: my %hash = a => 1, b => 2; sub f(Hash $f) { say $f; }(%hash); 03:43
camelia {a => 1, b => 2}
jeromelanteri geekosaur, ok... so when i do my $string; f($string); sub f(Str $s is required) {}
lookatme jeromelanteri, ^^
geekosaur m: sub f(Hash $f) { say $f<a> }; my %a = :3a, :2b, :5c; f(%a)
camelia 3
jeromelanteri it works... so i definitly not well understand what it mean.
i try to make the logic link... 03:44
lookatme jeromelanteri, you can read the Signature document
geekosaur note $ instead of %
`sometype %v` means an Associative whose values are of type sometype
jeromelanteri let me time to try to understand, it still confuse for me... there is two things who make me opposit sens
geekosaur this is confusing, the types of Associatives and Positionals don't work like the types of Scalars 03:45
jeromelanteri geekosaur, well... when you define a function or method, you doesn't ask for a constraint byt pass Type in front ?
geekosaur, why ? 03:46
geekosaur because generally you want to say the type of the thing stored in it
jeromelanteri geekosaur, sure it is confusing because it is not logic
geekosaur if you say Str %h, you mean a Hash containing Str
jeromelanteri geekosaur, sure... why not make things like: just add a char designed for that in front ?
geekosaur, ok 03:47
geekosaur think about it, if you define a function Str sub foo() you are not saying the function itself is a Str!
you are saying its *result* is a Str
jeromelanteri sure
geekosaur if you say Str @a, you mean an array OF Str
jeromelanteri like in C++
ho ok
understand better
i thank that: $x is a string 03:48
lookatme docs.perl6.org/type/Signature#Type_Constraints
jeromelanteri lookatme, i read it allready.
geekosaur so if you absolutely need Hash and not just Associative (things that are indexed the way hashes are), you need to declare it as a scalar: Hash $f
then you access with $f<a> or whatever
jeromelanteri ok
lookatme It's an Perl6 way, anyway
geekosaur note $ instead of %
er
m: sub f(Hash $f) { say $f<a> }; my %a = :3a, :2b, :5c; f(%a) 03:49
camelia 3
lookatme have lunch now
jeromelanteri ok, so %x is not a hash ?
geekosaur it defaults to Hash
jeromelanteri lookatme, good lunch
geekosaur it could also be Set, Bag, Mix, or various other things that do the Associative role
jeromelanteri geekosaur, and it can be an other one loaded ?
ok
geekosaur, that make me understand better would be many examples in the doc... i have sometimes difficulties with words 03:50
thank you
i also buy a perl6 book... but inside, it said things like: "this example doesn't works... but..." ok then... why writing this example ? 03:51
geekosaur because the only perl 6 books currently available are from the mid 2000s and talk about features that were expected to be added at some point. perl 6 was still in early development at the time 03:52
geekosaur and perl 6 has changed a bit since then, so most of those books are a bit questionable 03:52
jeromelanteri think perl6... (the title)
geekosaur, yes
jeromelanteri geekosaur, ok then... i resume: in my function, i have to define constraint like: Hash $x is required 03:54
jeromelanteri then i can call f(%failed) ? 03:54
geekosaur yes
jeromelanteri well, thank you (it makes me very strange by the way)
geekosaur m: sub f(Hash $f is required) { say $f<a> }; my %a = :3a, :2b, :5c; f(%a)
camelia 3
jeromelanteri veru strange... 03:55
yes so sure, inside function, i use $ instead of %
geekosaur because you declared it with $, yes 03:56
jeromelanteri and same when use loop for ? my @group =( {a=> "b", b=> "c"}, {a=>"d", b=> "nawak"}); for @group -> %x {...} 03:57
or for @group -> $x {}
? 03:58
i try some test on perl6 editor...
geekosaur m: my @group =( {a=> "b", b=> "c"}, {a=>"d", b=> "nawak"}); for @group -> %x { dd %x } 04:01
camelia Hash % = {:a("b"), :b("c")}
Hash % = {:a("d"), :b("nawak")}
geekosaur m: my @group =( {a=> "b", b=> "c"}, {a=>"d", b=> "nawak"}); for @group -> $x { dd $x }
camelia Hash $x = ${:a("b"), :b("c")}
Hash $x = ${:a("d"), :b("nawak")}
jeromelanteri geekosaur, it works for together
(crying)
geekosaur they both work; % is a bit more idiomatic
there are subtle differences between the two but much of the time it doesn't matter
jeromelanteri so perl6 make interpretation for this situation... 04:02
(rakudo)
geekosaur in partiuclar using the % form lets you talk about the types of keys and values, but $ only lets you talk about the Hash
which is what you ran into with the sub declaration
jeromelanteri yes
jeromelanteri in which kind of situation it does matter ? 04:03
(an example ?)
and same when use loop for ? my @group =( ${a=> "b", b=> "c"}, ${a=>"d", b=> "nawak"}); for @group -> %x {...} 04:04
maybe ?
geekosaur same there, yes
jeromelanteri but the $ in front of { said it is a scalar... 04:05
geekosaur a scalar container can hold an Array or a Hash or a Set or any other object
jeromelanteri so here only -> $x shoudl works ?
geekosaur with % you get somewhat better type checking from the compiler
jeromelanteri ok
geekosaur and more ability to specify the types within the container 04:06
if you don't need that, you can use either one.
jeromelanteri what is the best practice convention to use ?
geekosaur but perl 6 is more likely to catch a mistake if you use the %
jeromelanteri sure
so best practice is to go closer to the real content type
(i think also interpretation time by rakudo is a loosing time) 04:07
geekosaur we went for correctness first; speed is what's being worked on now 04:08
jeromelanteri then by the way, inside a private function, normally, there is no reason to make a constraint ?
geekosaur there can be, depending on how complex the function is
jeromelanteri ok
geekosaur again, the more information you give it about what you expect (for example, if you say $x then itcan be literally anything; if you say %x then it *must* have an Associative role) the better the error messages for mistakes will be 04:09
and, sometimes, the faster the result will run because it doesn't have to allow for the possibility that your $x might be sometimes a Hash and sometimes an Array and ...
jeromelanteri taht seems clear for me now 04:10
that 04:11
thank you geekosaur
also... i see that there is priories when define a function arguments... default values has to be last ones (same in C++) and required constraint not first ones... 04:12
priorities
is it possible to create something like "struct" with perl6 also ? 04:13
geekosaur yes. because if you make the first parameter optional and the second normal, what does foo(1) mean? could be you meant 1 as the optional first and Any as the second, or that you left off the first and 1 is the second
jeromelanteri geekosaur, yes
geekosaur generally one uses classes for that. (sort of like C++, where a struct is just a class with all public members)
jeromelanteri ok 04:14
jeromelanteri geekosaur, actually, define function with Hash $failed or with %failed provide the same error of associative Hash and hash (${}) 04:17
geekosaur can you put the actual code and full error on a pastebin somewhere? 04:18
jeromelanteri geekosaur, yes
gist.github.com/jerome-diver/93471...22fdc3ecd9 04:20
geekosaur ok, the error says that it's not this file that is at fault 04:22
jeromelanteri geekosaur, o f... yes...
geekosaur what is line 54 of check/Check.pm6? 04:23
jeromelanteri geekosaur, that's ok, same problem was Hash %things instead of %things 04:24
fix 04:25
geekosaur also: the meaning of that Assdociative[Hash] thing is that it is checking something related to the role Associative, and the thing doing the Associative role is a Hash
jeromelanteri by "associative", it is like "reference to" ? 04:26
no... it can also be referenced to an associative role 04:27
it is a role
geekosaur Associative means things that are indexed by keys, like Hash, Set (which is *just* keys, Bag (like Set but it also stores the number of times the key is present), etc.
there is also Positional, which is things like Array, List (read-only array), etc. that are indexed by position
jeromelanteri a kind of special reference with more meta inforamtion about the nature of reference ? 04:28
geekosaur something like that 04:28
jeromelanteri ok.
geekosaur they can all be thought of as custom Hashes
jeromelanteri i think it ias the way for functionnal programmation (that is something nex for me) 04:29
new
lookatme Anyway there some document explain this 04:50
In docs.perl6.org/type/Associative : The % sigil restricts variables to objects that do Associative. 04:51
m: my %x := Set(1, 2, 3); say %x.WHAT;
camelia (Set)
lookatme m: my %x := 1; say %x.WHAT;
camelia Type check failed in binding; expected Associative but got Int (1)
in block <unit> at <tmp> line 1
lookatme I would be guess, the @ sigil restricts variable to objects that do Positional 04:53
and the $ is for every objects
jeromelanteri, ^^
In signature, the type constraint, for % and @ is a little different from $ 04:55
jeromelanteri ok... thank you. what is := vs = ?
lookatme, my turn to go at lunch now.. 04:56
lookatme OK, good lunch
mint_ hi 05:00
lookatme hi :??? 05:02
link_k hi
somebody cares for giving me a quick intro to perl? 05:03
i give gratitude back
lookatme learnxinyminutes.com/docs/perl6/ link_k 05:19
like this ?
link_k lookatme, it seems like that link shows me the grammar of perl. i was curious to know about the philosophy, mentality of perl.. 05:32
does it makes sense?
geekosaur philosophy is best gleaned from the apocalypses etc. design,perl6.org 05:34
(note that the synopses, which were the original draft specifications, are now out of date, as are many of the examples in the apocalypses and exegeses) 05:35
faraco m: say hello 07:00
yoleaux 26 Jul 2017 17:07Z <Zoffix> faraco: so the .sum test description is not too wrong. Indeed Range.sum produces an Int for non-Int endpoint, but only if it can; (1.1 .. 10.0).sum gives a Rat :/
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
hello used at line 1. Did you mean 'shell'?
faraco m: my @foo = <cow dog>; my ($moo, $woof) = @foo; say $moo ~ " " ~ $woof 07:03
camelia cow dog
lookatme :/ 07:47
AlexWithFootgun ? :) 08:04
lookatme I create an app: github.com/araraloren/perl6-app-snippet 08:11
It is working when I run with `perl6 -Ilib ./bin/snippet` 08:12
But when install with zef
It failed with: Circular module loading detected trying to precompile
lookatme Anyone can give me a hand . :) 08:13
lookatme Appreciate for the help. 08:14
zengargoyle lookatme: when i do `zef install .` and then `perl6 ./bin/snippet` i don't seen any errors about circular. i get errors because of bad command line arguments since i don't know what it's supposed to do. 08:30
lookatme zengargoyle, add -Ilib 08:31
I mean run it without not install
perl6 -Ilib ./bin/snippet
zengargoyle, you install it ? not have exception ? What's your zef version 08:32
zengargoyle i believe it looks mostly the same.
zef:ver<0.1.26>:auth<github:ugexe>:api<> 08:33
lookatme zef info zef 08:34
zengargoyle ^^ 0.1.26
lookatme In perl6-app-snippet directory, is `perl6 -Ilib ./bin/snippet` working fine? 08:35
Hmm, it will print Usage
zengargoyle gist.github.com/080979ef2f763e6d7b...a3243a502f 08:36
lookatme Yeah, it is working 08:37
zengargoyle doing perl6 -Ilib ./bin/snippet (or -I. since you have a META6.json) or using the zef installed version from .../site/bin/snippet all seem ok by me. 08:38
for various definiton of OK :)
lookatme OK, I update my zef first
zengargoyle and maybe dependencies? i didn't have many of the dependencies already installed.
lookatme I install all dependencies, maybe I should update them ? 08:39
zengargoyle i wonder if there is a tool that for an installed module/dist shows the dependencies and versions the precomp'd bits are using. 08:44
lookatme buggable: depend 08:47
:| 08:48
zengargoyle some perl5 modules would have a t/02-versions.t that would just print out all dependencies and the version installed. handy for the "are you using the same stuff i'm using?" questions. 08:50
zengargoyle seems with CUR that could be like magical and go all the way down the dependency tree. 08:50
lookatme zengargoyle, It also throw an exception : gist.github.com/araraloren/c36fd27...03ef3e4a94 08:51
s/also/still/
lookatme That file which precompile failed is Interface/C.pm6 08:54
zengargoyle `ZEF_PLUGIN_DEBUG=1 zef --debug install .`
for more information that somebody might find useful. 08:55
zengargoyle i'm on This is Rakudo version 2017.07-54-g640641876 built on MoarVM version 2017.07-15-g0729f841 but i don't know if that matters at all. 08:56
lookatme gist.github.com/araraloren/c36fd27...03ef3e4a94 08:58
I manual install from source: This is Rakudo version 2017.07 built on MoarVM version 2017.07 08:59
zengargoyle yeah, i'm guessing this is a ugexe question. or somebody else who greally knows the CUR/precomp stuff and can make a better guess. 09:01
lookatme Hmm
ugexe, are you in around ?? :) 09:02
nadim_ geekosaur: hi, I tried the $*var way of passing data to a Block, it worked just fine in a simple example but when put in the code like this: my $*d = 0 ; $block(100) then I get this error: Dynamic variable $*d not found in block <unit> at where I defined the block which is a separate test file. 09:07
lookatme It should be our $*d, I think? 09:10
or guess .
nadim_ I tried that too :) 09:20
nadim_ 'my' also worked fine in a simpler example 09:21
lookatme m: module A { my $*d = 0; }; import A; say ::.keys.grep("\$*d") 09:24
camelia ()
lookatme m: module A { our $*d = 0; }; import A; say ::.keys.grep("\$*d")
camelia ()
lookatme m: module A { our $*d is export = 0; }; import A; say ::.keys.grep("\$*d")
camelia ($*d)
lookatme IDK..
zengargoyle m: sub foo { say $OUTER::x }; my $x = "foo"; foo(); 09:38
camelia foo
zengargoyle m: sub foo { say $UNIT::x }; my $x = "foo"; foo(); 09:39
camelia foo
ufobat hey :) i've got a question regarding prove6 from Tap::Harness. prove from perl5 can handle several -Ipath, prove6 not, isn't that a "bug" 09:48
nadim_ my code here may be completely crappy but the error is not helpful at all. Should I report this error, in the hope it helps get a better error message, or just forget about it completely 09:56
nopaste.linux-dev.org/?1160213
timotimo yeah, that's a compiler explosion that shouldn't happen 10:00
nadim_ timotimo: : hi, I tried the $*var way of passing data to a Block, it worked just fine in a simple example but when put in the code like this: my $*d = 0 ; $block(100) then I get this error: Dynamic variable $*d not found in block <unit> at where I defined the block which is a separate test file. 10:01
nadim_ I'll report the explosion too 10:01
timotimo strange, it should Just Work 10:04
anyway, it's surprising but the space after the A is to blame, i believe
the code expects if there's something after the module name that there has to be an expression 10:05
but it can be an empty arglist, too
so it just reaches into the arglist to pick out the EXPR result, but the rule for arglist never even called EXPR in the first place
nadim_ Good to know that it is analysed before I even finished reporting it ;) 10:06
timotimo will be fixed in a minute 10:07
it only ever reaches into the EXPR to tell the rest of the compiler that it shouldn't complain about "useless use of blah in void context" anyway
nadim_ that's fast 3 mn form finding an error, rporting it, analysing it, to fixing it. 10:08
timotimo Undeclared routine:
xxx used at line 22
nadim_ that would give me an incentive to build a new version.
timotimo that's what it does now
nadim_ sounds much better
timotimo++ 10:09
timotimo committed
nadim_ timotimo: I'd appreciate some help on the $*var error I reported above
timotimo github.com/rakudo/rakudo/commit/3e078d4d47
yep, can i already download the code off of github? 10:10
nadim_ It's compiling here 10:11
timotimo the $*var related code
nadim_ let me fix a branch for you
nadim_ timotimo: Meh! fixed in the latest rakudo 10:20
this is the second error I find in two week that is fixed in the latest, I can only say "Good work and sorry my rporting is too late" 10:21
timotimo oh 10:22
still, i wonder how that happened
dynamic variables are a very important part of the compiler itself
if they are broken in some way, the compiler would completely fall apart 10:23
nadim_ I can still upload the branch
the version I had before was 136 commit behind
nadim_ timotimo: since you have the latest running, Does Test::Meta work for you? It used to but now dies with ===SORRY=== Could not find META6:ver<0.0.4..*> and the latest commit (9 days) says "Fix version matcher" 10:58
nadim_ reported it to the module's github too 11:02
timotimo it breaks in the same way for me 11:20
nadim_ thank you. do you know if J Stowe is here and what nick he has? 11:34
lizmat rabidgravy 11:35
timotimo he's been away from the community for a while now and i miss him :S
timotimo iiuc he was put off by how module- and license-related stuff was handled? 11:36
nadim_ that's a pity 11:39
El_Che I didn't know that :( 11:54
I see twitter post from him once in a while
timotimo right, i see his tweets, too 11:55
Geth doc: 39a460a30d | (Will "Coke" Coleda)++ | doc/Language/rb-nutshell.pod6
missing =end directive
11:59
nadim_ Maybe we should just tell him he is missed and we would like to see him back. 12:02
El_Che send him a phisical card from tpcia 12:03
ilmari he works down the hall from me, actually
faraco m: say "hi"x32 12:11
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3say "hi"7⏏5x32
expecting any of:
infix
infix stopper
postfix
statement end
statement modifier
faraco m: say "hi"*32 12:12
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5hi' (indicated by ⏏)
in block <unit> at <tmp> line 1
faraco m: sub cat_a_string (Str $input --> Str) { return "$input" ~ "z"; } say cat_a_string("world"); 12:15
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3nput --> Str) { return "$input" ~ "z"; }7⏏5 say cat_a_string("world");
expecting any of:
infix
faraco sub cat_a_string (Str:D --> Str) { return $x ~ "z"; } say cat_a_string "heh" 12:23
m: sub cat_a_string (Str:D --> Str) { return $x ~ "z"; } say cat_a_string "heh"
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$x' is not declared
at <tmp>:1
------> 3b cat_a_string (Str:D --> Str) { return 7⏏5$x ~ "z"; } say cat_a_string "heh"
faraco m: sub cat_a_string (Str:D $x --> Str) { return $x ~ "z"; } say cat_a_string "heh" 12:24
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3 (Str:D $x --> Str) { return $x ~ "z"; }7⏏5 say cat_a_string "heh"
expecting any of:
infix
inf…
faraco m: sub cat_a_string (Str:D $x --> Str) { return $x ~ "z" } say cat_a_string "heh"
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3g (Str:D $x --> Str) { return $x ~ "z" }7⏏5 say cat_a_string "heh"
expecting any of:
infix
inf…
faraco m: sub cat_a_string (Str:D $x --> Str) { return $x ~ "z" }; say cat_a_string "heh" 12:25
camelia hehz
faraco hmm, does rakudo lang by default type checked even if you not declaring the data type of the variables? 12:27
lizmat faraco: type checks *always* happen 12:29
if you don't specify a type, the default is Any
lizmat (in most case) 12:29
*s
faraco oh...well, I learnt something new today.
thanks 12:30
araraloren I create an app: github.com/araraloren/perl6-app-snippet 12:31
araraloren There some problem when I use zef install it 12:31
The exception: gist.github.com/araraloren/c36fd27...03ef3e4a94
Anyone have suggestion ? :/ 12:41
moritz araraloren: have you run Test::META over your meta files? 12:42
araraloren No 12:45
moritz try that first please
faraco m: my @pets = <cat dog rabbit>; say map { "I got $_ as pet at home" }, @pets; 12:46
camelia (I got cat as pet at home I got dog as pet at home I got rabbit as pet at home)
faraco m: my @pets = <10 20 30>; say map { $_ * 2 }, @pets; 12:47
camelia (20 40 60)
faraco I see that in docs.perl6.org/routine/map#class_Any doesn't have any (even one) examples. Can I use above as the method example? 12:48
[Coke] faraco: neither of those are using methods.
araraloren I copy the test here: github.com/jonathanstowe/Test-META/#synopsis
faraco oh yeah, let me try with method style.
araraloren It's no problem, moritz
[Coke] Note that there are method examples in the "routine map" section, fwiw. 12:49
faraco oh nevermind then
thanks
araraloren moritz, and it was ok when I run "perl6 -Ilib ./bin/snippet" under the project directory 12:50
faraco oh wap, there is example just below it. I should read the doc more carefully.
[Coke] the docs could also use review, no doubt. :) 12:55
[Coke] btw, when making the ruby -> perl 6 doc go through the examples tester, found several of the examples of Perl 6 had leftover ruby-isms that hadn't been converted, as well as some claims about what P6 could do that failed to even compile. 12:58
faraco [Coke]: you mean like this? - my &add = -> $n, $m { $n + $m }; # Perl 6 addition function 13:26
faraco I'm thinking on trying 13:26
m: my &add = sub ($n, $m) { $n + $m }; say &add(2, 3);
camelia 5
faraco not sure if that idiomatic Perl 6
or, Rakudo language :P 13:27
jnthn It's a long way to write my &add = &infix:<+> 13:28
Which is a long way to write my &add = &[+] 13:29
mspo can somoeone help me figure out what this means? Serialization Error: missing static code ref for closure 'BUILD' 13:31
[Coke] there's a huge difference between "idiomatic" and "can't compile" 13:34
er, "not idiomatic".
I just made sure what was there was at least compilable. bare minimum.
faraco oh, I thought you idiomatic by " the examples of Perl 6 had leftover ruby-isms that hadn't been converted" 13:35
meant*
[Coke] I mean literal ruby syntax that would never work, like class Person\n#guts of class\n#end . o O (not using the {} to delimit the class def) 13:36
faraco I see 13:37
araraloren jnthn, do you have time help me figure out my module problem ? 13:41
jnthn araraloren: Not much, but circular module loading means there's a `use` in one module that eventually leads to a `use` of the original module 13:52
araraloren jnthn, but why it is working when I run "perl6 -Ilib ./bin/snippet" in project directory 13:53
nadim_ ilmari: then go tell him in person please. I did write a little messaage in the bug report I added this morning. 13:54
timotimo araraloren: have you considered that one env var that gives you module loading debug output? 13:55
araraloren timotimo, such as ? 13:56
you mean I make some debug output in my module ?
timotimo no 13:58
set RAKUDO_MODULE_DEBUG to a non-zero value 13:59
in the environment
araraloren ok 14:06
timotimo, thanks
Geth doc: 9125507a4c | (Elizabeth Mattijsen)++ | doc/Language/control.pod6
Fix spello, spotted by brian d foy++
14:09
araraloren timotimo, too many debug output. What should I pay attention to ? 14:11
araraloren I found the problem, thanks jnthn timotimo and zengargoyle 14:29
I make a mistake of module file name in provides of META. 14:30
Skarsnik Hello 15:05
araraloren Skarsnik, hi
faraco hi 15:06
ingy how do I determine if an object is an instance of a user defined class? 15:15
moritz $obj ~~ TheClass
or are you talking about *any* user-defined class?
then the answer is: we intentionally don't make a strict distinction between built-in and user-defined classes 15:16
ingy *any*
how do I determine if a value is a class?
moritz as opposed to a role? or an instance? or what are you interested in? 15:17
ingy class Foo {}; my $c = Foo; say $c ~~ Class; 15:18
moritz m: sub is-class(Mu $x) { not $x.defined && $x.HOW ~~ Metamodel::ClassHOW }; say is-class($_) for 1, Int, Positional
camelia False
True
True
moritz hm, that probably considers Positional a class due to auto-punning
ingy thanks 15:29
ingy that seems a little... uh, not so elegant. 15:36
but I guess it's not a common need 15:38
Geth ecosystem: c8c50062b9 | loren++ (committed using GitHub Web editor) | META.list
add App::snippet

an app run C/C++ or other language snippet code
15:39
araraloren :) 15:40
ingy m: say Perl6::Metamodel::ClassHOW.^methods 15:43
camelia Could not find symbol '&ClassHOW'
in block <unit> at <tmp> line 1
ingy m: use Perl6::Metamodel::ClassHOW; say Perl6::Metamodel::ClassHOW.^methods 15:44
camelia ===SORRY!===
Could not find Perl6::Metamodel::ClassHOW at line 1 in:
/home/camelia/.perl6
/home/camelia/rakudo-m-inst-2/share/perl6/site
/home/camelia/rakudo-m-inst-2/share/perl6/vendor
/home/camelia/rakudo-m-inst-2/share/perl6…
ingy m: say Metamodel::ClassHOW.^methods
camelia (archetypes new new_type add_fallback compose roles role_typecheck_list concretization is_composed setup_junction_fallback find_method_fallback has_fallbacks submethod_table private_method_table invocation_attr_name parents cache_get setup_mixin_cache mu…
ingy locally that give me: No such method 'gist' for invocant of type 'NQPRoutine' 15:47
This is Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda 15:48
araraloren m: say 1.HOW; say 1.HOW.^methods; 15:50
camelia Perl6::Metamodel::ClassHOW.new
(archetypes new new_type add_fallback compose roles role_typecheck_list concretization is_composed setup_junction_fallback find_method_fallback has_fallbacks submethod_table private_method_table invocation_attr_name paren…
ingy araraloren: I get same error here with that 15:52
araraloren ingy, what error ? 15:54
such as Perl6::Metamodel::HOW is an implementation class of Perl6.
araraloren You can not found document in docs.perl6.org. 15:54
ingy 11:47:12 ingy | locally that give me: No such method 'gist' for invocant of type 'NQPRoutine'
araraloren What are you running ? 15:55
the code
ingy say 1.HOW; say 1.HOW.^methods;
evalable6 Perl6::Metamodel::ClassHOW.new
(archetypes new new_type add_fallback compose roles role_ty…
ingy, Full output: gist.github.com/cc34a4cadb725eedd4...7ba0f9c44d
araraloren What's your perl6 version ?
perl6 -v
ingy 11:48:04 ingy | This is Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda 15:56
its all 10 lines up
araraloren The last version is 2017.07 15:57
ingy, you can update your rakudo version, follow this : github.com/nxadm/rakudo-pkg/releases
ingy I'll turn it off and back on again 15:58
araraloren I gotta sleep now 15:59
you can ask other people, bye
[Coke] mst: any idea where to report that strawberryperl.com is missing? (looks like DNS vanished) 16:16
(oh, maybe tpf slack) 16:17
mst might be worth a try
also ask #p5p on irc.perl.org 16:18
faraco hi, I'm trying to use Inline::Perl5 with a local module. I tried using use lib 'lib', but it says 'cannot locate Pong.pm'. Why it doesn't detect my local module? 16:28
here is my code - pastebin.com/BuXvUKN3 16:30
I have similar script in Perl 5 working just fine, and I launched the program with perl6 -Ilib script.p6 16:31
but it doesn't work.
ilmari faraco: did you install Pong.pm into the right perl5's @INC? 16:32
use lib:from<Perl5> 'lib';
if it's in ./lib/
faraco I thought calling perl6 -Ilib is sufficient for that.
ilmari no, that only affects perl6's module path
faraco ah, I see. Thanks for the explanation. :) 16:33
ilmari++
ilmari see the fourth example under github.com/niner/Inline-Perl5#load...l-5-module
faraco I should read the doc carefully next time.
dwimmy How do search the logs of this channel? Tried site search on Google but without success. 16:52
faraco irclog.perlgeek.de/perl6/ 16:54
how about that?
dwimmy Correction, site search failed on colabti.org/irclogger/irclogger_logs/perl6 16:55
But works on irclog.perlgeek.de. Thanks for the tip!! 16:56
faraco np :) 16:57
[Coke] if I have an array of Pairs, is there a for loop subsignature I can construct that will separate out the key/value ? 17:26
moritz m: my @a = a => 1, b => 2; for @a -> (:$key, :$value) { say "$key=$value" } 17:28
camelia a=1
b=2
moritz [Coke]: ^^
[Coke] ah, have to use the actual attribute names. Danke. 17:31
moritz m: my @a = a => 1, b => 2; for @a -> [$key, :$value] { say "$key=$value" } # don't think that works, but worth checking 17:42
camelia Type check failed in binding to parameter '<anon>'; expected Positional but got Pair (:a(1))
in block <unit> at <tmp> line 1
perlpilot It would be interesting if there was a way to alias them to some other name. something like for @a -> (:$k(key), :$v(value)) { ... } 17:51
yoleaux 29 Jul 2017 02:20Z <zengargoyle> perlpilot: are you still maintaining Git::Wrapper?
perlpilot Not that useful here, but with other classes it might be (especially coupled with *% so that you don't have to specify *all* the attrs)
perlpilot zengargoyle: github.com/perl6/ecosystem/blob/ma....list#L253 :-) 17:52
faraco m: say <hello cat> 17:55
camelia (hello cat)
faraco m: say <hello cat>.comb 17:56
camelia (h e l l o c a t)
faraco m: say.words.comb
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of bare "say"; in Perl 6 please use .say if you meant to call it as a method on $_, or use an explicit invocant or argument, or use &say to refer to the function as a noun
at <tmp>:1
--…
faraco m: say <hello cat>.words.comb
camelia (h e l l o c a t)
b2gills m: my @a = a => 1, b => 2; for @a -> (:key($l), :value($r)) { say "$l=$r" } 18:00
camelia a=1
b=2
perlpilot ah. I think I knew that at some point, but totally forgot. 18:01
b2gills unfortunately doesn't work with :key(\k)
AlexWithFootgun m: my @a = a => 1, b => 2; for @a».kv -> ($l, $r) { say "$l=$r" } 18:49
camelia a=1
b=2
AlexWithFootgun this is a little bit shorter I guess?
it is also faster, for some reason 18:50
quite noticeably 18:52
m: my @a = a => 1, b => 2; for @a».kv { say "$^l=$^r" } 18:53
camelia a 1=b 2
AlexWithFootgun oops 18:54
wrong :)
m: my @a = a => 1, b => 2; { for @a { my $l = .key; my $r = .value; my $x = "$l=$r" } } for ^9999; say now - BEGIN now 18:55
camelia 0.1267656
AlexWithFootgun m: my @a = a => 1, b => 2; { for @a { my $l = .key; my $r = .value; my $x = "$l=$r" } } for ^99999; say now - BEGIN now
camelia 0.8706918
Skarsnik xD
AlexWithFootgun m: my @a = a => 1, b => 2; { for @a -> (:key($l), :value($r)) { my $x = "$l=$r" } } for ^99999; say now - BEGIN now
camelia 9.18430289
AlexWithFootgun I mean… well… :)
AlexWithFootgun AlexDaniel 18:57
oops
El_Che is someone having trouble with zef? I wonder if it's related with the github problems. THe weird thing is that can manually clone the modules. While zef dies on fetch: pastebin.ubuntu.com/25215145/ 19:10
mspo related to the github outage? 19:16
El_Che mspo: I saw github was having trouble 19:17
ugexe you can also refresh the github.com page and have it work some times 19:54
El_Che looking at there status graphs it was a pretty big downtime 19:59
El_Che (solution to my zef problem doesn't seem to be a fetch problem. rm -rf ~/.perl6/* and reinstalling zef did the trick) 20:05
ugexe i fixed a bug with the git backend in the last update fwiw
but i wouldnt think it would have caused your problem 20:06
El_Che ugexe: is $*REPO the canonical way to get the default dir where modules are installed by default? 20:07
zengargoyle ugexe: does zef have an option that could take a module/dist (either being installed or already installed) and dump out the full dependency chain with ver/auth/api that will be/was used?
El_Che ^-------- interested by that as well 20:08
ugexe there is no rakudo-default location for installed modules. zef chooses from CompUnit::RepositoryRegistry.repository-for-name('site' or 'home') 20:09
zengargoyle because araraloren had a circular dependency problem last night that i did not get when i installed the code. 20:09
ugexe they were also using -Ilib i believe 20:10
zengargoyle i'm imagining that because i didn't have the dependecies installed allready, i got newer ones then he had on his system. 20:10
ugexe all you can do is `zef install ... --dry` and look at the output 20:11
El_Che ugexe: I am playing a little with bundles of modules (a full module tree for a program), I was thinking of putting that in a bundler specific dir in $*REPO (which seems to be the same as CompUnit::RepositoryRegistry.repository-for-name('home') )
zengargoyle thanks, i'll try --dry sometime. 20:12
ugexe their problem was their meta file was incorrect 20:17
zengargoyle then why did it work when i did it?
that's my big question.
ugexe because you probably did not have any cruft from that module already installed 20:18
zengargoyle heh, i guess that's close enough to different versions of things already installed. to make sense to me. :) 20:19
zengargoyle i almost recommended nuking ~/.perl6 and trying again... 20:20
ugexe yes, ~/.perl6 has been problematic as of late 20:21
zengargoyle and i did the permissions thing and use site.... 20:23
zengargoyle so you can have multiple versions of modules installed, but what about the scripts that get put into somewhere/bin? 20:24
zengargoyle are we just stuck with the latest one installed... 20:24
ugexe a bin wrapper gets installed that is intended to let you pick (although its a bad idea since it steals --name --auth --ver for your script) 20:25
otherwise the *newest* is supposed to be picked (although atm its the newest *in whatever repo it finds it in first*) 20:26
zengargoyle ah, can't say i've ever looked at what's in that script. :)
ugexe which is usually ~/.perl6
zengargoyle i thought it was just putting the raw .pl file there.
ugexe hence recent reports of people updating zef but still getting bogus behavior from `zef install ...` - its still using some old version from before 2017.06/7 20:27
while before upgrading the correct version was getting picked (so probably didn't even realize such an old zef was installed)
this issue is addressed in #1125 20:28
zengargoyle thanks for the explaining. :) 20:31
i still want something that lets me start with just depends A::B, C::D and test and generate A::B:ver<0.1>:auth<foo>:api<> C::D:ver<4>:auth<bar>:api<1> that can go back into META6 20:33
or to have a 01-versions.t that dumps out a list. it's really nice for the "works for me" troubleshooting. 20:35
zengargoyle wonders if maybe there's already a Test::something that does that... 20:36
ugexe i liek to use `zef list --installed` in travis-ci for that
since nothing else should be installed in that instance 20:37
zengargoyle excellent idea!
nadim_ can I not retun a value in a map? say I don't want anything returned for even numbers. or do i have to grep before or after? 20:46
ugexe that reminds me, i forgot you can do `zef list cached` (to list whats in the cache)
Skarsnik I am curious, why zef replaced panda? 20:47
nadim_ m say (1, 2, 3, 4).map: { $_ == 2 ?? Nil !! $_} ; 20:48
m: say (1, 2, 3, 4).map: { $_ == 2 ?? Nil !! $_} ;
camelia (1 Nil 3 4)
nadim_ m: say (1, 2, 3, 4).map: { $_ == 2 ?? () !! $_} ;
camelia (1 () 3 4)
nadim_ m: say (1, 2, 3, 4).flatmap: { $_ == 2 ?? () !! $_} ; 20:49
camelia (1 3 4)
moritz Skarsnik: zef has the huge advantage that it's maintained
I'm sure there are other reasons :-)
nadim_ m: say (1, 2, 3, 4).flatmap: { $_ == 2 ?? () !! ($_,3)} ; 20:50
camelia (1 3 3 3 4 3)
nadim_ m: say (1, 2, 3, 4).flatmap: { $_ == 2 ?? () !! [$_,3]} ;
camelia (1 3 3 3 4 3)
zengargoyle zef supports install-to locations...
nadim_ m: say (1, 2, 3, 4).flatmap: { $_ == 2 ?? () !! $[$_,3]} ;
camelia ([1 3] [3 3] [4 3])
nadim_ m: say (1, 2, 3, 4).flatmap: { $_ == 2 ?? () !! $($_,3)} ;
camelia ((1 3) (3 3) (4 3))
zengargoyle doesn't really remember enough about pands anymore ... 20:52
ingy m: sub foo { return {x => 1, y => 2} }; my ($h, $o) = foo; say $h.gist; say $o.gist' 20:56
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3($h, $o) = foo; say $h.gist; say $o.gist7⏏5'
expecting any of:
infix
infix stopper
postfix
statement end
ingy m: sub foo { return {x => 1, y => 2} }; my ($h, $o) = foo; say $h.gist; say $o.gist
camelia x => 1
y => 2
ingy how do I call this foo so that I get a hash and a Nil? 20:57
ingy why does that split my hash into 2 poirs? 20:58
geekosaur it's destructuring 21:03
geekosaur docs.perl6.org/language/variables#...assignment 21:05
ugexe m: sub foo { return {x => 1, y => 2} }; my (%h, $o) = foo; say %h.gist; say $o.gist 21:10
camelia {x => 1, y => 2}
(Any)
Zoffix That makes $o pointless 21:11
m: sub foo { return {x => 1, y => 2}, 42 }; my (%h, $o) = foo; say %h.gist; say $o.gist 21:12
camelia Odd number of elements found where hash initializer expected:
Found 5 (implicit) elements:
Last element seen: 42
in block <unit> at <tmp> line 1
geekosaur ingy, if you check irc logs from about, hm, 14 or 15 hours ago, you'll find where I was explaining the difference between $ and % sigil behavior to jeromelanteri. this is related.
if you use % it captures the whole hash, fi you use $ it destructures the hash
Zoffix m: sub foo { return {x => 1, y => 2}, 42 }; my ($h, $o) = foo; say $h.gist; say $o.gist 21:12
camelia {x => 1, y => 2}
42
tinita Zoffix: $o might be pointless in this example, but not in the actual code 21:13
Zoffix tinita: ? hash gets all the values, so it's pointless in that code. 21:14
tinita instead of calling foo, you would call $some-object.foo, and some return only {...}, some might return an additional elememnt
Zoffix: i see
Zoffix: i thought you meant the original example 21:16
Zoffix nadim_: the Hash ~~ Hash thing has been fixed.
Skarsnik: zef replaced panda because it had more features and panda had some limitations that weren't easy to fix. 21:17
lizmat and another Perl 6 Weekly hits the Net: p6weekly.wordpress.com/2017/07/31/...r-smaller/ 21:22
Zoffix ingy: I don't know about "destructuring" people call it. I understand my (...) = ... as simply list assignment. Your Hash.list gives individual pairs which is what you get. You can also use binding, in which case the LHS functions just like signature of a routine (though there are some buggy/NYI bits still), while RHS is a capture. So you could write `sub foo { return {x => 1, y => 2} }; my ($b?, *%o) := foo; 21:24
dd [%o, $b]` and %o will be the hash. Unsure of a good way to handle both cases (when $o is given too), without modifying the `return` line
Zoffix lizmat++ # good weekly 21:30
wow, so much new content :o hard to keep up. 21:31
moritz lizmat++ indeed
lizmat tell me about it :-)
ingy geekosaur: thanks. this kinda sucks when I have an api that wants 'return $hash-or-array, $optional-hash-of-options;' 21:34
seems like you need to return Nil for the 2nd arg if you don't want to return anything
the first return value can be any object, so I can't really use %foo, %options 21:35
and $foo, %options still deconstructs
geekosaur more precisely you probably want Any 21:36
instead of Nil
(Nil will work but it's not so much "undef" as "quiet failure")
or maybe Hash depending on how typed you're being 21:37
this feels one-arg-rule-ish?
ingy I'd rather not put the burden on the returner. I wanted then to 'return $node, $options-hash' or just 'return $node' 21:37
is there a way to write 'my $thing, %options = $callback(...)' and not have it destructure the first arg? 21:39
geekosaur m: sub foo { return {x => 1, y => 2} }; my ($h, $o) = foo,; say $h.gist; say $o.gist 21:40
camelia {x => 1, y => 2}
(Any)
geekosaur note comma
ingy that works for me 21:41
geekosaur this is from the thing about destructuring assignment I sent earlier
gfldex m: my &block := { state $n = 0; say $n++; last if $n > 3; }; (0..∞).map: &block 21:41
camelia 0
1
2
3
gfldex m: sub loop(&c){ (0..∞).map(&c) }; my &block := { state $n = 0; say $n++; last if $n > 3; }; loop(&block) 21:45
camelia 0
1
2
3
gfldex TIMTOWTL 21:46
ingy there's more than one way to trick lisp? 21:49
ugexe i like to use the form `state $n += 1 andthen {last if $_ > 3};` if i have to use an explicit state var
geekosaur ...to lose?
gfldex loop
geekosaur (yes, I figured)
nadim_ m: my Capture $:wc = (1, :n(1)) 21:50
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use placeholder parameter $:wc outside of a sub or block
at <tmp>:1
------> 3my Capture $:wc7⏏5 = (1, :n(1))
nadim_ m: my Capture $c = \(1, :n(2)) ; dd $c 21:52
camelia Capture $c = \(1, :n(2))
nadim_ m: my Capture $c = \|(1, :n(2)) ; dd $c 21:53
camelia Capture $c = \((1, :n(2)))
nadim_ arff! I have a list with value and Pairs, if I try to make a Capture out of it, everything ends up in the Captures's list, ie: the Paires are not named parameters, so I can't use the capture. how does one make a capture out of a list that contains Pairs? 21:54
lizmat nadim_: can't really think of a fast way other than creating a separate list and hash yourself 21:59
nadim_ lizmat: thanksd, that's a bit of a pain. I have tests with multiple arguments that I have in a list, wanted to make a capture to call a method 22:02
nadim_ it's a pain but works whenn the number of arguments is fixed but I have not found a way for variable arguments 22:02
lizmat I could see a Capture.new-from-iterable existing
gfldex lizmat: your answer on stackoverflow is incomplete, you need to overload ASSIGN-POS as well 22:03
nadim_ lizmat: I think that would be very useful
lizmat gfldex: the string is immutable, so what would ASSIGN-POS change ? 22:06
nadim_ is there a way to do my(@pass, @miss) = @list.sorting_grep {conditions} ? where sorting grep returns two list/seq 22:08
gfldex lizmat: it would create a new Str with the char (and following chars) at $pos replaced with the given substring 22:09
nadim_ there is I think but I don't remember the mane
name
gfldex lizmat: it doesn't make much sense but the OP didn't ask for something sensible
lizmat gfldex: going to leave it as an exercise to the reader 22:10
ugexe my (@a, @b) := (1..10).classify: { $_ > 1 ?? 'a' !! 'b' }; say @a.perl; say @b.perl
m: my (@a, @b) := (1..10).classify: { $_ > 1 ?? 'a' !! 'b' }; say @a.perl; say @b.perl
camelia Too few positionals passed to '<unit>'; expected 2 arguments but got 0
in block <unit> at <tmp> line 1
gfldex lizmat: maybe you could leave a note that it's left out intentional 22:10
geekosaur nadim_, this is the same question as earlier, only in reverse 22:11
m: sub foo { return <a b>, <c d> }; my ($h, $o) = foo; say $h.gist; say $o.gist
camelia (a b)
(c d)
ugexe m: my (:@a, :@b) := (1..10).classify: { $_ > 1 ?? 'a' !! 'b' }; say @a.perl; say @b.perl 22:12
camelia [2, 3, 4, 5, 6, 7, 8, 9, 10]
[1]
gfldex lizmat: and link to: docs.perl6.org/language/subscripts...bscripting
nadim_ my (:@a, :@b) := (1..10).classify: { $_ > 1 ?? '1' !! '2' }; say @a.perl; say @b.perl 22:14
lizmat gfldex++ # added link
nadim_ what's the my :@a construct?
ugexe takes a named param 'a' 22:16
nadim_ I see, clever 22:19
ugexe m: perl.say for (1..10).classify: { $_ > 1 ?? "a" !! "b" }
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
perl used at line 1
ugexe m: .perl.say for (1..10).classify: { $_ > 1 ?? "a" !! "b" }
camelia :b($[1])
:a($[2, 3, 4, 5, 6, 7, 8, 9, 10])
joy in a book on perl, i saw this method print(\s) { ... } , what does the \ before s do? 22:21
gfldex joy: see docs.perl6.org/language/variables#...riables%29 22:23
joy oh yes! thanks
zengargoyle .tell jeromelanteri nicqrocks applied the pull-requests and Git::Wraper:ver<0.0.8> fixes the precomp thing. you don't *have* to use your own patched copy anymore. 22:43
yoleaux zengargoyle: I'll pass your message to jeromelanteri.
zengargoyle .tell jeromelanteri and perlpilot confirms that the nicqrocks fork that's in the ecosystem is the one that should be used. 22:44
yoleaux zengargoyle: I'll pass your message to jeromelanteri.
Geth whateverable/master: 18 commits pushed by (Aleks-Daniel Jakimenko-Aleksejev)++
review: github.com/perl6/whateverable/comp...f23f6ce2b4
23:14
AlexDaniel 18 commits \o/
Geth whateverable: 3891214543 | (Aleks-Daniel Jakimenko-Aleksejev)++ | t/quotable.t
Tests for Quotable

Issue #124 can now be closed. TODO-ed tests for #192 were also added.
23:16
AlexDaniel poof! 23:25
lizmat oh noes!