»ö« 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 Zoffix on 25 May 2018.
jnthn This is the way that HyperSeq and RaceSeq work 00:00
SmokeMachine yes
hum...
b2gills have it so each method returns a new instance that knows about the previous instance
jnthn They interpret the operations they knwo how to parallelize in their own way, and then fall back on being normally iterable once you do an operation outside of that set.
Much as in this case you want to stack up operations while in the while/ignore filtering language, and then iterate the result once an operation like .map is appended 00:01
SmokeMachine jnthn: Thanks! Ill try that! 00:02
jnthn :) 00:03
SmokeMachine++
timotimo i think we'll really want a good ordered hash in the ecosystem at some point; the question keeps coming up
(i can barely keep up with my one module …) 00:04
MasterDuke timotimo: isn't that what ArrayHash does? 00:07
timotimo oh, is it?
cool. 00:08
MasterDuke TimToady: locally i get results consistent with that for more iterations, but benchable would time out....
eco: ArrayHash
buggable MasterDuke, ArrayHash 'An array in a hash in an array... like a turducken': git://github.com/zostay/perl6-ArrayHash.git 1 other matching results: modules.perl6.org/s/ArrayHash
SmokeMachine eco: OrderedHash 00:17
buggable SmokeMachine, OrderedHash 'blah blah blah': modules.perl6.org/dist/OrderedHash:...20Oliveira
jnthn Nice description :P 00:19
timotimo "Write Me!"
SmokeMachine :(
fake_space_whale If I am naming a module with the intent of possible uploading the package to Perl 6 CPAN, what is the proper way to choose a prefix like how other modules have names like JSON::tiny? 00:36
s/possible/possibly/ 00:37
timotimo i don't have a good suggestion. only that we tend to have App:: for things that we expect users to directly invoke like ... like an application i guess 00:42
fake_space_whale so the norm would be look at existing modules and sorta back solve for a good prefix from similar modules? 00:50
timotimo that's what I'd do (but i don't have many modules at all)
MasterDuke you also have a lot more freedom to re-use names since they can be distinguished by author (when 'use'ing them) 00:53
timotimo right
Zoffix Weird: "dd ['ZZZZ', achar, .<condition>, achar ~~ .<condition>];" gives me ["ZZZZ", "A", /<[A..Za..z\d+-]>/, Bool::False] 01:09
m: say "A" ~~ /<[A..Za..z\d+-]>/
camelia 「A」
Zoffix why is it false there :S
oh, the $_ var 01:10
m: $_ := {:cond(/<[A..Za..z\d+-]>/)}; my \achar = 'A'; dd ['ZZZZ', achar, .<condition>, achar ~~ .<condition>];
camelia ["ZZZZ", "A", Any, Bool::False]
Zoffix m: $_ := {:cond(/<[A..Za..z\d+-]>/)}; my \achar = 'A'; dd ['ZZZZ', achar, .<condition>, .<condition>.ACCEPTS: achar];
camelia ["ZZZZ", "A", Any, Bool::True]
Zoffix k
lookatme evalable6: say "I am working"; 01:13
evalable6 I am working
lookatme How to add command line argument to robot evalable6 ?
MasterDuke evalable6: source 01:16
evalable6 MasterDuke, github.com/perl6/whateverable
MasterDuke lookatme: github.com/perl6/whateverable/blob...valable.p6 01:17
lookatme evalable6: pastebin.com/4hqBMvzP -w -a -b 01:19
evalable6 lookatme, It looks like a URL, but mime type is ‘text/html; charset=utf-8’ while I was expecting something with ‘text/plain’ or ‘perl’ in it. I can only understand raw links, sorry.
lookatme evalable6: pastebin.com/raw/4hqBMvzP -w -a b
evalable6 lookatme, Successfully fetched the code from the provided URL
done the supplier
MasterDuke lookatme: i think the '-w -a b' will just get ignored 01:23
lookatme yes, MasterDuke 01:24
I am now review the code find something can set command line arguments :)
timotimo you can perhaps overwrite/mutate @*ARGS from user code at the earliest stage, like with a BEGIN block 01:25
lookatme oh, right :) 01:26
evalable6: pastebin.com/raw/sAJjAmzD 01:28
evalable6 lookatme, Successfully fetched the code from the provided URL
In Parser: Emit the option -w
In MAIN: GOT MESSAGE: The -w matched ? FAILED
In MAIN: GOT M…
lookatme, Full output: gist.github.com/88d6984b67b5bba78e...2644ddd38d
AlexDaniel e: chdir ‘sandbox’; run ‘wget’, ‘pastebin.com/raw/sAJjAmzD’ 01:32
evalable6 --2018-07-18 03:32:44-- pastebin.com/raw/sAJjAmzD
Resolving
pastebin.com (pastebi…
AlexDaniel, Full output: gist.github.com/01acf9a0226554b7aa...cb63c1ba38
AlexDaniel e: run ‘sandbox/sAJjAmzD’, 42 01:33
evalable6 (exit code 1) The spawned command 'sandbox/sAJjAmzD' exited unsuccessfully (exit code: 1)
in block <unit> at /tmp/jCd2ivmJRt line 1
AlexDaniel e: run <perl6 sandbox/sAJjAmzD>, 42
evalable6 In Parser: Emit the option -w
In MAIN: GOT MESSAGE: The -w matched ? FAILED
In MAIN: GOT M…
AlexDaniel, Full output: gist.github.com/8b7b49309bed9dd236...d9707386c4
AlexDaniel I mean, that's how you can do it ↑
well, that's one way 01:34
there's a better one
e: gist.github.com/AlexDaniel/f501ce8...f900c87e24 01:35
evalable6 AlexDaniel, Using file “run.p6” as a main file, other files are placed in “sandbox/”
In Parser: Emit the option -w
In MAIN: GOT MESSAGE: The -w matched ? FAILED
In MAIN: GOT M…
AlexDaniel, Full output: gist.github.com/e3049b93ddff0ce345...0784d32c3c
AlexDaniel lookatme: ↑
that probably makes more sense :)
lookatme :( Can not access gist 01:36
AlexDaniel what do you mean?
lookatme Stupid Firewall
China
AlexDaniel oooh 01:37
well, that's unfortunate…
whateverable doesn't support multifile thingies anywhere else besides github
but you can still `wget` whatever you need :) 01:38
lookatme yeah, I just want ask is this good practice, emit something (like $mc) to a supply, and get if it is done well through the interface of the $mc
like .available
AlexDaniel e: spurt ‘sandbox/foo’, ‘sub MAIN($x) { say ‘hello=’, $x }; run <perl6 sandbox/foo>, 42; 01:39
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/kK2SUl2gwQ
Unable …
AlexDaniel, Full output: gist.github.com/df427a33956d4bd34c...48e834fee1
AlexDaniel e: spurt ‘sandbox/foo’, 「「「sub MAIN($x) { say ‘hello=’, $x }」」」; run <perl6 sandbox/foo>, 42;
evalable6 (exit code 1) 'sandbox/foo' is a directory, cannot do '.open' on a directory
in block <unit> at /tmp/yzMPwJJaOp line 1
AlexDaniel e: spurt ‘sandbox/baz’, 「「「sub MAIN($x) { say ‘hello=’, $x }」」」; run <perl6 sandbox/baz>, 42;
evalable6 WARNINGS for /home/bisectable/git/whateverable/sandbox/baz:
Useless use of "「sub MAIN($x) { say ‘hello=’, $x }」" in expression "「sub MAIN($x) { say ‘hello=’, $x }」" in sink context (line 1)
AlexDaniel e: spurt ‘sandbox/baz’, 「sub MAIN($x) { say ‘hello=’, $x }」; run <perl6 sandbox/baz>, 42; 01:40
evalable6 hello=42
AlexDaniel yay \o/
lookatme oh, I see 01:41
AlexDaniel lookatme: can't answer your question unfortunately, my brain is shutting down :)
AlexDaniel 💤
lookatme oh .. :)
haha 01:42
e: run < ls sandbox >;
evalable6 040-request.t
0.806238500539699.lock
answer
aws-s3-perl6
basic.t
baz
bombz
can
data
DBIish…
lookatme, Full output: gist.github.com/cc269f232c3902bbd6...a228c1f96b
lookatme thanks AlexDaniel 01:43
Geth doc: 7b0b78450f | Coke++ | doc/Type/IO/Handle.pod6
This example can't work without modules installed
02:32
synopsebot Link: doc.perl6.org/type/IO::Handle
fbynite is there a p6 module equivalent to p5's Math::Round? 02:48
lookatme m: 2.333.round.say; # ? 02:51
camelia 2
lookatme what that Math::Round do ?
s/what/what's/ 02:52
fbynite, is this helpful ? 02:53
^^
fbynite slightly, except that I want to round to the nearest tenth 02:55
lookatme fbynite, they are many other method : docs.perl6.org/type/Int#(Real)_method_round 02:56
oh, I see the module example 02:58
you need a `nearest` ? 02:59
fbynite yep, exactly - I'm reading the link you sent 03:00
looks like I need to set the scale
lookatme m: 2.333.round(10).say; # ? 03:01
camelia 0
lookatme m: 15.round(10).say; # ?
camelia 20
lookatme m: 5.round(10).say; # ?
camelia 10
fbynite 2.333.round(0.1).say
evalable6 2.3
lookatme m: 14.999.round(10).say; # ? 03:02
camelia 10
fbynite 14.999.round(0.1).say
evalable6 15
fbynite lookatme: thanks! 03:03
lookatme welcome 03:03
m: (-45).round(10).say 03:04
camelia -40
lookatme fbynite, but notice the negative number, it have different result with that nearest in Math::Round 03:05
fbynite -45.round(10).say 03:07
evalable6 WARNINGS for /tmp/CeGRYBCS83:
50
Useless use of "-" in expression "-45.round(10).say" in sink context (line 1)
fbynite using the REPL, I got 50 03:08
lookatme you should parentheses the -45 03:09
say (-45).round(10)
evalable6 -40
lookatme say -45.round(10)
evalable6 -50
warriors cool 03:52
i think -45.round(10) is treated as -(45.round(10)) 03:53
Kaiepi i won't be able to contribute for a while since i'll be in the mental hospital starting tomorrow 04:24
sorry 04:25
benjikun Kaiepi: I hope everything turns out okay bud 04:34
Kaiepi thanks 04:42
kjk MasterDuke: so ,= is a lot faster than <<=<< ? Am I interpreting the benchmark result right? 05:04
sarna hey, how to call a method from another method? 07:57
self.method()? 07:58
lookatme sarna, yes, right 08:05
m: class Foo { method bar() { self.foo(); }; method foo() { "CALL ME".say; }; }; Foo.new.bar; 08:06
camelia CALL ME
sarna ok :) thought maybe there was another way
lookatme sarna, another way ? 08:06
sarna lookatme: dunno really. it doesn't matter :D 08:07
lookatme this is the official way :)
geekosaur aside from foo(self:)
lookatme if you want another way, it maybe ^^
geekosaur which is just a different way to say self.foo()
lookatme yeah, like geekosaur said
foo(self, ...)
geekosaur no, it has to be a colon so it's the invocant rather than a parameter 08:08
geekosaur you do find some things that work that way, but that's because there are both method and sub forms defined for them 08:08
sarna cool beans
lookatme maybe foo(self: ...) ?
geekosaur right, foo(self: other parms here)
lookatme m: class Foo { method bar() { $?CLASS.^lookup("foo").(self); }; method foo() { "CALL ME".say; }; }; Foo.new.bar; 08:09
camelia CALL ME
lookatme m: class Foo { method bar() { $?CLASS.^lookup("foo").(self, 4); }; method foo($a) { "CALL ME $a".say; }; }; Foo.new.bar; 08:10
camelia CALL ME 4
lookatme m: class Foo { method bar() { $?CLASS.^lookup("foo").(self: 4); }; method foo($a) { "CALL ME $a".say; }; }; Foo.new.bar;
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3od bar() { $?CLASS.^lookup("foo").(self:7⏏5 4); }; method foo($a) …
lookatme It's not working, the colon
sarna btw, can I declare a method inside a method? like with subs 08:12
lookatme yes sarna
lookatme `my method` would works fine 08:12
sarna my method inside that other method? 08:13
I don't want it to be visible from the outside, because, well, it wouldn't make sense from the outside
lookatme m: my method outside(self: $a) { say self, $a; }; say outside(42, ".");
camelia 5===SORRY!5=== Error while compiling <tmp>
Invalid typename 'self' in parameter declaration.
at <tmp>:1
------> 3my method outside(self7⏏5: $a) { say self, $a; }; say outside(42,
lookatme m: my method outside($a) { say self, $a; }; say outside(42, "."); 08:14
camelia 42.
True
lookatme sarna, if you want private method, you can add ! before the method name 08:15
m: class Foo { method !foo($a) { "CALL ME $a".say; }; }; Foo.new.foo: 4;
camelia No such method 'foo' for invocant of type 'Foo'. Did you mean '!foo'?
in block <unit> at <tmp> line 1
sarna hmm I don't know if I explained correctly 08:16
lookatme I recommend you read the documents about Class docs.perl6.org/language/classtut#i...methods%29
sarna, you can use private method in other method ,but not outside 08:17
that's what I said
sarna what I'm trying to accomplish: 08:21
m: sub foo() { sub bar() { say 'hi'; }; bar(); }; foo();
camelia hi
sarna m: sub foo() { sub bar() { say 'hi'; }; bar(); }; foo(); bar();
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
bar used at line 1. Did you mean 'bag', 'VAR'?
sarna with 'my method bar()' I get an error 08:22
Too few positionals passed; expected 1 argument but got 0
I guess self isn't passed to bar or something 08:23
lookatme why do you want a method ?
m: sub foo() { my method bar() { say self; }; bar(42); }; foo();
camelia 42
lookatme you should pass self to bar manually 08:24
sarna I guess self isn't passed to bar or something
sorry
lookatme hmm ?
sarna alt-tabbed to a wrong thing :) I'll check if your code works for me, a sec
lookatme okay
sarna okay, it works! thank you :D 08:26
and sorry for not explaining myself better
buggable New CPAN upload: Archive-Libarchive-Raw-0.0.6.tar.gz by FRITH modules.perl6.org/dist/Archive::Lib...cpan:FRITH 10:36
Zoffix I love how much easier it is to make custom IO handles in 6.d: raw.githubusercontent.com/perl6/ma...801752.pdf 10:50
m: -45 .round: 10 # another way to specify precedence of prefix before method call here, is to add a space instead of parens 10:58
camelia ( no output )
Zoffix m: say -45 .round: 10 # another way to specify precedence of prefix before method call here, is to add a space instead of parens
camelia -40
veesh what's a good font to use in my terminal for the perl6 repl? 12:25
i get weird overlaps with my default
lizmat veesh: that's very much dependent on the OS / terminal program that you're using 12:28
timotimo i tend to be anti-REPL anyway :S 12:30
not against REPL in general, just against *our* repl :\ 12:36
Geth ¦ doc: tbrowder self-assigned new manage-page-order.p6 script github.com/perl6/doc/issues/2185 12:37
nooninm I am going to enter a short test script to show that sub MAIN is executing last instead of first. 12:40
nooninm sub execute_after_main(Str $string) { say "\tDid this $string print out after MAIN was done?"; } execute_after_main("1"); sub MAIN() { say "\tThis is main so this should print first"; } execute_after_main("2"); #Result: # Did this 1 print out after MAIN was done? # Did this 2 print out after MAIN was done? # This is main so this should print first 12:41
How does one enter line breaks in irc?
Let me try again, one line at a time
tbrowder_ hi #perl6
nooninm sub execute_after_main(Str $string) {
say "\tDid this $string print out after MAIN was done?";
} 12:42
timotimo you're right, MAIN gets executed after the script has finished running
jnthn MAIN executes after the mainline of the script
timotimo you may be interested in a phaser
jnthn In part so that it can fiddle with @*ARGS if needed
nooninm # Yes, it is supposed to. My script will show that it is not.
tbrowder_ AlexDaniel: ref Lang page: do you want subpages for groups or drop down lists? please enter as issue and assign me u;less someone else has raised a hand. 12:43
nooninm What do mean "after the main line"
AlexDaniel tbrowder_: just separate tables will do
nooninm Do you mean after all other code has executed?
timotimo yes
tbrowder_ ok
nooninm Perl page 62 of Think Perl 6, a program that has a defined MAIN subroutine will usually start its execution with that subroutine. 12:44
nooninm But if as you say it executes sub MAIN last, the book is in error, correct? 12:44
Altreus can I slice an object to fetch multiple properties at once?
jnthn nooninm: Seems so, yes. It's behaved in the current way for as long as I can remember. 12:45
Altreus: Destructure it
timotimo do i have the wrong page?
this is in chapter 4: loops, conditionals, and recursion
it has "nested conditionals" on 62 and "if conditionals as statement modifiers" and "unless conditional statement" on 63
nooninm Okay, I'll try to write the author. We have two topics going on here so I'll leave. Thanks
Altreus I put destructure into google and got results! 12:46
nooninm Bye
timotimo no need to leave
there's a ticket tracker on github if you have an account
for think perl 6 the book
lizmat nooninm: page 62 in my copy doesn't say anything about MAIN ?
jnthn m: my (:$numerator, :$denominator) := 4.5; say $numerator; say $dominator;
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$dominator' is not declared. Did you mean '$denominator'?
at <tmp>:1
------> 3enominator) := 4.5; say $numerator; say 7⏏5$dominator;
jnthn m: my (:$numerator, :$denominator) := 4.5; say $numerator; say $denominator; 12:47
camelia 9
2
jnthn Altreus: ^^
.oO( Guess what I'm been doing too much of... )
nooninm This is the title on page 62: "4.15 Program Arguments and the MAIN Subroutine"
lizmat nooninm: it's page 69 in my hardcopy 12:48
Geth ¦ doc: tbrowder self-assigned divide Language page groups into separate pages github.com/perl6/doc/issues/2186
nooninm Okay. I have 1st Edition, Version 0.5.0 May 2017
lizmat but you're right, the phrasing could have been better
nooninm: as do I, but in hardcopy. I assume you have en ebook version ? 12:49
nooninm Good enough. I'll leave you guys. And thanks!
bye
lizmat bye nooninm
Zoffix m: .say for (Date.today…∞).grep(1 ≤ *.day-of-week ≤ 5)[^10] # the … also dwims without needing * + 1 in there 13:19
camelia 2018-07-18
2018-07-19
2018-07-20
2018-07-23
2018-07-24
2018-07-25
2018-07-26
2018-07-27
2018-07-30
2018-07-31
Zoffix oops, wc 13:20
raschipi Yuck, days of the week starting at Monday. 13:22
timotimo that's the only way it makes sense
the weekend goes at the end, not "at both ends" 13:23
raschipi That just means it's not the "weekend". 13:24
timotimo why would saturday and sunday not be the weekend? 13:25
raschipi Saturday is the weekend and Sunday is the weekstart. 13:26
Ven` first day of the week being monday is obvious to everyone but americans I think :).
timotimo that is super weird to me
jnthn I think you're the first person I've ever heard use the word weekstart :)
.oO( It's making a weak start on its adoption... )
raschipi I just made it up.
timotimo we call that "cognitive dissonance" :D 13:27
raschipi Ven`: I'm not American.
Ven` > According to the International Organization for Standardization ISO 8601, Sunday is the seventh day of the week
whatever that is worth, though.
raschipi Just means they are wrong.
Ven` Not sure about that :-). 13:28
timotimo i'm not sure if you're serious or not, raschipi
raschipi If you just assume standards organizations are always right, you're gonna have a bad time.
Ven` so it's goodI did no such thing.
timotimo: it depends between countries 13:29
raschipi It's all just a question of culture, habits and preferences, of course.
Yet, yuck.
araraloren evalable6: gist.githubusercontent.com/araralo...ab15/po.p6
evalable6 araraloren, Successfully fetched the code from the provided URL
In Parser: Emit the option -w
In MAIN: GOT MESSAGE: The -w matched ? FAILED
In MAIN: GOT M…
araraloren, Full output: gist.github.com/47e7d3e446eb9aebb3...7e7a4a751d
jnthn If we did modulo math then it could be the 0th and 7th day :P 13:30
araraloren jnthn Is this good pratice, emit something (like $mc) to a supply, and get if it is done well through the interface of $mc ? 13:31
buggable New CPAN upload: Archive-Libarchive-Raw-0.0.7.tar.gz by FRITH modules.perl6.org/dist/Archive::Lib...cpan:FRITH 13:41
tbrowder_ [Coke]: is htmlify to be moved to util/ in your proposal? (issue 2185) 14:01
[Coke] I'm slowly decomposing that into build steps in my branch. 14:20
but no, in master, I was suggesting moving the new thing.
Esp. in light of the recent discussion (which I thought you were part of but am not sure) about having too many things top level. 14:21
tbrowder_ ok, i’m starting that now if that’s ok. 14:23
[Coke] Sure, thanks! 14:24
I am still working on cleaning up htmlify/Makefile stuff in the coke/build branch, but tuits are spare these days.
tbrowder_ i made a new top-level dir called build-prods but build may be better. it should be able to be deleted with a make distclean or other target. 14:26
tbrowder_ i and jmerelo were two of folks in discussion of doc reorg or cleanup 14:28
ThoSvePa Hi there! 14:31
ThoSvePa I'm trying to install rakudo on CentOS 7 and have an error while executing 'perl Configure.pl --backend=moar --gen-moar' 14:32
araraloren ThoSvePa what error ? 14:33
ThoSvePa It is 'Can't locate Digest/SHA.pm in @INC'
araraloren oh, maybe you should install that Perl 5 module
using cpan/cpanm
ThoSvePa That's all? Thank you very much. 14:34
araraloren yeah, maybe this helpful : `sudo dnf install perl-Digest-SHA` 14:35
I don't know the actual package name
ThoSvePa Ok, I'm searching on myself how to install the package. Think I have to install cpan or cpanm first. 14:36
ilmari Digest::SHA is core, but centos/redhat/fedora have broken the packaging
araraloren oh
ilmari you need to install the 'perl-core' package to get a complete perl instlalation
they've finally fixed it in fedora 28 and the upcoming rhel/centos 8 14:37
ThoSvePa Thanks a lot again. It's great to get help so fast. 14:38
Altreus jnthn: cool, that's exactly what I got from the docs and blogs I found :) 14:41
that means those things are actually sufficient learning tools :o 14:42
m: my %h = %(:numerator, :denominator) = 4.5; # something like this might work? 14:43
camelia Odd number of elements found where hash initializer expected:
Only saw: 4.5
in block <unit> at <tmp> line 1
Altreus m: my %h = %(:numerator, :denominator) := 4.5; # something like this might work?
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use bind operator with this left-hand side
at <tmp>:1
------> 3 %h = %(:numerator, :denominator) := 4.57⏏5; # something like this might work?
Altreus I know I'm guessing but I hoped I would guess right xD 14:44
Can I unpack the object into a hash in one go like this?
m: my %h(:numerator, :denominator) := 4.5; # something like this might work?
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use bind operator with this left-hand side
at <tmp>:1
------> 3my %h(:numerator, :denominator) := 4.57⏏5; # something like this might work?
Zoffix m: my %h = 4.5.Capture; say %h 14:45
camelia {}
Zoffix m: my %h = 4.5.Capture.hash; say %h
camelia {denominator => 2, numerator => 9}
lizmat m: my %h = numerator => 4, denominator => 5; dd %h
camelia Hash %h = {:denominator(5), :numerator(4)}
Altreus m: my %h = 4.5.Capture<numerator>:kv; dd %h; 14:46
camelia Hash %h = {:numerator(9)}
Altreus that's the job 14:46
lizmat m: my %h = :4numerator, :5denominator; dd %h # more cryptic
camelia Hash %h = {:denominator(5), :numerator(4)}
Zoffix Altreus: `my (...) :=` is a special syntax that treats the bit inside `(...)` as a signature and on the RHS you give it a Capture (or it's automatically obtained by calling .Capture) 14:47
So outside that special syntax you have to poke at .Capture manually
Altreus at least it's there :D
Zoffix Captures can provide both named and positional args, so the .hash bit steals the named portion
m: dd 4.5.Capture
camelia \(:denominator(2), :numerator(9))
Zoffix And you can't Capture some objeccts 14:48
m: dd 4.Capture
camelia Cannot unpack or Capture `4`.
To create a Capture, add parentheses: \(...)
If unpacking in a signature, perhaps you needlessly used parentheses? -> ($x) {} vs. -> $x {}
or missed `:` in signature unpacking? -> &c:(Int) {}
in block <unit> at …
lizmat ah, now I understand the question, sorry for the noise :-)
Zoffix :)
Altreus speaking of lizmat's noise, is :4numerator an accident or is there rationale behind that?
lizmat :2nd, :3rd, :4th 14:49
Zoffix Altreus: it's syntax driving stuff like `s:2nd/.../.../`... The :4numerator is the abuse… err extension… of that syntax 14:49
lizmat was the original intent
Altreus this is why there's a rolling eyes emoji!
Zoffix :)
More colonpair shortcuts: rakudo.party/post/Perl-6-Colonpairoscopy
(the :$<foo> shortcut is missing from the article tho) 14:50
Altreus I'm glad the time between my questions is increasing :P
Altreus means I can start understanding these articles 14:50
Zoffix m: "foobar" ~~ /$<foo>=.**3/; say [:$<foo>]
camelia [foo => 「foo」]
Zoffix :)
Zoffix How come this is an empty Hash? 14:52
m: my %h = 4.5.Capture; say %h
camelia {}
Zoffix I would've accepted an "Odd number of blah blah" error, but empty? 14:53
Altreus m: 4.5.Capture.PERL.say 14:54
camelia No such method 'PERL' for invocant of type 'Capture'
in block <unit> at <tmp> line 1
Altreus o
Zoffix .perl
Altreus m: 4.5.Capture.perl.say
camelia \(:denominator(2), :numerator(9))
Altreus oh you already did that, I see now 14:55
[Coke] m: 4.5.Capture.elems.say
camelia 0
Zoffix Ah, it's going by what .iterator gives it and that iterates through positionals
Zoffix m: my %h = \('foo', 'bar', :42meows); dd %h 14:56
camelia Hash %h = {:foo("bar")}
tbrowder_ Zoffix: nice party article, thanks! 14:57
Altreus is it possible to create a strict hash, one that complains if you look up a missing key? 15:04
Often it is useful to throw an error if there is missing config, for example
Altreus but it is tedious to repeat yourself, once in the hash lookup, and again in the error message 15:04
lizmat m: my %restricted is Map = ....; # this at least is immutable
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed postfix call
at <tmp>:1
------> 3my %restricted is Map = ....7⏏5; # this at least is immutable
Altreus m: my %restricted is Map = :config<value>; %restricted<missing>; 15:05
camelia ( no output )
Altreus ^ this would be the time to throw
Altreus otherwise it's die "Missing config value: missing" unless %restricted<missing>:exists 15:06
and *then* you have to repeat yourself again later when you actually make use of that value (because exists can't return the value for assignment)
lizmat Altreus: ok, so you want to specify a list of allowable keys at initialization ? 15:07
Altreus There's options, but my assumption would be that you could do something like my $value = %config<value>:s 15:08
where s means strict, or some such adverb
lizmat Altreus: perhaps modules.perl6.org/dist/Hash::Util is something for you ?
Altreus hmm 15:10
lizmat Would something like:
lizmat my %config is restricted-to<foo bar baz> = init 15:10
work for you ? 15:11
Altreus If you've ever used python you might know it's useful that it complains if you look up a nonexistent item, but also that it gives you a way around it that just returns nil
I think we're thinking from opposite directions
lizmat that would complain at initialization ?
Altreus I don't mind what extra keys exist, I just want to auto-die if I try to access a key the user hasn't provided
jnthn araraloren: Supplies don't introduce concurrency, so it's safe in that sense.
lizmat Altreus: perhaps
Altreus you know what, I bet I can do that in the signature
lizmat Altreus: named parameters can be obligatory by adding a ! 15:12
sub a (:$foo!)
lizmat m: sub a (:$foo!) { }; a 42 15:12
camelia Too many positionals passed; expected 0 arguments but got 1
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
lizmat m: sub a (:$foo!) { }; a :bar
camelia Required named parameter 'foo' not passed
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
araraloren jnthn thanks the advices :) 15:13
Altreus m: sub a ( %(:required) ) {} a { :optional };
camelia 5===SORRY!5===
Shape declaration with () is reserved;
please use whitespace if you meant a subsignature for unpacking,
or use the :() form if you meant to add signature info to the function's type
at <tmp>:1
------> 3sub a ( %7⏏…
Altreus m: sub a ( %( :required ) ) {} a { :optional };
camelia 5===SORRY!5===
Shape declaration with () is reserved;
please use whitespace if you meant a subsignature for unpacking,
or use the :() form if you meant to add signature info to the function's type
at <tmp>:1
------> 3sub a ( %7⏏…
Altreus um
Zoffix "...please use whitespace if you meant a subsignature.."
oh 15:14
m: sub a ( % (:required) ) {} a { :optional };
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed parameter
at <tmp>:1
------> 3sub a ( % (:7⏏5required) ) {} a { :optional };
Zoffix m: sub a ( % (:$required) ) {} a { :optional };
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3sub a ( % (:$required) ) {}7⏏5 a { :optional };
expecting any of:
infix
infix stopper
Altreus anyway the idea is that we don't have to keep saying "You didn't configure xyz" unless %config<xyz>
Zoffix m: sub a ( % (:$required) ) {}; a { :optional };
camelia Unexpected named argument 'optional' passed in sub-signature
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
Altreus It should just die when we access %config<xyz>
a lexical pragma might work, or an adjective on the lookup
Zoffix
.oO( or a module )
Altreus where pragma may mean module :)
use Strict::Hashes; 15:15
that way, the config hash can contain whatever it wants to, as long as what *we* are looking for is in there
lizmat Altreus: ok, I'll bite
I was thinking of a trait
Altreus sub a (%config is strict) 15:16
Zoffix is default({die})
lizmat Zoffix++
that would actually work :-)
Zoffix IIRC there's a ticket for Callables in `is default` to do something more interesting that just be normal values
Altreus wait, is default on a hash is the default value for lookups?
I could have used quotes better in that message 15:17
Zoffix default value for containers of values
lizmat it's the default for the container that gets returned
Zoffix m: my %h is default(Failure.new); say %h<foo>
camelia ===SORRY!===
Failed
lizmat Zoffix: but the failure only gets thrown when the value is actually used, not when it is fetched
Altreus m: my %h is default(Failure.new) = :foo; say %h<foo>
camelia True
Zoffix yeah
It also lacks location info
Altreus whaaaaaaaaat
yeah if that could output better that would be perfect 15:18
i.e. if it could be parameterised
eh
lizmat will think about that after some time away from the keyboard
Altreus lizmat: actually that's kind of OK
With the perl6 hot-potato sort of Failure, if I accidentally look up a config setting I never use, the user never gets told off
Zoffix lizmat: RT#131599 is the ticket 15:19
synopsebot RT#131599 [open]: rt.perl.org/Ticket/Display.html?id=131599 [RFC] Allow a Callable for `is default` that will generate default values
Zoffix uhh... or maybe it's just a title of a renamed ticket :) the content itself seems to be about [] in defaults :P 15:20
Zoffix Ah, you'd use {[]} to ensure it's a new container each time. OK 15:20
moritz m: sub f($s = []) { $s }; say f() === f() 15:24
camelia False
Altreus I will weigh in on this rt 15:25
m: my %h is default(Failure.new); CATCH { $_.say } say %h<foo>; say %h<bar>; 15:28
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3s default(Failure.new); CATCH { $_.say }7⏏5 say %h<foo>; say %h<bar>;
Altreus m: my %h is default(Failure.new); CATCH { $_.say }; say %h<foo>; say %h<bar>; 15:29
camelia Failed
in any trait_mod at /home/camelia/rakudo-m-inst-1/share/nqp/lib/Perl6/Grammar.moarvm line 1
in any trait at /home/camelia/rakudo-m-inst-1/share/nqp/lib/Perl6/Grammar.moarvm line 1
in any scope_declarator:sym<my> at /home/camelia/rak…
Altreus I suppose it does explode each time
raschipi m: my %h is default(Failure.new("Strict Hash")); CATCH { $_.say }; say %h<foo>; say %h<bar>; 15:35
camelia Strict Hash
in any trait_mod at /home/camelia/rakudo-m-inst-1/share/nqp/lib/Perl6/Grammar.moarvm line 1
in any trait at /home/camelia/rakudo-m-inst-1/share/nqp/lib/Perl6/Grammar.moarvm line 1
in any scope_declarator:sym<my> at /home/cameli…
Zoffix Altreus: nah, it has the same issue as the `is default([])`. You keep getting the same object in the defaults. If one piece of code handles that failure, another failed lookup will return a now-handled failure 15:50
m: my %h is default(Failure.new); %h<foo>.so; %h<bar>.self; 15:51
camelia ( no output )
Zoffix m: my %h is default(Failure.new); %h<bar>.self;
camelia ===SORRY!===
Failed
Zoffix "action at a distance" basically
b2gills Create a class named Strict::Hash then `my %h is Strict::Hash = …` 15:53
have `.AT-KEY` return a Failure if the key isn't already there. Then you can do `%h<nonexistent> // 0` 15:54
Altreus yeah, I figured I could just override it 15:56
Zoffix m: class Bomb is Mu { BEGIN ::?CLASS.^add_method: .name, -> | {die "Boom" } for ::?CLASS.^methods: :all; method FALLBACK(|) { die "Boom" } }; my %h is default(Bomb); try say %h<foo>; say %h<bar>
camelia Boom
in block at <tmp> line 1
in block <unit> at <tmp> line 1
Zoffix m: class Bomb is Mu { BEGIN ::?CLASS.^add_method: .name, -> | {die "Boom" } for ::?CLASS.^methods: :all; method FALLBACK(|) { die "Boom" } }; my %h is default(Bomb); %h<bar>
camelia ( no output )
Zoffix boo 15:57
Zoffix m: (my %h = :42foo) does role { method AT-KEY (\v, |c) { self{v}:exists ?? nextsame() !! die "Boom"} }; %h<foos>:v 15:59
camelia ( no output )
Zoffix looks like more than just AT-KEY needs to be modded
m: (my %h = :42foo) does role { method AT-KEY (\v, |c) { self{v}:exists ?? nextsame() !! die "Boom"} }; %h{*}
camelia ( no output )
SmokeMachine m: use MONKEY-TYPING; augment class Seq { has $!a = 42; method b { say $!a } }; Seq.new(class :: does Iterator {method pull-one{1}}.new).b 16:20
camelia P6opaque: no such attribute '$!a' on type Seq in a Seq when trying to get a value
in method b at <tmp> line 1
in block <unit> at <tmp> line 1
SmokeMachine why this isn't working? 16:21
jnthn Because you can't augment in extra attributes 16:22
SmokeMachine jnthn: how can I do something like that? 16:24
jnthn Mix in to it using does
SmokeMachine insta working... :( 16:39
jnthn: gist.github.com/FCO/88f9773eb3a4ea...2362541186 16:40
buggable New CPAN upload: Sparrowdo-VSTS-YAML-Build-0.0.4.tar.gz by MELEZHIK modules.perl6.org/dist/Sparrowdo::V...n:MELEZHIK 16:41
SmokeMachine m: use MONKEY-TYPING; role Bla { has $!a = 42; method b { say $!a } }; augment class Seq does Bla {}; Seq.new(class :: does Iterator {method pull-one{1}}.new).b 16:47
camelia P6opaque: no such attribute '$!a' on type Seq in a Seq when trying to get a value
in method b at <tmp> line 1
in block <unit> at <tmp> line 1
SmokeMachine m: role Bla { has $!a = 42; method b { say $!a } }; Seq does Bla; Seq.new(class :: does Iterator {method pull-one{1}}.new).b 16:48
camelia Cannot use 'does' operator on a type object Seq.
in block <unit> at <tmp> line 1
SmokeMachine m: role Bla { has $!a = 42; method b { say $!a } }; (Seq.new(class :: does Iterator {method pull-one{1}}.new) but Bla).b 16:49
camelia 42
SmokeMachine :)
robertle does anyone have experience with composing Cro routes at runtime rather than compile time? 16:56
I have a url scheme like /foo/<id>/<stuff> where depending on the <id> objects of different types are responsible to handle <stuff> 16:57
sena_kun robertle, you can actually do that using `.compose` method from Cro::Core. 16:58
robertle with plan request/response handling I can of course look up the handler object from some structure and then delegate to a method call on the object. but <stuff> within the object can have many endpoints and quite some logic, so it would be cool to use a route there as well
sena_kun I believe that every provided shortcut class like Server or Client can be as well constructed from client side of things. 16:59
robertle sena_kun: I am not sure I understand. I was looking at that, but don't see how I can make it do what I want...
jnthn subset SomeObjectType of Int where ...determine what it is...; get -> 'foo', SomeObjectType $id, $stuff { } perhaps?
sena_kun robertle, I am not fully sure what your usecase is, but the answer is "Yes, it can be". Did you read cro.services/docs/approach ? 17:00
jnthn sena_kun: I think this is about the router rather than pipeline composition. 17:01
robertle regarding teh .compose: I can use it to do sequential pipelines, but I need a fork in my pipeline, and I don't get how to realise that
sena_kun ooh, indeed.
maybe Conditional can help? 17:02
hmmm.
robertle and regarding the subset idea: it's not only about the types, also about state that these objects could hold. so I really need/want to switch to an instanced, not a type.
an alternative view would be: given a route and a request object, how can I pass the request to the 17:03
route and yield a response?
jkramer Can somebody help me out? bpaste.net/show/23e41b4bd43a
What's wrong here? Why does the Z- give me only one value in return? 17:04
Also where is the value coming from? :D 0 - 5 should be -5, 5 - 10 too. 17:05
Zoffix jkramer: you're storring stuff in an Array, which automatically places stuff into Scalar containers. You need to decont stuff 17:06
huggable: decont
huggable Zoffix, Article on containers and decont: perl6advent.wordpress.com/2017/12/...oneandonly 17:06
jnthn robertle: Ah, then probably the best way is to write something that does the Cro::Transform role, looks at the incoming request object, and then does the onwards delegation 17:07
Zoffix m: my @words = <foo bar baz lol 123 foo baz quux 123 lol foo trolololol lol asd>.pairs; my %positions .= classify-list: *.value, @words, :as(*.key); say .key, ': ', (.value<> Z- .value.skip) for %positions.grep(+*.value > 2)
camelia lol: (-6 -3)
foo: (-5 -5)
jkramer Oh ok. I tried .value.flat earlier, shouldn't that work the same in this case?
jnthn robertle: You can get a route block to process a request by something a bit like `whenever $that-route-block.transformer(emit $request) -> $response { emit $response }` 17:08
Zoffix jkramer: .flat doesn't flatten conted stuff
jnthn ah, sorry, `supply emit $request` there
Zoffix m: dd falt (1, (2, (3, (4,))) 17:09
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in parenthesized expression; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3dd falt (1, (2, (3, (4,)))7⏏5<EOL>
expecting any…
Zoffix m: dd falt (1, (2, (3, (4,))))
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
falt used at line 1. Did you mean 'flat'?
Zoffix m: dd flat (1, (2, (3, (4,))))
camelia (1, 2, 3, 4).Seq
Zoffix m: dd flat (1, (2, $(3, (4,))))
camelia (1, 2, $(3, (4,))).Seq
Zoffix m: dd flat $(1, (2, $(3, (4,)))) 17:09
camelia (1, 2, $(3, (4,))).Seq
chrom heyho
Zoffix \o
jkramer: though it'd work to decont the iterable it's called on. Were you calling it in place of `<>` in my eval above? 17:10
Zoffix m: my @words = <foo bar baz lol 123 foo baz quux 123 lol foo trolololol lol asd>.pairs; my %positions .= classify-list: *.value, @words, :as(*.key); say .key, ': ', (.value.flat Z- .value.skip) for %positions.grep(+*.value > 2) 17:10
camelia lol: (-6 -3)
foo: (-5 -5)
Zoffix m: my @words = <foo bar baz lol 123 foo baz quux 123 lol foo trolololol lol asd>.pairs; my %positions .= classify-list: *.value, @words, :as(*.key); say .key, ': ', (.value.self Z- .value.skip) for %positions.grep(+*.value > 2)
camelia foo: (-5 -5)
lol: (-6 -3)
jkramer Zoffix: Yes 17:11
Zoffix seems to work above
SmokeMachine jnthn: what do you think? www.irccloud.com/pastebin/QHM6KSZN/ 17:15
jkramer Weird, don't know what I did there.
SmokeMachine gist.github.com/FCO/5e4dffcc2f47d4...a4ce74e2c2 17:16
robertle jnthn: that sounds fab, I'll try and build my own transform 17:18
fbynite I've got the following p5 code: my ($var1, $var2, $var3) = /some-regex/;. In p6m should I use grammars, named captures or ...? 17:41
El_Che you can get an array of matches, I think
timotimo if you're only interested in the strings that matched anyway, maybe comb is the right thing for you 17:42
donpdonp what am I missing when the perl6 cli does not have readline support? 17:48
El_Che donpdonp: it shoud tell you
Linenoise or Readline 17:49
donpdonp it doesnt say anything, i just dont get up-arrow
i'll try linenoise, thx.
Zoffix RE: 6.d: someone's asking "Is there a reason why y’all are putting letters in the versions?" twitter.com/genio_cw/status/1019627279830351872 17:54
Zoffix Skimming the logs, doesn't look like there were some grand plans for versioning and it just all carried on from 6.b => beta/Birthday, 6.c => Christmas, 6.d … 6.za, but if someone remembers a better answer maybe you can respond better :) 17:55
kaiser_ Hello everyone. I am experiencing something weird. I have a simple script that counts lines and words in a Node.js project. When the script is run for the first time, it takes ages to finish. Then it averages around 0.4 sec. More or less the same script in Perl 5 (with only minor differences) finishes in cca. 0.035 sec. 17:58
What I really want to understand is why it takes sooo looong for the first time, I'm less concerned about the diff between P5 and P6. I'm not an expert in Perl, so I'm pretty sure my code can be improved.
The code is here: gist.github.com/kaisersparpick/a49...ddb8a5aa49 As a comparison, the Perl 5 code is here: gist.github.com/kaisersparpick/29e...dca714c587 17:59
I'd appreciate your feedback. Thanky ou.
lucasb from 6.a (advent/alpha) even :) 18:00
Zoffix kaiser_: is that the whole thing? Usually what you describe applies to making changes in a module. The first run is slower because of precompilation of that module. But if you're not using any modules, then it's probably something else.
kaiser_: what version of perl6 you use? 18:02
kaiser_ That is all the code. The lines are printed pretty fast until the first "Subtotal" line, so after the "for dir $dir -> $file" iteration. 18:02
Then it seems to wait for a long time 18:03
raschipi kaiser_: Which version are you running? 18:05
kaiser_ I've added Int's to the var declarations to prevent p6 from using bigints, which are the default if I'm not mistaken.
Zoffix On 2018.06+, the first and subsequent runs take the same time for me
kaiser_: Ints are bigints 18:06
kaiser_ Rakudo Star from around February - sorry I don't know exactly.
Zoffix perl6 -v prints it
huggable: star
huggable Zoffix, Estimated Rakudo Star releases: .01, .04, .07 & .10
Zoffix I'm guessing 2018.01
kaiser_ The code is at my workplace and I'm at home now :( 18:07
Zoffix Could it be some operating system disk caching or something?
kaiser_ "Ints are bigints" - Oh. Then what can I use to avoid them?
lucasb lowercase int 18:08
Zoffix kaiser_: you can use lowercase `int` for native ints
105s first run? Then 0.4s all subsequent runs? Weird
kaiser_: what operating system is this on?
kaiser_ I'm using Ubuntu 16. I did not set up any special caching.
Exactly.
"105s first run? Then 0.4s all subsequent runs?" <- Exactly :) 18:09
Zoffix :)
kaiser_ lucasb: Thanks! I'll try that tomorrow. 18:10
kaiser_ Will I gain considerable speed improvement by switching to lowercase int? 18:12
Zoffix not really 18:13
kaiser_ Hmmm
Zoffix sometimes can even be slower, due to boxing-unboxing 18:13
kaiser_: what defines a first run, BTW? Do you have to wait 100s after each change to the script? 18:17
c: HEAD,2018.01 temp.perl6.party/z.txt 18:18
committable6 Zoffix, Successfully fetched the code from the provided URL
Zoffix, ¦HEAD(a847abe): «␤1.0552871␤» ¦2018.01: «␤1.1416646␤»
kaiser_ When I first run the script, it quickly starts printing the lines for the first project, then it seems to be waitin around 100 s before printing the "Subtotal" line, then it proceeds with the second project and quickly finishes. When I run the same script again, it finishes in 0.4s. 18:19
This is the behaviour whenever I reboot Ubuntu. 18:20
SmokeMachine Im not sure if the expected is with or without the first line... (the /^lo/ one) www.irccloud.com/pastebin/ohj5TB4D/
raschipi Could be that in the subsequent runs the OS has the files in memory and doesn't need to read them from the disk again. 18:22
Zoffix But 100s difference? Also, I'm guessing Perl 5's version is not affected 18:23
kaiser_ The perofmance of the Perl5 version is reliably consistent around 0.035 seconds 18:24
raschipi Can you try timing it again after running 'echo 3 > /proc/sys/vm/drop_caches' ? 18:26
Zoffix kaiser_: no idea what might be causing it, but next time you're at work, you can try if this version has the same problem: gist.github.com/zoffixznet/6902c3f...0b3b165734
kaiser_: in your version, you're descending into dirs while iterating the current dir, so you have a potential bug of running out of open file handles, if you're searching through a very nested dir structure. In my version, I just push the dirs to search into an array and do open one dir at a time basically. 18:27
kaiser_: also, instead of reading the same file twice to get the lines and then the words, I read it once and get lines/words from the read content.
Doubt if this would fix anything, but maybe it does vOv 18:28
And if you want to speed it up, you could replace that `sprintf` with something hand-rolled, 'cause right now sprintf is super slow 18:29
(N.B.: in the docs, you might find .fmt method, but on most objects it's just a sprintf call under the hood, so is equivally slow)
kaiser_ Zoffix and reschipi: I see, thanks for the clarification and suggestions. I'll try them tomorrow. 18:31
Zoffix m: my ($n, $l, $w) = "meows", ^100 .pick, ^100 .pick; for ^2000 { sprintf "%-60.s | %5.d | %6.d", $n, $l, $w }; say now - ENTER now 18:34
camelia 0.7465759
Zoffix m: my ($n, $l, $w) = "meows", ^100 .pick, ^100 .pick; for ^2000 { join " ", $n, " " x (60-$n.chars), " | ", " " x (5-$l.chars), $l, " | ", " " x (6-$w.chars), $w }; say now - ENTER now
camelia 0.0688703
Zoffix m: say 0.7465759/0.0688703
camelia 10.8403172
kaiser_ Oh, sprintf is slow indeed :) 18:42
Garland_g[m] I noticed while working with the json exceptions handler that the output for a X::CompUnit::UnsatisfiedDependency doesn't have all of the standard information about a line number, position, filename, etc. It only has "message" and "specification."
This causes the perl6 syntastic plugin to fail to bring up any errors in the error bar, as it is relying on having those particular fields to place the markers in the vim gutter. 18:43
Where would be the appropriate place to report this to? 18:44
Zoffix Garland_g[m]: usually github.com/rakudo/rakudo/issues/new but 1 sec, there's already a related issue. Lemme find it 18:49
Garland_g[m]: this one: github.com/rakudo/rakudo/issues/2022 18:50
Garland_g[m] Thanks for the link. 18:52
donpdonp my ($a, $b) = go; sub go {("A","Z")}; This type cannot unbox to a native string: P6opaque, Hash 18:55
donpdonp im baffled by the error. my ($a,$b) = ("A","Z"); is happy. 18:55
Zoffix m: my ($a, $b) = go; sub go {("A","Z")}; 18:56
camelia ( no output )
donpdonp ok I winged the example a bit. let me make a better one.
Zoffix donpdonp: did you have a block somewhere with code that you then removed all the code from and it became a {}? That's a Hash, you need to write it as {;} to have a Block there 18:57
(doesn't apply to `sub {}`, but to plain blocks)
m: my str $x = {} 18:58
camelia This type cannot unbox to a native string: P6opaque, Hash
in block <unit> at <tmp> line 1
donpdonp Zoffix: I dont think I did that. my simple example doesnt actually error, im looking into how my code is different. 18:59
hythm_ How to modify installed module locally for quick testing? I tried modifying at ~/.zef/store/module-name but that does not seem to ork 19:00
Work* 19:01
Zoffix hythm_: installed modules are precompiled. I don't think there's a way to modify them without re-installing
You need to get module's source and add the path to the source with -I or `use lib` to get it looked at there first
hythm_ That will work, thank Zoffix 19:02
donpdonp Zoffix: ah I had go(str $param) and called go(some_hash_of_some_sort) so it was a signature problem. 19:03
Zoffix ah 19:03
raschipi Zoffix, can't trying to use an empty hash as a block be detected and the message be awesome?
donpdonp compounded by lowercase str. 19:04
why does that compile? go(str $param)
with go(Str $param) the error makes sense Type check failed in binding to parameter '$body'; expected Str but got Hash 19:05
Zoffix donpdonp: `str` is a native type. You get the "cannot unbox" errors for those
The error isn't great, but you get used to them
Altreus I keep doing something of the shape `$a = $b if $b`. Can I say it shorter?
i.e. stop repeating whatever $b is in each situation 19:06
Altreus The $a is actually of the form $hash<some-key> 19:06
so I want to avoid creating the key
donpdonp my $a = $b || "default" would answer the first question, but its not going to prevent assignment 19:07
Zoffix m: my $a = 42; my $b = 100; $a R[&&]= $b; say $a
camelia ===SORRY!===
Cannot find method 'ann' on object of type NQPMu
Zoffix Altreus: I think ^ that would work, once the bug is fixed :)
Altreus see perl6 seems to have an answer for everything that bores me in perl5 :D 19:08
donpdonp ah the if wraps the entire assignment, i didnt notice that before.
Zoffix oh, maybe not: 19:08
m: my $a = 42; my $b = 100; $a R[and]= $b; say $a
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot reverse the args of because assignment operator operators are too fiddly
at <tmp>:1
------> 3my $a = 42; my $b = 100; $a R[and]=7⏏5 $b; say $a
Zoffix too fiddly
Altreus at least it's honest 19:09
lizmat
.oO( users playing second fiddle :-)
Zoffix m: sub infix:<♥> (\a, \b) { a = b if b }; my $a = 42; my $b = 100; $a ♥ $b; dd $a
camelia Int $a = 100
Zoffix m: sub infix:<♥> (\a, \b) { a = b if b }; my $a = 42; my $b = 0; $a ♥ $b; dd $a
camelia Int $a = 42
Zoffix :)
Altreus :3 19:10
Zoffix :D
Juerd It's not only being honest, it actually says sorry. Is there any other compiler that does that? :)
lizmat feels better if that would be "with b" to me
raschipi Unless he really wants to depend on it being True, not just defined. 19:11
Juerd raschipi: itym true, not True. True is a specific kind of true.
Altreus hmm that's a good question
AlexDaniel m: my $a = 42; my $b = 100; $a R[and]= $b; say $a
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot reverse the args of because assignment operator operators are too fiddly
at <tmp>:1
------> 3my $a = 42; my $b = 100; $a R[and]=7⏏5 $b; say $a
AlexDaniel args of what?
Zoffix mystery :)
m: sub postfix:<⬅> (\a) { a = $OUTER::_ }; my $a = 42; my $b = 0; $a⬅ with $b; dd $a
camelia Any $a = Any
Zoffix m: sub postfix:<⬅> (\a) { a = $OUTER::_ }; my $a = 42; my $b = 42; $a⬅ with $b; dd $a 19:12
camelia Any $a = Any
Zoffix hm
lizmat m: sub infix:<=//> (\a, \b) { a = b with b }; my $a = 42; my $b; $a =// $b; dd $a
camelia Int $a = 42
lizmat m: sub infix:<=//> (\a, \b) { a = b with b }; my $a = 42; my $b = 666; $a =// $b; dd $a
camelia Int $a = 666
AlexDaniel is it ticketed?
that the string is empty in there
‘args of because’
Zoffix m: my $a = 42; my $b = 666; $a R[//]= $b; dd $a 19:13
camelia ===SORRY!===
Cannot find method 'ann' on object of type NQPMu
Zoffix grr
AlexDaniel 💤
Zoffix AlexDaniel: don't think so.
R#2093 19:14
synopsebot R#2093 [open]: github.com/rakudo/rakudo/issues/2093 [LTA] Too-fiddly error missing op name
Zoffix (and the explosion one was ticketed before R#1986 ) 19:16
synopsebot R#1986 [open]: github.com/rakudo/rakudo/issues/1986 [QAST] Explosion when `R`-metaopping `||`, `//`, `&&` meta-assigns
Altreus what did you expect $OUTER::_ to resolve to?
does with contextualise?
Zoffix $_ of outer
m: sub foo { dd $OUTER::_ }; $_ = 42; foo
camelia Int $_ = 42
Altreus or is it because it doesn't tat it didn't work
Zoffix Yeah
Yeah, with does set $_
Altreus so I could do $a = $_ with $b 19:17
Zoffix Yeah
Altreus and at least it shortens $b
cool
Zoffix or `$b andthen $a = $_`
(same thing; just written left-to-right instead of right-to-left)
Altreus %self{$prop} andthen $json{$prop} = .to-json 19:18
no I don't know why one is a real hash and the other is in a scalar :)
Perl5 thinking is leaking in
Zoffix m: my %a = :42foo; my %b; %b<foo> ,= %a<foo>; dd %b 19:21
camelia Hash %b = {:foo($((), 42))}
Zoffix :( 19:22
m: my %a = :42foo; my %b; %b ,= %a<foo>:v; dd %b
camelia Odd number of elements found where hash initializer expected:
Only saw: 42
in block <unit> at <tmp> line 1
Zoffix m: my %a = :42foo; my %b = :100meows; %b ,= %a<foo>:p; dd %b
camelia Hash %b = {:foo(42), :meows(100)}
Zoffix m: my %a = :42foos; my %b = :100meows; %b ,= %a<foo>:p; dd %b
camelia Died with X::Hash::Store::OddNumber
in block <unit> at <tmp> line 1
19:23
Zoffix m: my %a = :42foos; my %b = :100meows; %b ,= %a<foo>:vp; dd %b
camelia Unexpected named argument 'vp' passed
in block <unit> at <tmp> line 1
Zoffix m: my %a = :42foos; my %b = :100meows; %b ,= %a<foo>:v:p; dd %b
camelia Unsupported combination of adverbs (p v) passed to slice on %a
in block <unit> at <tmp> line 1
Zoffix shakes fist
lizmat Zoffix: why ?
lizmat :v:p are mutually exclusive 19:24
Zoffix 'cause I'm failing to do the right thing :)
m: my %a = :42foo; my %b = :100meows; %b ,= %(%a<foo>:kv); dd %b
camelia Hash %b = {:foo(42), :meows(100)}
Zoffix m: my %a = :42fooss; my %b = :100meows; %b ,= %(%a<foo>:kv); dd %b
camelia Hash %b = {:meows(100)}
Zoffix w00t
lizmat although you could argue that they *could* be specified together
Zoffix Altreus: ^ dunno if it's shorter or fits your usecase but it don't repeat stuff :)
lizmat as :v could be considered a filter on existing keys
Zoffix lizmat: Yeah, that's what I was expecting it to do, `:v` to filter on existing keys, but give me a pair like `:p` would 19:25
m: my %h; dd %h<foo>:k
camelia ()
Zoffix m: my %h; dd %h<foo>:p
camelia ()
lizmat Zoffix: please file a ticket for that
Zoffix Well, it does work right, looks like
I mean, :p works like :k:p already 19:26
lizmat ah, yes
Altreus hmm
lizmat hmmm
Altreus no I'm hmming
Zoffix I think the "odd number" error was from trying to stick a List as one thing
lizmat it's been a while I was in that section of the code
Altreus Zoffix: It's academically interesting but the topicalising of with/andthen basically solves it 19:27
Zoffix :) 19:28
Altreus does :kv also filter on existing things?
Zoffix m: my %h; dd %h<foo>:kv
camelia ()
Zoffix yup
Altreus isn't that the same as :v:p then 🤔
lizmat Altreus: no, :kv produces 2 values for each key/value
:p produces 1 value, a Pair with the key/value 19:29
Altreus oh yes
but :p doesn't filter, I see
Zoffix It does
All of these do filter
Altreus :x
what does this do then: 19:30
m: my %a = :42fooss; my %b = :100meows; %b ,= $a<foo>:p; dd %b
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared. Did you mean '%a'?
at <tmp>:1
------> 3%a = :42fooss; my %b = :100meows; %b ,= 7⏏5$a<foo>:p; dd %b
Altreus gosh
m: my %a = :42fooss; my %b = :100meows; %b ,= %a<foo>:p; dd %b
camelia Died with X::Hash::Store::OddNumber
in block <unit> at <tmp> line 1
Altreus okay
Zoffix Altreus: it does %b = %b, () with the empty list being the "odd" one out
Altreus m: my %a = :42fooss; my %b = :100meows; %b ,= %a<foo>:kv; dd %b 19:31
camelia Died with X::Hash::Store::OddNumber
in block <unit> at <tmp> line 1
Zoffix m: my %a = :42fooss; my %b = :100meows; %b ,= |(%a<foo>:p); dd %b
camelia Hash %b = {:meows(100)}
Zoffix m: my %a = :42foo; my %b = :100meows; %b ,= |(%a<foo>:p); dd %b
camelia Hash %b = {:foo(42), :meows(100)}
Zoffix and this one slips it in, so you don't get the error
m: my %a = :42foo; my %b = :100meows; %b ,= %a<foo>:p; dd %b
camelia Hash %b = {:foo(42), :meows(100)}
Zoffix and this one works 'cause Pair is Associative so it gets the "combine the things" treatment like %a = %b, %c would 19:32
or is it a list of pairs
m: my %a = :42foo; dd %a<foo>:p.^name
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed postfix call
at <tmp>:1
------> 3my %a = :42foo; dd %a<foo>:p.7⏏5^name
Altreus this actually helps for my other assignment, where I actually have a slice of more than one thing
Zoffix m: my %a = :42foo; dd (%a<foo>:p).^name
camelia "Pair"
Altreus eh, no it doesn't, because I'm translating the keys too :(
Zoffix nah, just a Pair
Zoffix & 19:33
Altreus this is fun though 19:35
written perl5 for so long I'm pretty sure of the fastest way of doing most things
but perl6 offers many more shortcuts
masak .oO( more but slower shortcuts ) 19:36
Juerd Honestly, the shortcut that I like most is ^
masak :) 19:38
timotimo i like that there's shortcuts for all kinds of access to $_, like .<foo> and .[foo] and .method 19:42
SmokeMachine m: $_ = 42; dd [:.abs] # I'd like this one... 19:44
camelia 5===SORRY!5=== Error while compiling <tmp>
Bogus statement
at <tmp>:1
------> 3$_ = 42; dd [:7⏏5.abs] # I'd like this one...
expecting any of:
colon pair
timotimo interesting
SmokeMachine m: $_ = 42; dd [:abs(.abs)] 19:45
camelia [:abs(42)]
SmokeMachine I could be writing less: github.com/FCO/EventSource/blob/ma...ra.pm6#L42 19:46
I think Zoffix already wrote something about that... 19:47
timotimo colonpairoscopy, yeah
Zoffix SmokeMachine: I proposed-but-then-rejected it in R#1462 19:53
synopsebot R#1462 [closed]: github.com/rakudo/rakudo/issues/1462 [RFC] [RFC] make `:.foo` mean `:foo(.foo)`, as in `:foo($_.foo)`
SmokeMachine Zoffix: yes, I was reading that link...
Zoffix m: say 42.:<-> 19:54
camelia 5===SORRY!5=== Error while compiling <tmp>
Decimal point must be followed by digit
at <tmp>:1
------> 3say 42.7⏏5:<->
Zoffix Ambiguitity
m: say (42).:<->
camelia -42
Zoffix s/A.+/bug/; 19:55
R#2094 19:56
synopsebot R#2094 [open]: github.com/rakudo/rakudo/issues/2094 [LTA] "decimal point must be followed..." error is too eager
Altreus OK I have a bunch of related classes. I'd like them to be able to refer to each other without introducing a circular dependency, and presumably I can do this without doing some C++ shenanigans like having one file that includes them all and I'm supposed to include that 20:52
is this what need is for? 20:53
I don't really understand the doc for need
raschipi Altreus: the way to do it is the same as in C++ 20:57
Can't have circular depedencies like you can in Perl 5.
Altreus I'm only doing 'use' so the types exist 21:00
is there some way of saying "This type is going to exist", so I can use it as a type?
this sounds like a step backwards, is all
:/
raschipi It comes as a cost of one-pass parsing, it's a trade-off 21:01
Altreus well butts 21:02
[Coke] this is the point of the conversation where we typically suggest using roles instead of classes for parts of the design, I think. 21:03
timotimo um
but there is a way of saying "this type is going to exist"
it's just stubbing the class
like class Foobar { ... }; 21:04
literally containing three dots
Garland_g[m] You can stub a class, and then the type exists, but you can't inherit from it until it is fully defined.
raschipi And it needs to be defined in the current scope, not in some other file
Altreus ya 21:05
timotimo m: class Parent {...}; class Bloop is Parent { }; class Parent { has $.foo }
camelia 5===SORRY!5=== Error while compiling <tmp>
'Bloop' cannot inherit from 'Parent' because 'Parent' isn't composed yet (maybe it is stubbed)
at <tmp>:1
timotimo ah, mhm
Altreus I'm not really sure I remember how to do it in C++ ;p
I have one class Message and another class Channe;
Channel
Channel has @.messages and Message has $.channel
So I'd like to provide the types to those 21:06
I dunno whether I prefer monkeying around with extra files, or just not putting the constraints on
Zoffix Altreus: just don't put the constraint 21:11
timotimo: another limitation is the stub can't be in a separate file.
Altreus in perl5 I'd be happy with that but I don't want to believe that there are any problems with perl6 21:12
Zoffix Altreus: all languages suck :)
Altreus ;_;
Zoffix :D
Altreus: stick everything into one file :P
Or make a build script that sticks everything into one file. Rakudo compiler does it that way :) 21:13
jnthn Or extract a role and use it in the two places :) 21:14
Zoffix :)
Actually, there's a hackish way to do a circular dependency 21:16
Altreus with a .c and a .h :P 21:17
Zoffix What's that? 21:18
Altreus one with the interface and one with the implementation
Zoffix Ah
Altreus which is basically a role and a class tbh
Zoffix No, by writing the constraint on one side as `has $.bar where do require ::('Bar')` :)
e: BEGIN { given '/tmp/z4222/'.mkdir { .add('Foo.pm6').spurt: 「class Foo { has $.bar where do require ::('Bar') }」; .add('Bar.pm6').spurt: 「use Foo; class Bar { has Foo $.foo }」 }; use lib '/tmp/Foo'; use Bar; use Foo; Foo.new: :bar(Bar) 21:19
evalable6 (exit code 1) ===SORRY!===
Could not find Bar at line 1 in:
/tmp/Foo
/home/bisecta…
Zoffix, Full output: gist.github.com/6433f04f8794be1a8a...cb3cc9b93a
Zoffix Dunno why the bot don't like it, but works locally :)
Altreus probably because use looks for a file? :s
tbrowder_ [Coke]: please see and comment on my proposal in doc issue GH #2185.
Zoffix Altreus: yeah, but I create those files in begin
Altreus oh yes hacky indeed 21:20
I think I'll pass
Zoffix No, the file creation isn't the hack. That's just for the bot
Altreus the constraints are documentation, not compilation
Zoffix The `has $.bar where do require ::('Bar')` is the hack
'cause you require a module on each typecheck :P 21:21
.oO( once do require … )
Altreus surely it is still a circular dependency because that module requires me!
Zoffix Altreus: yeah, it can knock itself out and require. The `require` stop doesn't involving requiring that module back
s/stop/step/; 21:22
The require-back step only happens during typecheck (well, if you add `once`, presumably just the first typecheck)
Zoffix Ah, I messed up braces that's why 21:25
e: BEGIN { given '/tmp/z4223/'.IO.mkdir { .add('Foo.pm6').spurt: 「class Foo { has $.bar where do require ::('Bar') }」; .add('Bar.pm6').spurt: 「use Foo; class Bar { has Foo $.foo }」 } }; use lib '/tmp/z4223'; use Bar; use Foo; Foo.new: :bar(Bar)
evalable6
Zoffix e: BEGIN { given '/tmp/z4223/'.IO.mkdir { .add('Foo.pm6').spurt: 「class Foo { has $.bar where do require ::('Bar') }」; .add('Bar.pm6').spurt: 「use Foo; class Bar { has Foo $.foo }」 } }; use lib '/tmp/z4223'; use Bar; use Foo; Foo.new: :bar(42)
evalable6 (exit code 1) Type check failed in assignment to $!bar; expected <anon> but got Int (42)
in block <unit> at /tmp/mLzVP7GOHX line 1
Zoffix works :) 21:26
the challenge is for this to be non-hacky, you need to keep sort of state inside the `where`, but that's not supported.
(keep state so that you load Bar just once) 21:27
oh
oh nm
Altreus going with "remove the constraints" 21:28
:D 21:29
Zoffix :D 21:31
tbrowder_ .ask [Coke] at your convenience please look at my last comment in doc issue GH #2185
yoleaux tbrowder_: I'll pass your message to [Coke].
[Coke] . 21:32
yoleaux 21:31Z <tbrowder_> [Coke]: at your convenience please look at my last comment in doc issue GH #2185
[Coke] tbrowder_: I see those alerts from GH. you don't have to also ping me here, btw.
but since we are both here: those comments seem to cover a lot more ground than my 2 (now 3) bullet points. 21:33
I also commented on the ticket.
tbrowder_ i don’t think that’s too much ground since they all logically fit together. yr mod to htmlify.p6 may have to change dirs but maintenance should be much improved imo. 21:49
timotimo what kind of chart would y'all use to display distances between time points? 21:59
warriors well it depends, if you have a set of two points, and you want to compare the sets, likes which set of two points have the biggest or smallest diff, i would use a simple bar chart 22:35
timotimo this is about showing when the individual GC runs start 22:36
so i have a series of points with ever-increasing values, i.e. a line graph would usually tend to look like a diagonal
warriors a line chart make sense, especial if you want to highlight the upward diagonal pattern 22:39
i think bar chart is more to drive attention to individual bar, like highest or lowest barn ... line charts are better to focus on the pattern of movement 22:40
timotimo it'll take me a long time to try this out ... because the cat's between keyboard and display again, demanding belly rubs and looking really cute 22:41
warriors :)
good luck
timotimo thanks
donpdonp META6.json: ... "depends" : ["Cro::HTTP", "URI"]; zef install . -> All candidates are currently installed; perl6> use URI; -> Could not find URI at line 1 in: 22:43
what am I missing?
timotimo unlikely, but ... more than one perl6 binary involved?
donpdonp im pretty sure its only 1 22:44
$ zef -i list|grep URI -> no matches. hmmm.
timotimo it could be that URI doesn't actually ahve a "provides" for a module named "URI"
timotimo also, perhaps you want "zef install --deps-only ." 22:44
donpdonp --deps-only also says everyhign is installed 22:45
timotimo and "zef install URI" does what? 22:46
donpdonp $ zef -i list|grep Cro -> Cro::Core:ver<0.7.6>...
i'll try it
===> Installing: URI:ver<.0.1.4>
$ zef -i list|grep URI => URI:ver<.0.1.4> 22:47
so whats wrong with META6.json
timotimo not sure. perhaps a thing regarding "you already installed this name/auth/version before, so i won't do anything" 22:48
donpdonp hmm anyone have a url parser they like? URI doesnt seem to do anything 22:53
benjikun donpdonp: Does it just not install? 22:56
if so, have you tried adding `--force-install`? 22:57
donpdonp benjikun: its installed 22:57
URI.new.parse("something.com/") => nil 22:58
geekosaur parse doesn't seem to produce anything; you're supposed to apply methods to the URI object? 23:02
it might be argued that it should return self, but currently it doesn't
benjikun donpdonp: `URI.new('perl6.org/');`
geekosaur that's probably the most straightforward way to fix it, yes 23:03
benjikun remove `.parse`, that's all
donpdonp i see. thx. so how would i get at say, the 'path' part of the url 23:04
benjikun `$url.path`
geekosaur save the object, use $obj.path
donpdonp got it. thx all.
benjikun :)
Gex_ Hi everyone 23:12
Kaiepi hm 23:37
i can't build rakudo
xyzq howdy everyone 23:40
TimToady everyone isn't here, apparently 23:43
guestorino haha, nice 23:44
Kaiepi this is what happens when i try to build rakudo hastebin.com/emicofoboj.sql
i'll try again genning moarvm and nqp
Kaiepi also about last night i don't get to the mental hospital for about another week since i need a doctor's notice and canada's mental health care system absolutely rules but i'll try to contribute in the meantime 23:47
TimToady Kaiepi: well, hang in there, and cut yourself all the slack you need 23:49
Kaiepi nope, build still fails 23:50
i'll make an issue
and thanks TimToady