»ö« 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.
00:00 rindolf joined 00:09 COMBORICO left 00:28 Cabanossi left 00:29 Rawriful left 00:31 Cabanossi joined
perlawhirl I don't even understand what to the final output was supposed to be. Did he wan to combine @a and @b and get 27 elems? 00:41
.tell Thrush @b.map( |(@a X |*) ) 00:48
yoleaux perlawhirl: I'll pass your message to Thrush.
00:50 rindolf left 00:52 Herby__ joined 00:58 troys is now known as troys_ 01:00 Cabanossi left 01:01 BenGoldberg joined, Cabanossi joined 01:14 colomon_ joined 01:15 colomon left, colomon_ is now known as colomon 01:23 mempko left 01:29 Herby__ left 01:30 Cabanossi left 01:31 Cabanossi joined 01:41 Ben_Goldberg joined, BenGoldberg left, Ben_Goldberg is now known as BenGoldberg 01:48 mcmillhj joined 01:56 darkmorph left 01:57 Herby_ left 01:59 margeas left, awwaiid joined 02:05 napo1eon left 02:07 eliasr left 02:08 COMBORICO joined
COMBORICO Why is A < a == True ? 02:09
I mean what is the reason purpose. It seems counter intuitive. 02:10
raiph m: say 'A' lt 'a' # True <-- is this what you mean? 02:13
camelia True
02:14 wamba joined
raiph (if so, then cuz ASCII) 02:14
COMBORICO Raiph, I'm confused.
Ohh! Ascii! I forgot about that.
Thanks! 02:15
02:21 cdg joined 02:23 mcmillhj left 02:28 araujo left, Cabanossi left, araujo joined, araujo left, araujo joined 02:31 Cabanossi joined 02:32 bitrauser joined, mson left 02:35 aindilis joined, bitrauser_ left, colomon left 02:38 cdg left, cdg joined 02:40 troys_ is now known as troys 02:43 mson joined, cdg left 02:46 ilbot3 left 02:56 ilbot3 joined, ChanServ sets mode: +v ilbot3 02:58 Cabanossi left, colomon joined 03:01 Cabanossi joined 03:03 COMBORICO left 03:22 raiph left 03:24 troys is now known as troys_ 03:29 riatre left 03:30 riatre joined, noganex_ joined 03:33 noganex left 03:40 Mrofnet joined 03:44 Morfent left 03:47 troys_ is now known as troys 03:50 noganex_ left, noganex joined 03:55 espadrine left 04:15 napo1eon joined 04:16 BenGoldberg left 04:20 noganex_ joined 04:21 Merfont joined 04:22 shadoxx joined 04:23 titsuki joined, noganex left, Mrofnet left, schelcj left 04:25 raydiak__ left 04:26 khw left 04:29 Cabanossi left 04:31 Cabanossi joined 04:42 Cabanossi left 04:44 Cabanossi joined 04:51 schelcj joined 04:53 troys is now known as troys_ 05:06 wamba left 05:12 mson left
Geth doc/W4anD0eR96-patch-1: 0fcc648cab | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6
Rewrite the document of Longest Alternation: C<|>

Review needed.
Try to close
05:22
doc: W4anD0eR96++ created pull request #1640:
Rewrite the document of Longest Alternation: C<|>
05:23
doc/W4anD0eR96-patch-1: bc84b2c64e | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6
Update regexes.pod6
05:26
05:28 Cabanossi left 05:30 Cabanossi joined 05:34 jaush joined, wander left
jaush like a small child bouncing up and down outside the not-yet-open sweets shop, i must ask: when does rakudo star 2017.10 open for business? 05:37
05:39 troys_ is now known as troys 05:44 wander joined 05:59 Cabanossi left, Cabanossi joined 06:04 cpage_ joined 06:13 shmibs joined 06:17 sena_kun joined 06:25 raydiak__ joined 06:26 darutoko joined 06:31 nadim joined, todd joined
todd Hi All, I question on "if". Is there a wasy to shorten the following "if"? 06:32
if ( $x ~~ /"<html>"/ && $x ~~ /"<body>"/ && $x ~~ /"</html>"/ and $x ~~ /"</body>"/ )
Any way to only say `$x ~~` once?
06:37 Piotr_ joined
geekosaur you can distribute the && inside the ~~ 06:41
m: my $b = '<html><body></body></html>'; say so $b ~~ (/"<html>"/ && /"</body>"/)
camelia True
geekosaur m: my $b = '<html><body></body></html>'; say so $b ~~ (/"<html>"/ && /"</boxy>"/) 06:42
camelia False
06:42 aindilis left 06:43 sena_kun left
El_Che jaush: it's already released! 06:48
jaush: depending on your operating system may be available. I released Linux packages yesterday (github.com/nxadm/rakudo-pkg). Rakudo Star released a Release Candidate 06:50
hombrew on mac is very quick in releasing builds as well
todd This is the whole line: 06:51
$ perl6 -e 'my $x="<html><br>\n<body><br>\nblah blah blah<br>\n</body><br>\n</html><br>\n"; if ( $x ~~ /"<html>"/ && $x ~~ /"<body>"/ && $x ~~ /"</html>"/ and $x ~~ /"</body>"/ ) { say "yes";} else { say "no";}'
geekosaur was there a problem with my suggestion? 06:52
todd I am looking at string full of html code. If I find<html>, <body>,</html>,</body>, my if statement is to presume it is properly formatted html. These four tests will not be in a row, but separated by many lines inside the string. 06:53
$b = '<html><body></body></html>' look like everything had to be in a row, not scatters all over the string. Am I mistaken?
jaush El_Che: i reside in the Land of Windows :/
geekosaur that weas the test string 06:54
it doesn;t have to be in order
todd opps. Did not look close enough. wait before responding
geekosaur $b ~~ (/"<html>"/ && /"</boxy>"/) # doesn't check order, just that each one matches
er, grabbed the wrong one. but still 06:55
todd That did the trick. Than y oU!
$ perl6 -e 'my $x="<html><br>\n<body><br>\nblah blah blah<br>\n</body><br>\n</html><br>\n"; if $x ~~ ( /"<html>"/ && /"<body>"/ && /"</html>"/ && /"</body>"/ ) { say "yes";} else { say "no";}' yes
06:57 cgfbee joined 06:58 apallatto left
todd And I wrote it down, so I don't have to ask it again! 06:58
06:58 Actualeyes joined
todd Another question: how do I capture a pipe in a line liner? 06:59
ecoh "abc" | perl6 -e 'say "the pipe was ????";'
echo nor ecoh
one liner. Man I make a lot of typos 07:02
geekosaur read from $*IN or possibly $*ARGFILES depending on whether you might also want to do command line parameters
moritz slurp() 07:03
or lines()
or get()
geekosaur ^ ways to 'read from'
todd $ echo "abc" | perl6 -e 'say "the pipe was $*IN";' the pipe was <STDIN> $ echo "abc" | perl6 -e 'say "the pipe was " ~ $*IN.lines;' the pipe was abc $ echo "abc\ndef" | perl6 -e 'say "the pipe was " ~ $*IN.lines;' the pipe was abc\ndef $ echo "abc\ndef" | perl6 -e 'my $x=get(); say "the pipe was $x";' the pipe was abc\ndef $ echo "abc\ndef" | perl6 -e 'my $x=slurp(); say "the pipe was $x";' the pipe was abc\ndef Note the extra line w 07:08
That did not format too well, but every suggestion worked. "slurp" gave me an extra line. What was that about?
07:08 troys left
sjn todd: slurp reads everything in one go 07:09
moritz todd: echo appends a newline
sjn no splitting on lines
moritz slurp included it
get and lines remove it
geekosaur and say added its own newline
(for things like this, it can be useful to bracket or delimit the output so you can see what's part of that and what's part of the fixed output e.g. "the pipe was |$x|" 07:11
todd Ah Ha! This shows it very clearly. 07:13
ls *Test.pl6* | perl6 -e 'my $x=slurp(); say "$x";'
jaush goodnight #perl6 07:14
moritz or say $x.perl
07:15 jaush left
moritz good morning jast 07:15
07:15 ChoHag left
geekosaur or dd, etc. 07:15
todd If I want keep the formatting of the bash command, I would use "slurp". If I only wanted the raw data, I would use "lines". $x=$*IN.slubp also keeps teh format.
moritz erm, jaush
sorry
07:22 ChoHag joined
todd Ah had. the deliter || adn {} both work to keep the format: 07:22
$ ls *Test.pl6* | perl6 -e 'my $x=$*IN.slurp; say "the pipe was {$x}";'
Question: was the format always there, just that say reacted differently to it?
geekosaur that actually surprises me, {} is normally arbitrary interpolation and shouldn't be visible in output 07:23
todd oops, I used slurp. the demiters did not work to retain the format 07:24
geekosaur slurp grabs everything as one string which may have newlines in it
the || I suggested was just show which newlines are in $x and which were added by e.g. say 07:25
todd I can see where I would want that at times!
I understand
geekosaur and .lines gives you an array of lines, each with the trailing newline removed
todd I am not gettting that with "lines" 07:26
ls *Test.pl6* | perl6 -e 'my $x=$*IN.lines; say "the pipe was $x";'
the pipe was CallFrameTest.pl6 CommandLineTest.pl6 CurlUtilsTest.pl6 FileTest.pl6 HashIndexTest.pl6 InlineTest.pl6 LogTest.pl6 LogTest.pl6.log MonthTest.pl6 RunNoShellTest.pl6 ShArTest.pl6 SubTest.pl6 TermTest.pl6 Timo.Attachmnet.Test.pl6 X11Clipboard.Test.pl6 X11Test.pl6 Xlib.Test.pl6
oops missed the :newlines removed"
geekosaur also that $x has an array in it, and it stringifies to concatenating them all with no delimiter 07:27
oh, with a space between, sorry 07:28
m: my $x = <a b c>; say $x.Str
camelia a b c
07:28 Cabanossi left
todd Got it! 07:29
ls *Test.pl6* | perl6 -e 'my @x=$*IN.lines; for @x { say $_ };'
07:30 Cabanossi joined
todd Thank you all. You guys saved me about two hours of head banging! Bye bye 07:31
07:35 abraxxa joined 07:42 rindolf joined 07:43 eugene_barsky joined 07:45 eugene_barsky left
Actualeyes /& 07:53
07:56 TEttinger left 07:57 Cabanossi left 07:58 domidumont joined 08:00 Cabanossi joined, pecastro left 08:01 parv joined 08:03 domidumont left 08:04 domidumont joined 08:16 abraxxa left 08:22 jameslenz joined 08:26 abraxxa joined 08:44 Cabanossi left, ChoHag left 08:45 Cabanossi joined 08:49 domidumont left 08:50 sproctor joined, domidumont joined 08:51 sproctor left 08:56 sproctor joined
moritz can anybody from the US or UK please check if you see a kindle version for preorder at www.amazon.com/Parsing-Perl-Regexe...484232275/ ? 08:59
09:02 wander left
moritz my first book wasn't available as an ebook from all countries, so I want to catch it early this time 09:04
... if it is indeed a problem
parv moritz, i see only the option of paperback (w/ note of being not released yet) in US 09:07
09:09 wander joined, todd left
moritz parv: ok, thanks 09:11
parv moritz, happy to help 09:12
cono same here (Ukraine) 09:15
09:18 robertle joined 09:20 pmurias joined
wander it docs "As with Perl 6, in general, comments in regexes start with a hash character # and go to the end of the line." 09:22
is this sentence worthy?
09:22 wamba joined
DrForr moritz - I see only Paperback Dec 29th here from .cz. 09:23
moritz DrForr, cono: thanks
DrForr English language, not logged in althoguh I have an account. And price in USD for that matter. 09:24
moritz wander: sounds OK
wander it is right, but feels redundant
moritz why? 09:25
PCRE doesn't have comments in regexes
so it makes sense mentioning it
you can try to make it more concise if you want
wander ok 09:27
m: say "abc" ~~ /abc #`()/
camelia 「abc」
wander m: say "abc" ~~ /abc # something /
camelia 5===SORRY!5===
Regex not terminated.
at <tmp>:1
------> 3say "abc" ~~ /abc # something /7⏏5<EOL>
Unable to parse regex; couldn't find final '/'
at <tmp>:1
------> 3say "abc" ~~ /abc # something /7⏏5<EOL>
expecting any…
09:27 Cabanossi left
wander I think the form #`() is more worthy to mention, not just as what it docs 09:28
that's why I think the doc strange
moritz the docs are meant to be comprehensive
so it should mention both 09:29
wander agree
pmurias moritz: doesn't PCRE have (?#...)?
09:30 Cabanossi joined
wander leave for a moment 09:30
moritz pmurias: ah, you're right 09:31
09:31 parv left
moritz still, different enough from #\N*$$ to make it worth mentioning 09:32
09:32 Merfont left, Merfont joined
pmurias moritz: #\N*$$ is allowed with a x modifier 09:32
moritz pmurias: right, but that's Perl 5 regex, not PCRE :-) 09:33
pmurias moritz: doesn't PCRE have a x modifier?
moritz and only as long as it doesn't contain the closing character for the regex, or some such 09:34
"man 3 pcrepattern" talks about it as being a compile-time decision 09:35
ah
If a pattern is compiled with the PCRE_EXTENDED option, most white space in the pattern
(other than in a character class), and characters between a # outside a character class and
the next newline, inclusive, are ignored. An escaping backslash can be used to include a
white space or # character as part of the pattern. 09:36
pmurias++
09:37 roguelazer joined 09:38 jercos joined 09:39 cdg joined 09:43 cdg left 09:45 mcmillhj joined 09:48 TheGrimFandango joined 09:49 wamba left, cog_ joined, mcmillhj left 09:52 cog__ joined, cognominal left 09:53 wamba joined 09:55 cog_ left 09:57 Cabanossi left 09:58 aborazmeh joined, aborazmeh left, aborazmeh joined 09:59 noganex joined 10:00 cpage__ joined, Cabanossi joined, roguelazer left 10:01 perlpilot_ joined, aeruder_ joined, jonas1 joined, atta joined, cgfbee left, kaare_ joined, noganex_ left, perlpilot left, cpage__ is now known as cpage, jdv79_ joined 10:02 cgfbee joined 10:03 roguelazer joined 10:04 shmibs left, evalable6 left, coverable6 left, unicodable6 left, coverable6 joined, unicodable6 joined, evalable6 joined 10:05 eliasr joined 10:06 shmibs joined 10:07 roguelazer left 10:08 gugod left 10:09 roguelazer joined, perlawhirl joined 10:11 shmibs left 10:12 shmibs joined 10:14 TheGrimFandango left, TheGrimFandango joined 10:15 roguelazer left 10:16 TheGrimFandango left, TheGrimFandango joined 10:17 roguelazer joined 10:18 TheGrimFandango left, TheGrimFandango joined 10:20 TheGrimFandango left, TheGrimFandango joined 10:25 ChoHag joined 10:28 wander left 10:29 Cabanossi left 10:30 Cabanossi joined 10:34 TheGrimFandango left, TheGrimFandango joined 10:36 gugod joined, TheGrimFandango left, TheGrimFandango joined 10:42 geekosaur left 10:46 wander joined
wander I've seen "Next #Rakudo #Perl6 SQUASHathon is in 7 days and ≈17 hours (2017-11-04 UTC-12⌁UTC+14)" 10:46
To introduce it to my friends, I wonder what is the exact time it starts 10:47
or it is a loose restriction 10:48
10:51 geekosaur joined
wander .ask AlexDaniel` ^^ 10:51
yoleaux wander: I'll pass your message to AlexDaniel`.
AlexDaniel squashable6: next
squashable6 AlexDaniel, ⚠🍕 Next SQUASHathon in 2 days and ≈23 hours (2017-11-04 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
AlexDaniel wander: it's an all-timezone thing :) So technically it lasts for 50 hours so that people in all timezones can squash bugs for their whole Saturday 10:53
wander got it, thank you
10:55 margeas joined 11:08 TheGrimFandango left, TheGrimFandango joined 11:10 TheGrimFandango left, TheGrimFandango joined 11:12 TheGrimFandango left, TheGrimFandango joined 11:14 TheGrimFandango left, TheGrimFandango joined 11:15 cpage left 11:17 sena_kun joined
wander I've write an essay to introduce the SQUASHathon in zh_CN at zhuanlan.zhihu.com/p/30618098 11:19
I'll appreciate if someone reviews it and corrects the improper express 11:21
11:22 cpage joined, TheGrimFandango left, zakharyas joined, TheGrimFandango joined 11:24 TheGrimFandango left, TheGrimFandango joined 11:34 TheGrimFandango left, TheGrimFandango joined 11:36 TheGrimFandango left, TheGrimFandango joined 11:38 ChoHag left 11:39 ChoHag joined 11:40 harrison joined 11:42 cognominal joined, Cabanossi left 11:45 cog__ left, Cabanossi joined
AlexDaniel wander: I've added a link to your blog post here: github.com/rakudo/rakudo/wiki/Mont...Squash-Day 11:49
wander thank you 11:50
AlexDaniel wander: feel free to edit that page, I think you should have access to do it
wander :-) 11:51
11:52 TheGrimFandango left, TheGrimFandango joined 11:54 TheGrimFandango left, TheGrimFandango joined 11:56 TheGrimFandango left, TheGrimFandango joined 11:58 TheGrimFandango left, TheGrimFandango joined 12:01 mcmillhj joined 12:05 mcmillhj left 12:10 TheGrimFandango left, TheGrimFandango joined
tyil wander: are you W4anD0eR96 on github? :> 12:11
wander yes
tyil I left some remarks on your latest PR
thanks for all your contributions thus far, I hope I'm not too hard on you
wander I see, thank you
of course not. your review is quite helpful 12:12
12:12 TheGrimFandango left
tyil ^_^ 12:12
12:12 TheGrimFandango joined 12:14 TheGrimFandango left, TheGrimFandango joined 12:16 TheGrimFandango left, TheGrimFandango joined 12:18 TheGrimFandango left, TheGrimFandango joined 12:19 Actualeyes left 12:20 TheGrimFandango left, TheGrimFandango joined 12:21 mcmillhj joined 12:23 bjz joined 12:24 bjz left, Actualeyes joined 12:26 mcmillhj left 12:29 number8 joined 12:31 number8 left 12:37 harrison left 12:43 mcmillhj joined, Cabanossi left 12:45 Cabanossi joined 12:47 APic joined 12:51 cdg joined 12:52 rgrau joined 12:55 cdg left, cdg joined 12:56 TheGrimFandango left, TheGrimFandango joined 12:58 TheGrimFandango left, TheGrimFandango joined 13:12 pecastro joined, mson joined 13:13 knight__ joined
knight__ m: class a { has %.b;}; my $c = a.new; say $c.b.defined; 13:13
camelia True
knight__ m: class a { has $.b;}; my $c = a.new; say $c.b.defined;
camelia False
knight__ Hmm, why is difference between hash/ scalar? 13:14
jnthn Because a % variable is always initialized with an empty Hash
knight__ jnthn: I understand, but for me is this slightly strange. 13:17
13:18 TheGrimFandango left, TheGrimFandango joined 13:19 perlpilot joined 13:20 TheGrimFandango left, TheGrimFandango joined 13:22 knight__ left, mcmillhj left 13:34 mcmillhj joined
Geth doc/W4anD0eR96-patch-1: 7e878dd4c6 | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6
Update regexes.pod6
13:37
13:38 TheGrimFandango left, TheGrimFandango joined
wander m: class a { has $.b;}; my $c = a.new; say $c.b; 13:40
camelia (Any)
wander m: class a { has @.b;}; my $c = a.new; say $c.b; 13:41
camelia []
wander m: class a { has %.b;}; my $c = a.new; say $c.b;
camelia {}
wander .tell knight__ ^^ what it is initialized
yoleaux wander: I'll pass your message to knight__.
13:42 Cabanossi left 13:43 fatguy joined 13:44 TheGrimFandango left
fatguy how can i call subroutine using $sigil e.g my $s="my_function"; sub my_function {return "halo"}; say &$s ???? 13:44
timotimo you want ::($s)() 13:45
13:45 Cabanossi joined
timotimo oh 13:45
but you have to put a & in front of the name
so either have $s be "&my_function" or use ::("&" ~ $s)()
fatguy timotimo: thanks, that's exactly i want ! 13:46
13:46 wander left 13:52 perlpilot left 13:53 perlpilot_ is now known as perlpilot, mempko joined
moritz or use &::($s)() 13:53
timotimo oh, good point 13:54
13:55 fatguy left 13:56 wander joined 13:57 mcmillhj left 13:59 aborazmeh left 14:01 khw joined 14:05 Khisanth left, raschipi joined 14:06 Khisanth joined 14:07 harrison joined
stmuk eek GH is Halloween themed 14:14
14:15 wamba left
ilmari where? 14:15
14:17 mcmillhj joined
raschipi squashable6: next 14:21
squashable6 raschipi, ⚠🍕 Next SQUASHathon in 2 days and ≈19 hours (2017-11-04 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
stmuk the dots are pumpkin coloured 14:27
14:28 COMBORICO joined
COMBORICO I'm just wondering why "where" was created when it seems "if" could have done the job: 14:30
sub foo( Int $bar where $n >= 0 ) { .... } 14:31
raschipi COMBORICO, Perl6 has a design rule that says that different things should be different 14:33
That's not an if, therefore it has a different name
[Coke] squash a thon edit: if there's a lot of discussion on a ticket, don't necessarily create a new ticket; Add a summary comment saying "here is what is left to do to resolve this issue". 14:34
raschipi [Coke]: What about tickets that need to be split?
COMBORICO sub foo( Int $bar if $n >= 0 ) doesn't this logically mean the same statement? 14:35
raschipi Nope, very different under the hood.
COMBORICO Hmm. I'll need to meditate on this. Thank you for your response. 14:36
raschipi COMBORICO: the type system is mostly enforced by the optimizer 14:37
Well, I'm not very familiar with it, but that's what I heard
14:37 harrison left
COMBORICO What is the optimizer? (I did a search already.) 14:40
raschipi the optimizer is a part of the compiler that takes code and turns it into different (meaning better) code. 14:42
14:42 Cabanossi left 14:43 jonas1 left 14:45 Cabanossi joined
raschipi COMBORICO: C++ has an optimizer too, it's not something Perl specific. It's the -O option for CC. 14:48
14:48 mr-foobar left
COMBORICO Hmm. I've never run into that topic in the beginner programming book i read. It was probably too old of a book (1998). 14:50
ugexe it doesn't make sense if you consider multidispatch, in which case maybe a switch statement would technically be ok since it can fall through, but definitely not an if statement
14:51 mr-foobar joined
[Coke] raschipi: splitting tickets is fine, sure. 14:52
DrForr stackoverflow.blog/2017/10/31/disl...languages/ 14:53
prepare for an onslaught, or at least a mild drizzle of trolling. 14:54
14:54 bdmatatu joined 14:58 darkmorph joined
ugexe some trolling surely... who dislikes delphi for anything other than the pricing 15:01
15:04 zakharyas left, zakharyas joined
ugexe visual basic has 80% dislike but is in a different table 15:06
raschipi Pricing is a way deeper issue than you imagine, it becomes ugly when people write applications in delphi and then stop paying for decades but depend on the application just the same.
15:08 Piotr_ left, zakharyas left
ugexe its not their fault someone stops paying. the real problem is it creates a barrier to entry, but this is not a problem in enterprise immediately (talent in this area will grow slower due to barrier to entry) 15:13
raschipi I'm dealing with enterprise here. It's a mess. Enterprise mean damaged goods most of the time. 15:14
In my experience at least
ugexe it usually means goods that are making money, and with that comes the fact you can typical get the licenses/support you need paid for 15:15
raschipi If it at least went through the IT department.
ugexe the code being shit or not doesn't really matter in this sense, although yeah enterprise code is usually what people have nightmares of 15:16
raschipi sure, but there is a fundamental problem with delphi that causes endless headaches, so that's why people dislike it. 15:17
15:23 callyalater joined 15:24 epony left, epony joined
raschipi m: my @a = Nil, |<a b c> 15:26
camelia ( no output )
ugexe m: say my @a = Nil, |<a b c> 15:27
camelia [(Any) a b c]
raschipi I changed to the REPL after writing that, thanks. 15:30
ugexe might be neat if camelia had REPL like function with like a 30s timeout, and global so all users in channel can build on the same program (for teaching, or as a game) 15:36
callyalater m: say 3 <=> 5; 15:37
camelia Less
15:40 Zoffix joined 15:43 zakharyas joined, Cabanossi left 15:44 TheGrimFandango joined 15:45 Cabanossi joined 15:46 wamba joined 15:47 TheGrimFandango left
Zoffix COMBORICO: there's some cross-over between `if` and `when` because they're general enough, but they perform fundamenally different things. `when` smartmatches the given conditional against the $_ topic variable, while `if` tests the conditional for truthiness. So for example, `$_ = " "; 42.say when 0` would print 42, because `0` smartmatches numerically and white-space-only string is also zero. `42.say if 0` 15:48
15:48 TheGrimFandango joined
Zoffix on the other hand would never print 42, because 0 is false. Another case would be `$_ = 0; 42.say when 0 or 5`; naively that looks like a test for whether $_ is 0 or 5, but it's actually only testing for whether it's 5. Lastly, there's a difference in block forms: `$_ = 42; when 42 { .say }; say "never here"` will only print 42, because `when` bails out of the block when it matched something, while `$_ = 42; 15:48
if $_ == 42 { .say }; say "never here"'` would print "never here"
m: 0 does True; 42.say if 0 # well, it can print 42 in this case, but it's a hack :P 15:49
camelia 42
15:54 TheGrimFandango left
COMBORICO Zoffix, why does your second example only tests for 5 and not 0? 15:54
15:55 TheGrimFandango joined
Zoffix COMBORICO: because the expression gets evaluated; 0 is false so the conditional evaluates to 5, and it's that 5 that's used for smartmatching. 15:56
You can use a Junction to test for both: `when 0|5 { ... }`
Zoffix backlogs and nitpicks:
15:56 TheGrimFandango left
Zoffix .lines returns a Seq, not an Array. It's an important difference, as Seqs are lazy and improperly taking care of them from .lines (e.g. closing the handle before you iterated it) will cause issues 15:57
15:57 TheGrimFandango joined
ugexe didn't there used to be a .lines(:close)? 15:58
lizmat ugexe: indeed, but there was no way to make it close when you would stop reading before the last line read 15:59
ugexe ah, .close on anything lazy can't really work i suppose 16:00
Zoffix ugexe: it's still there, but it won't close until you iterate the Seq fully, so code `{ my $fh will leave {.close} = "foo".IO.open; return $fh.lines }` will crash if the returned Seq is riefied, 'cause the handle is closed already
todd, FWIW, you can change $*IN.nl-in, to affect what get/lines split on. docs.perl6.org/type/IO::Handle#method_nl-in 16:02
jaush, the compiler just got released and usually when Star release is planned, it follows in about 1-2 weeks afterwards. There's already a Release Candidate available that you can help test: pl6anet.org/drop/ 16:04
Zoffix &
16:04 Zoffix left
COMBORICO Zoffix, okay; i understand now that 'when' bails when matched, and 'if' continues on to the rest of the statement. What is this m: notation people keep using? (I didn't understsnd the hack.) 16:06
(no need to explain hack, as i barley got through the initial explanation.)
stmuk moritz: I see "pre-order" US Amazon and "Currently Unavailable" UK 16:11
moritz stmuk: thanks!
16:12 Redrield_ joined, darkmorph left
Redrield_ Can I use libraries from cpan in perl 6? 16:12
I need to interact with inotify but I couldn't find anything that does that in the perl 6 module directory 16:13
16:13 aindilis joined 16:14 Zoffix joined
ilmari you can use Inline::Perl5, but if the Perl5 module just wraps a C library, it's probably better to use NativeCall to call that directly 16:14
ugexe m: use JSON:from<Perl5>;
camelia ( no output )
Zoffix COMBORICO: the `m: ` is the eval bot trigger. The hack is using `does` infix operator to mix-in a role that overrides `.Bool` method on `0` object to return `True` and since integer constants 0-100 are cached, the second 0 in the `if` statement gets that modification and when `if` calls .Bool on it, it returns True instead of normal False 16:16
COMBORICO: and to clarify: the block form of `when` (e.g. `when 42 {...}`) bails out; the postfix form (e.g. `... when 42`) does not 16:17
16:19 Piotr_ joined
COMBORICO Bot trigger. Hmm. So it is a remote Perl 6 terminal? 16:19
moritz m: say 'Hello, COMBORICO' 16:20
camelia Hello, COMBORICO
moritz yes, but it's stateless (so it doesn't remember variables from previous executions)
so it's a very simple thing
COMBORICO Oh. I see.
16:21 mcmillhj left
COMBORICO I remember typing in code, and the bot was triggered by just that. 16:21
Zoffix Yeah, there's another bot that heuristically triggers for some code 16:22
say 42
evalable6 42
16:22 TheGrimFandango left 16:23 TheGrimFandango joined
ilmari m: my %h<foo bar baz> = 1..3; 16:24
camelia 5===SORRY!5=== Error while compiling <tmp>
Shaped variable declarations not yet implemented. Sorry.
at <tmp>:1
------> 3my %h<foo bar baz>7⏏5 = 1..3;
16:24 TheGrimFandango left 16:25 TheGrimFandango joined
moritz m: my %h = (%<foo bar baz> = 1..3); say %h 16:25
camelia Use of Nil in string context
in block <unit> at <tmp> line 1
Died with X::Hash::Store::OddNumber
in block <unit> at <tmp> line 1
Zoffix m: (my %h)<foo bar baz> = 1..3;
camelia ( no output )
callyalater say "Hello!"
evalable6 Hello!
moritz m: my %h = <foo bar baz> Z=> 1..3; say %h
camelia {bar => 2, baz => 3, foo => 1}
ilmari nice 16:26
Zoffix m: my %h = 1..3 RZ <foo bar baz>; say %h
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing infix inside R
at <tmp>:1
------> 3my %h = 1..3 RZ7⏏5 <foo bar baz>; say %h
expecting any of:
infix
infix stopper
Zoffix m: my %h = 1..3 RZ, <foo bar baz>; say %h
camelia Odd number of elements found where hash initializer expected:
Found 3 (implicit) elements:
Last element seen: $("baz", 3)
in block <unit> at <tmp> line 1
Zoffix :(
ilmari m: my %h = 1..3 RZ=> <foo bar baz>; say %h 16:27
camelia {bar => 2, baz => 3, foo => 1}
Zoffix Ahh
raschipi m: my %h = 1..3 RZ=> <foo bar baz>; say %h
camelia {bar => 2, baz => 3, foo => 1}
raschipi ops, dupe
ilmari m: my %h = 1..3 ZR=> <foo bar baz>; say %h
camelia {bar => 2, baz => 3, foo => 1} 16:28
16:28 eythian joined, eythian left, eythian joined, tojo left, synopsebot left, dalek joined, ChanServ sets mode: +v dalek, synopsebot joined, ChanServ sets mode: +v synopsebot
callyalater It looks like the zip and reverse operators (is that what they would be called?) can be put in any order (ie. `RZ= 16:29
RZ=> or ZR=> 16:30
Zoffix metaoperators yeah
m: my %h = 1..3 ZRRRRRRRRRRRRRRRRR=> <foo bar baz>; say %h # can even do this :P
camelia {bar => 2, baz => 3, foo => 1}
16:30 TheGrimFandango left
zostay omgosh... that is amazing lol 16:30
callyalater m: my %h = 1..3 ZR=> <foo bar baz>; say %h 16:31
camelia {bar => 2, baz => 3, foo => 1}
16:31 TheGrimFandango joined
callyalater m: my %h = 1..3 ZRR=> <foo bar baz>; say %h 16:31
camelia {1 => foo, 2 => bar, 3 => baz}
callyalater m: my %h = 1..3 ZRRR=> <foo bar baz>; say %h
camelia {bar => 2, baz => 3, foo => 1}
callyalater m: my %h = 1..3 RZR=> <foo bar baz>; say %h
camelia {1 => foo, 2 => bar, 3 => baz}
callyalater That is interesting. 16:32
Zoffix mm: my &infix:<♥> = &[ZRRRRRRRRRRRRRRRRR=>]; my %h = (1..3) ♥ <foo bar baz>; say %h # can even do this... :P
16:32 TheGrimFandango left 16:33 TheGrimFandango joined
callyalater m: my &infix:<♥> = &[ZRRRRRRRRRRRRRRRRR=>]; my %h = (1..3) ♥ <foo bar baz>; say %h # can even do this... :P 16:33
camelia {bar => 2, baz => 3, foo => 1}
callyalater That is cool
m: my &infix:<♥> = &[ZRRRRRRRRRRRRRRRRR=>]; my %h = (1..3) R♥ <foo bar baz>; say %h
camelia {1 => foo, 2 => bar, 3 => baz}
callyalater WOW! 16:34
I like it.
16:34 Geth joined, ChanServ sets mode: +v Geth 16:36 committable6 left, committable6 joined, ChanServ sets mode: +v committable6, TheGrimFandango left 16:37 TheGrimFandango joined 16:38 TheGrimFandango left 16:39 TheGrimFandango joined
tbrowder hi, #perl6, good <local-day-part> to you all! 16:39
Zoffix \o
16:41 mcmillhj joined
tbrowder hi, Zoffix! i’m lookng for a kind soul who will volunteer to critique my advent blog during its development prior to publishing at mignight utc on 3 dec. 16:42
s/mig/mid/ 16:43
Zoffix is a bad critic, sorry. 16:44
tbrowder not so, Zoffix, but anyway you have too much on your plate all the time... 16:45
Zoffix :)
moritz tbrowder: I'll be happy to proof-read it for you 16:46
the sooner you are done, the better :-)
tbrowder thanks, moritz. i have a draft started, and i would appreciate your thoughts on the general flow and bullet points, but not until i get it fleshed out a bit more—maybe in a few days. 16:49
16:49 khw left 16:50 khw joined
moritz tbrowder: sure, just ping me when you think it's ready 16:50
tbrowder roger, thnx
moritz fwiw I also have a first draft of my advent post sidding on my hard drive 16:52
it's written as if my second book was already released, which I hope it will be by the time the advent calendar starts 16:53
if not, I have to rewrite some portions :-)
raschipi moritz++
COMBORICO m: my $test = string; say substr "hello world" , 0 , 6; say $string; 16:55
16:55 Zoffix left
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$string' is not declared. Did you mean 'Stringy'?
at <tmp>:1
------> 3; say substr "hello world" , 0 , 6; say 7⏏5$string;
16:55
COMBORICO Don't laugh at me! 16:56
moritz nobody laughs. We've all been there.
COMBORICO Too long to type again on my phone. I know i need to say $test. 16:57
ugexe for me its usually do I want subst or substr
timotimo Substr 2.0 Beta
COMBORICO Heh. Yeah. I was just kiddin' around.
Heh 16:58
raschipi COMBORICO: It would fail anyway, complaining it doesn't know a string subroutine.
COMBORICO "string", u happy? Haha.
moritz anyway, substr() doesn not modify in place
Geth mu: 76c5211554 | (Tom Browder)++ (committed using GitHub Web editor) | misc/perl6advent-2017/schedule
tweak title
16:59 abraxxa left
raschipi I'm not the one you need to make happy, it's the compiler, ahahaha 16:59
COMBORICO I'm just trying to determine if substr is copy and paste or cut and paste.
moritz the former
COMBORICO Heh. True
Thanks. Back to the book.
moritz m: my $x = 'abcdef'; say substr $x, 3; say $x
camelia def
abcdef
moritz COMBORICO: which book are you reading?
COMBORICO *grinning 17:00
Think Perl 6
moritz ah, good one
COMBORICO Yours is the Fundamental?
moritz yes 17:01
and working on a book on regexes and grammars
17:02 Redrield_ left
raschipi moritz will make parsing easy for the first time ever, it will be a revolution in computer science 17:02
COMBORICO I will submit a VERY detailed review it this book in time. 17:03
moritz chuckles 17:04
COMBORICO Of*
raschipi are you liking it?
COMBORICO Having already learned the fundamentals in C++ from Dietel, it is an okay book. But for the first-timer, it is coming short. 17:05
17:06 kyan joined
moritz this inspires me to go off-topic a bit 17:10
when writing documentation, or even books, I find it very hard to decide how detailed or how fast to describe something
17:10 robertle left
COMBORICO Dietel (at least the father, I'm not sure about the son) has been the best book, though i also struggled and have complaints with his book. 17:10
moritz if you gloss over something, the less experienced readers will be confused or lost 17:11
if you go into great detail, the more advanced readers will be bored
and if you bore them too often, you lose them too 17:12
but very often you don't even know those readers
COMBORICO I hated Stroustrupe's book for beginners. I like to learn from seeing full programs, not just code snippets.
moritz so, I really want a technology-assisted solution to that
COMBORICO And i like to see the output of the program. Very helpful. 17:13
moritz sjn++ has been working on something related a while ago
COMBORICO: you might like my style :-)
here's an excerpt chapter: perltricks.com/article/plotting-with-perl-6/ 17:14
COMBORICO Great detail and doses of repeating yourself in the immediate lesson, and also reminding the reader in subsequent chapters, is what i like.
moritz (though might a bit too far when you're in the early chapters of "Learning Perl 6")
17:15 Piotr_ left 17:16 scovit left
COMBORICO Moritz, yes, i realized a few days ago that i should have picked yours. I actually went to your perl6 book list, but i forgot about it. Then a few months later, I got some more books mainly concerning with networking and see, and I decided to pick up a pearl book, and somehow pink pearl 6 was purchased. 17:16
( apologies for using voice recognition) 17:18
Yeah, I think I was attracted to think Pearl 6 because the idea of learning from the ground up with a peeling. 17:19
Was appealing
17:20 ChoHag left
COMBORICO Afk 17:20
raschipi away from voice recognition that is.
17:20 Ven joined 17:21 Ven is now known as Guest12701 17:23 napo1eon left
COMBORICO Heh yeah I was thinking the same thing. I just wanted to say that before I go so all this text is in one block. that I'm a different kind of reader than the typical programming a reader. I I hate math. Actually I don't hate math, math hates me. And so my style of writing these programming books is not easy exercises rather I'm just reading through them. I'm not sure exactly what kind of programmer or job I'm looking to get into that 17:24
Is not to read I'm sorry is not to do the exercises
I understand that this is contrary to what most people say you should do. 17:25
This is the main reason that I like to go through full programs in textbooks, and why I like repetition especially in subsequent subsequent chapters
Afv 17:26
17:26 perllearner89 joined 17:27 perllearner89 left 17:29 knight__ joined 17:30 TheGrimFandango left
knight__ Hello, is there any kind of exception like ImportError in python. I would like to create try/catch when use 'use module', because I would like to print prettier error message, but I do not know how to catch this error. 17:31
yoleaux 13:41Z <wander> knight__: ^^ what it is initialized
knight__ ?
17:32 epony left, epony joined
knight__ Or what is the perl way to handle problem with dependencies... 17:33
moritz knight__: "use" is (unlike "import in python") compile-time, so you can't catch its errors with a runtime construct such as try
knight__: you have to switch to "require" if you want custom error handling for it
17:33 sproctor left
AlexDaniel squashable6: next 17:34
squashable6 AlexDaniel, ⚠🍕 Next SQUASHathon in 2 days and ≈16 hours (2017-11-04 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
17:36 darutoko left
knight__ moritz: Thanks 17:36
17:37 domidumont left 17:39 HoboWithAShotgun joined
HoboWithAShotgun g'day 17:39
raschipi day 17:43
17:48 zakharyas left
rindolf HoboWithAShotgun: hi 17:53
callyalater I'm looking at the Metamodel::EnumHOW nqp class, but I can't get it to work like the Metamodel::ClassHOW nqp class. Is there any documentation about it?
17:55 COMBORICO left 17:56 COMBORICO joined
moritz callyalater: if there is none on docs.perl6.org, likely not 17:57
callyalater: what exactly are you trying to do?
17:58 Cabanossi left 18:00 Cabanossi joined 18:05 mcmillhj left 18:07 wamba left, mcmillhj joined 18:08 wamba joined
callyalater I'm looking at this question on StackOverflow: stackoverflow.com/questions/470334...-in-perl-6 18:10
18:10 darkmorph joined 18:14 troys joined
geekosaur I think enums are still a bit of a hack that requires nqp code to make work... and this hasn't been fixed because enums need to be rethought? (in particular, things tend to go wrong when the underlying type isn't Int iirc) 18:14
18:15 cdg left
callyalater Dang. 18:15
On the perl6 website it has a deadlink to the Metamodel::EnumHOW class (see here: docs.perl6.org/language/typesystem#Metaclass) 18:16
raschipi m: say Order ~~ Enumeration; say Bool ~~ Enumeration; #Maybe it has to do with the fact that Bool is defined very early in NQP and that requires defining enum? 18:17
camelia True
False
18:17 zakharyas joined
AlexDaniel callyalater: indeed. Please file an issue for it on github.com/perl6/doc/issues/ 18:17
moritz callyalater: I've added my answer on SO
18:18 Mrofnet joined 18:21 Merfont left
callyalater moritz: Awesome. 18:21
AlexDaniel: I filed an issue for it. 18:22
AlexDaniel callyalater++
moritz fwiw I read the source code from EnumeHOW.nqp, and used two of the first three methods in there :-) 18:23
callyalater moritz: I was looking at the source code as well, but was unable to get it to work properly. 18:26
18:31 darkmorph left, Piotr_ joined
moritz some experience with the MOP certainly helps :-) 18:34
callyalater True. True. 18:36
18:37 domidumont joined 18:39 zakharyas left 18:42 mson left
knight__ moritz: require, shall I make some change in some $PATH? 18:44
becauce when I change use -> require
moritz knight__: no. But you should be aware that require doesn't import any symbols by default
18:44 darkmorph joined
knight__ No such symbol 18:45
Yes :-)
I see
18:47 epony left, epony joined 18:48 epony left, epony joined 18:49 Guest12701 left 18:51 epony left 18:52 epony joined
COMBORICO I'm back. 18:53
knight__ Seems, I do not understand how it works. So, I am going out, thank you for today.
18:57 setty1 joined 19:00 cpage_ left 19:02 knight__ left 19:04 Merfont joined 19:05 raschipi left 19:08 Mrofnet left
Voldenet m: say so "ą" eq [*.NFKD,*.NFC,*.NFD].map({ $^a("ą") }).all 19:10
camelia True
Voldenet hm, this doesn't look the most succinct
am I missing some trick to use here? 19:11
19:13 p6steve joined
moritz m: say "ą".NFD 19:14
camelia NFD:0x<0061 0328>
moritz m: say "ą".NFD.Str 19:15
camelia ą
moritz Voldenet: it seems that eq coerces its arguments to Str
m: say "ą".NFD eqv "ą".NFC
camelia False
Voldenet that's okay, that's what I wanted to show
19:16 AlexDaniel left
[Coke] there is no shortcut for { stuff; CATCH { .message.note && exit 1 } } , is there? 19:16
moritz m: say so "ą" eq (.NFKD, .NFC, .NFD).all given "ą"; # another way to write it, for Voldenet 19:21
camelia True
moritz m: say so "ą" eq <NFKD NFC NFD>.map({"ą"."$_"()).all 19:22
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3so "ą" eq <NFKD NFC NFD>.map({"ą"."$_"()7⏏5).all
expecting any of:
statement end
statement modifier
statement modifier l…
moritz m: say so "ą" eq <NFKD NFC NFD>.map({"ą"."$_"()}).all
camelia True
Voldenet I like the last one, but 'say so "ą" eq (.NFKD, .NFC, .NFD).all given "ą";' sounds more readable :P 19:24
19:25 Ven joined
moritz aye :-) 19:26
19:26 Ven is now known as Guest53736 19:27 p6steve left
sjn is it possible to make a hyper operator out of . and a list of functions? 19:28
moritz if you have actual function objects, >>() or >>.() should invoke them 19:29
sjn something like... "ą" «.« NFD, NFC
moritz but there you only have method names 19:30
m: say (&sin, &cos, &sqrt)».(0.5)
camelia (0.479425538604203 0.877582561890373 0.707106781186548)
moritz m: say (&sin, &cos, &sqrt)»(0.5)
camelia No such method 'CALL-ME' for invocant of type 'Rat'
in block <unit> at <tmp> line 1
moritz this tries a coercion, not an invocation, it seems 19:31
so with . it is
19:31 telex joined
Voldenet m: say so "ą" eq [*.NFKD,*.NFC,*.NFD]».("ą").all 19:32
camelia True
19:35 ChoHag joined
gfldex issued that ENODOC 19:36
19:42 Cabanossi left 19:44 Cabanossi joined
COMBORICO Is it correct to say -> converts a variable into a topical variable? 19:45
moritz not really
-> introduces a signature
m: my $block = -> $a, $b { $a + $b }; say $block(1, 4) 19:46
camelia 5
COMBORICO Hmm. Okay. I'll need to go more reviewing. Thanks.
moritz a construct like "for 1, 2, 3 -> $x { ... }" is "just" a special case of that syntax 19:47
COMBORICO Yes, that's the construct in question. 19:49
Pointy block introduces signatures? I'll add this note into the book. 19:50
HoboWithAShotgun i'm lost. I want to pass a hashref as a positional argument to EXPORT. 19:51
but neither use Foo { :a(1) } nor use Foo %{ :a(1) } works 19:52
ugexe :a<1>
HoboWithAShotgun the first complains about the tag not existing (why does it even care? it's a psitional hashref),
the second doesnt even compile 19:53
ugexe ah i see, maybe ${}
19:53 TEttinger joined
HoboWithAShotgun "Could not evaluate arguments" 19:53
19:53 troys is now known as troys_ 19:55 troys_ is now known as troys
HoboWithAShotgun
.oO( Raider heißt jetzt Twix )
19:56
geekosaur I think the syntax is not designed for your use case 19:58
19:58 p6steve joined, espadrine joined, lizmat left
COMBORICO moritz, how would you finish this? 'for 0..$fruit.chars - 1 -> $index' in English reads, " 4 through however many characters are in variable fruit (which is being determined by method chars) minus one, where index is BLANK by the pointy-block." 19:58
4 = for 19:59
19:59 lizmat joined 20:00 cdg joined 20:04 rgrau left
moritz ... where $fruit is a parameter to the pointy block 20:05
or ... where the index is passed to the pointy block 20:06
HoboWithAShotgun it works with a closure: 20:08
use Test::Color sub { :ok("blue on_green"), :nok("red on_white") };
geekosaur yes, it avoids the syntax that considers what you are doing a tag 20:09
20:09 cdg left, domidumont left
HoboWithAShotgun i consider not being able to use a hashref a bug though 20:09
20:09 p6steve left, cdg joined
HoboWithAShotgun ok, cool. i am going to upload this within the hour 20:11
gfldex HoboWithAShotgun: this may help gfldex.wordpress.com/2016/01/18/a-...direction/
20:11 ivans joined
[Coke] "what's a hashref?" 20:14
(I think that's a p5-ism that doesn't have a corresponding thing in six.) 20:15
HoboWithAShotgun m: my %hash = :a(1); my $hashref = %{ :a(1) }; %hash.perl.say; $hashref.perl.say 20:19
camelia {:a(1)}
${:a(1)}
ivans good morning 20:20
geekosaur it's not a hashref
just a hash stored in a scalar
El_Che generics
oops 20:21
ignore
ivans #java is that way ----->
geekosaur *some* things wil lbehave like the p5-think you are using. and then you will get bitten hard when what they really refuses to play like p5 hashrefs
El_Che actually it was about c++ :)
ivans :o :D
I thought generics is a forbidden word among c++ people
El_Che yes, exactly. That's why I used 20:22
HoboWithAShotgun exactly. it's a scalar
geekosaur uh
HoboWithAShotgun and therefore it must be a positional! argument when i say
geekosaur no
El_Che ivans: someone was explaining that to me without using the word generics :)
HoboWithAShotgun use Foo %{ :a };
but Perl interprets that as if i wrote use Foo :a; 20:23
geekosaur $ *defaults* to scalar. it can be whatever you put in it
HoboWithAShotgun that's abug
geekosaur and % doesn''t do what you think either
HoboWithAShotgun m: my $x = :a; say $x 20:24
camelia a => True
COMBORICO I seem not to be able to use search at docs.perl6.org/ on my Android. 20:25
20:25 AlexDaniel joined
COMBORICO "Enter" is not executing the search. 20:25
Dolphin browser 20:26
ugexe m: BEGIN my $a = %(a => 1, b => 2); use Test $a, :DEFAULT; 20:27
camelia 5===SORRY!5=== Error while compiling <tmp>
Error while importing from 'Test':
no EXPORT sub, but you provided positional argument in the 'use' statement
at <tmp>:1
------> 3%(a => 1, b => 2); use Test $a, :DEFAULT7⏏5;
20:28 Guest53736 is now known as Ven``
ugexe so if you also pass a named argument it seems to pick up that $a is positional 20:29
20:29 Zoffix joined
Zoffix COMBORICO: works for me. What search term are you using? 20:29
moritz that does looks kinda fishy for me 20:30
COMBORICO Pointy block
Zoffix COMBORICO: it displays results without pressing "ENTER"; just searches as you type
COMBORICO Oh!
Zoffix COMBORICO: for that term it shows a red "No search results" message right under the box. Does it show up for you?
geekosaur hm. javbascript disabled?
COMBORICO No
I don't know *blushing 20:31
I'll just use a search engine go-around. Thanks guys. 20:32
20:34 AlexDaniel left
Zoffix COMBORICO: can't repro, sorry. Even set the most puritanical settings and it still worked. Perhaps your network is blocking some of the used resources vOv 20:35
COMBORICO Thanks for trying. 20:37
20:38 cdg_ joined
ugexe `BEGIN my $hash = %(:a<1>, :b<2>); use MyModule $hash, "\$var";` this seemed to work, where $var is one of the symbols it actually exports (e.g. a key of $hash) based on the example in docs.perl6.org/language/modules#EXPORT 20:39
[Coke] COMBORICO: what browser/OS?
(any errors in the JS console?)
COMBORICO Dolphin Android version... 20:40
[Coke] ah, sorry, iphone stack here. :|
Zoffix ugexe: work how? It's still isn't passing the hash 20:41
20:42 cdg left
Zoffix And it doesn't complain with `use Foo $bar` for me; so there's no reliance on also passing a named arg 20:42
ugexe yes it does: gist.github.com/
20:42 Cabanossi left
ugexe grr 20:43
gist.github.com/ugexe/ed706e8fd613...91525e807c
20:44 cdg_ left 20:45 bajanme joined, Cabanossi joined, mempko left
Zoffix ugexe: ah, I was using binding. If you bind instead of assign to $hash it ends up as `Any` and also works with just as `use Foo $hash;` 20:46
COMBORICO What is ~$0 in English? 20:48
20:48 koto joined
geekosaur the matched string from a regex, as a string instead of as a match object 20:49
[Coke] ~ is "convert to Str" (string)
Zoffix m: "foobar" ~~ /(.**3).+/; say $0; say ~$0
camelia 「foo」
foo
COMBORICO Thank you. Must it always be 0? Or will ~$x work? 20:50
Zoffix COMBORICO: yes, the `~` is just a prefix operator that calls .Str
20:50 sena_kun left
[Coke] m: my $x = 2e3; say ~$x; 20:50
camelia 2000
Zoffix relocates
20:50 Zoffix left 20:51 knight__ joined
COMBORICO Larry Wall wasn't playing around when he said Perl 6 is operator-rich. 20:51
geekosaur COMBORICO, $0, $1, etc. will work. $x for some variable x will not; use $/[$x] instead 20:52
20:53 mcmillhj left
COMBORICO My face is melting. 20:53
Thanks, though. So much going on.
20:55 mcmillhj joined 20:57 bajanme left 21:03 hankache joined
COMBORICO Zoffix, is .Str method the thing under-the-hood in string concatenation, ex. [ say "ban" ~ "ana"; ] 21:07
21:12 SourceBaby joined, ChanServ sets mode: +v SourceBaby 21:13 Zoffix joined
Zoffix s: &infix:<~>, \('', '') 21:14
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/4fca...r.pm#L2793
Zoffix s: &infix:<~>, \(42, 42)
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/4fca...ngy.pm#L21
21:14 Thrush joined
Thrush I read somewhere that in Perl6, unlike Perl5, you should always close your filehandles, even when they go out of scope. Is this true? 21:15
yoleaux 00:48Z <perlawhirl> Thrush: @b.map( |(@a X |*) )
Zoffix COMBORICO: ^ yes, but only for non-Str objects (it calls .Stringy actually, but that's basically .Str) 21:16
COMBORICO Thank you! 21:17
Thrush Wow... yoleaux. You remembered me? I'm impressed!
Zoffix COMBORICO: there are a lot of operators but there's also a lot of consistency among them, so you have a lot less to learn: infix ~ is concat, prefix ~ is string coercion, ^~ is a stringy bit op 21:18
geekosaur just means someone left a message
Zoffix All have '~' symbol
geekosaur the filehandle thing has been fixed, they're garbage collected and closed properly now
COMBORICO I see. 21:19
Zoffix Thrush: mostly-true, yes. In perl 5, handles are auto-closed when they go out of scope while in Perl 6 they get closed when GCed. So that means in certain situations, if you don't close your handles, you might open too many files before the handles are GCed 21:20
Thrush: but many common IO operations can be done with IO::Path class and you never even deal with handles
(not directly I mean; they are still used under the hood) 21:21
GC == Garbage Collected 21:23
Thrush So if I wanted to do the p5 equivalent of: open(my $fh, 'blah.txt') or die ...; while (<$fh>) { ... }; How would I do that in Perl6 ?
moritz my $fh = open 'blah.txt; for $fh.lines { ... }; 21:24
21:24 Ven`` left
Zoffix Thrush: I'd write that as: for lines 'blah.txt' {…} 21:24
No handle involved
21:26 rindolf left
Zoffix lines returns a lazy Seq, so just like with Perl 5's version, you wouldn't load entire file into memory, just buffer-sized chunks (0x1000000 bytes) at a time 21:28
*0x100000 bytes 21:29
Thrush So, in moritz's suggestion ( my $fh = open 'blah.txt; for $fh.lines { ... }; ), would I have to close the filehandle?
Zoffix Thrush: it would be a good idea, yeah
Thrush: you can also write it as `my $fh will leave {.close} = open … and it'll get closed when the block is left 21:30
eco: Trait::IO 21:31
buggable Zoffix, Trait::IO 'Helper IO traits': github.com/zoffixznet/perl6-Trait-IO
21:31 mcmillhj left
Thrush I just tried: for lines 'script.pl6' { .flip.say } and what I got was "6lp.tpircs" as output. It doesn't look like it read the file. 21:31
Zoffix or use that module and do my $fh does auto-close =
Thrush: sorry brain fart: 'blah.txt'.IO.lines 21:32
Typing on the phone and cheated, entirely forgetting that lines(Str) has a non-IO candidate :)
geekosaur I admit I was wondering of that wanted to have a .IO 21:33
Zoffix wonder what lines(IO:;Path) does, considering IO::Path is Cool :)
s: &lines, \('.'.IO) 21:34
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/4fca...ors.pm#L98
Thrush Okay, that printed out the file contents, but as one big line. That doesn't make sense to me. Why not as multiple lines?
Zoffix yeah, does IO
Thrush: weird; can you pastebin your code/input file? 21:35
Thrush: wild guess: you're assigning .lines to a $ variable?
geekosaur Thrush, I get a list of strings. note that displaying that in some ways will concatenate theb back together again
21:36 kyan left
buggable New CPAN upload: Test-Color-1.001001.tar.gz by HOLLI cpan.metacpan.org/authors/id/H/HO/...001.tar.gz 21:36
Thrush Wait... Zoffix, I got it to work with: for 'file.txt'.IO.lines { .flip.say } 21:37
Zoffix What was the broken version?
Thrush The broken version was when I put "lines" in front by accident: for lines 'file.txt'.IO.lines { .flip.say } 21:39
Zoffix ohho 21:40
s: ().Seq, 'lines', \()
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/4fca...ol.pm#L169
geekosaur heh, yes, that'd .Str the list and then try to lines it again --- but .Str would use spaces instead of newlines, so you;d get one long line 21:41
timotimo yeah, because you don't get finishing newlines from .lines
Zoffix m: say Seq ~~ Cool
camelia True
Zoffix TIL
kinda lame
21:42 koto left
Zoffix oh wait no it's good :) 21:42
Zoffix &
21:42 Zoffix left
El_Che yes 21:42
got travis to build the packages and upload them automatically
first auto-release now uploading as we speak 21:43
21:43 Cabanossi left, Ven joined
moritz how does travis handle secrets (for authenticating the upload)? 21:44
21:44 Ven is now known as Guest77569
El_Che hashes 21:44
you can encrypt your api key with the travis cli client
github.com/nxadm/rakudo-pkg/blob/m...is.yml#L35
21:45 Cabanossi joined
El_Che s/you can/you should/ 21:45
Thrush Now: my $fh does auto-close = open('file.txt'); failed on me, but: my $fh will leave {.close} = open('file.txt'); succeeded (or rather, didn't fail). Can I use that idiom ("will leave {.close}") safely even when writing to a file, and I don't even have to close the filehandle?
El_Che you are free to put your key in clear text there :)
it's supported
21:46 cdg joined
El_Che it may be geeky, but auto releases (from a tag) make me happy :) 21:46
s
ivans happy is good
moritz aye, that's quite nice
El_Che as a security guy, having the build in the open is a good thing (TM) 21:47
Thrush Now, for 'file.txt'.IO.lines { .flip.say } works great for reading a file, but what about writing to a file? Is there a similar counterpart?
timotimo m: say join "\n", [1, 2, 3] 21:48
camelia 1
2
3
timotimo you can do this:
Thrush As for: my $fh will leave {.close} = open('file.txt'); it seems to work, but I've never seen the "will leave {.close}" idiom before. Where can I read up on that?
timotimo $path.IO.spurt: join "\n", do for ^10 { $_.Str }
21:50 mempko joined 21:51 hankache left
Thrush I just found something about "will leave" here: docs.perl6.org/routine/encoding#cl...A%3AHandle 21:55
Thanks for all your help, guys. 21:58
When I do: [1..1e6].say; I get: Failed to write bytes to filehandle: Not enough space. I figure it's because I'm writing out (to STDOUT) a large amount of text. But I didn't have this problem in Perl5. Does this have something to do with flush/autoflush? 22:00
timotimo interesting 22:01
let me investigate
oh, haha
it works fine on my end
Thrush timotimo: Are you referring to my: [1..1e6].say; ?
timotimo yep
Thrush I'm using Rakudo on Windows. 22:02
timotimo oh, so an older version?
Thrush Rakudo should be recent. Windows, not so much.
timotimo probably from before we went from async i/o to sync i/o on stdio
you're compiling rakudo yourself?
22:02 mcmillhj joined
Thrush No, I just downloaded the latest version last week. 22:03
(Downloaded and installed.)
timotimo we only have windows builds of rakudo star, the last of which has been a while ago. unless you got the release candidate for this month's
Thrush timotimo: The one I installed was: rakudo-star-2017.07-x86_64 (JIT).msi 22:05
22:07 mcmillhj left
timotimo right, that could be before the i/o switch 22:08
22:12 setty1 left
Thrush Thanks, timotimo. I'll wait for the next release of Rakudo star and see if that fixes it. 22:14
Say, what's the difference between the "say" and "given" keywords? They seem to do the same thing.
Ignore that last question! 22:15
geekosaur o.O
Thrush Say, what's the difference between the "with" and "given" keywords? They seem to do the same thing.
with 5 { .say; (4 + $_).say; }
geekosaur the big difference is with won't run the closure if the value you give it isn't defined
Thrush m: with 5 { .say; (4 + $_).say; }
camelia 5
9
Thrush m: given 5 { .say; (4 + $_).say; }
camelia 5
9
geekosaur whereas given always topicalizes (binds $_ to the value)
Thrush So when is it best to use which one? 22:16
geekosaur m: with Int {.say}
timotimo m: with Str { .say }
camelia ( no output )
timotimo m: given Str { .say }
camelia (Str)
geekosaur when you want to not do some action to an undefined value
timotimo if you want something more like "if", you need "with"
geekosaur i.e. only do it if the value is defined
timotimo if you want something more like my $_ = $blah, you want "given"
Thrush Oh, thank you for the explanation.
22:17 cdg left 22:19 mempko left 22:20 troys is now known as troys_
Thrush The more I learn about Perl 6, the cooler it gets. 22:21
(But, boy, is there a lot to learn!!)
gfldex Thrush: a given block changes the behaviour of some nested statements
see docs.perl6.org/language/control#given
22:22 mcmillhj joined
Thrush When I write: my @a = 'file.txt'.IO.lines; it makes @a a one-element array. (But 'file.txt' has ten lines.) Why is that? 22:24
geekosaur seems to work here 22:25
Thrush Basically, @a is one long line with no newline chars, of all ten lines (concatenated together).
gfldex Thrush: still on Windows? 22:26
geekosaur pyanfar Z$ 6 'my @a = "MHookSwitch.hs".IO.lines; dd @a[0]'
Str @a = "\{-# LANGUAGE DeriveDataTypeable #-}"
Thrush I would expect 'file.txt'.IO.lines to return an array of lines, not a scalar.
Yes, I'm still on Windows and Rakudo-Star.
22:26 troys_ is now known as troys
gfldex in that case define "newline" 22:26
Thrush newline == "\n"
22:27 mcmillhj left
Thrush Can I write out a file using Moar? Is that allowed? 22:27
m: 'file.txt'.IO.spurt: join "\n", do for 1..10 { "Line $_.".Str } 22:28
camelia ( no output )
22:28 Guest77569 left
geekosaur it has limited write access (and it's camelia not 'Moar') 22:28
Thrush m: my @a = 'file.txt'.IO.lines; @a.perl.say
camelia ["Line 1.", "Line 2.", "Line 3.", "Line 4.", "Line 5.", "Line 6.", "Line 7.", "Line 8.", "Line 9.", "Line 10."]
gfldex Rakudo may expect CR+LF on windows
xi- Thrush newlines on windows are \r\n iirc
geekosaur ialthough I think the other bot targets currently don't work 22:29
j: say 'alive'
camelia Error while reading '/home/camelia/p6eval-token': No such file or directory at /home/camelia/rakudo-j-inst/bin/eval-client.pl line 10.
Thrush Okay, apparently I was mistaken. my @a = 'file.txt'.IO.lines; seems to work just fine. I was just mis-interpreting the perl6 interactive interpreter output.
22:30 Ven joined, Ven is now known as Guest44505
Thrush When I type "@a" I get what looks like one long line, but when I type [email@hidden.address] I see all ten elements, each surrounded by double-quotes. 22:30
My bad. My mistake. Culpa mea. 22:31
xi- has anyone used perl6 on jvm here?
I never could get it working
geekosaur it's been broken for a while 22:32
xi- yeah, I tried a few versions
22:36 mcmillhj joined 22:41 mcmillhj left
bartolin actually, I'm trying to keep the jvm backend alive-ish. on commit e4a5bb17c9b1 I was able to build rakudo-jvm and it passed 50985 out of 55162 planned tests from roast. major things that became broken recently include: a) 'make install' is necessary before trying 'make test' or 'make spectest', b) nativecall is broken , c) the EvalServer leaks threads and memory when using Proc::Async (and isn't usable, therefore) 22:42
22:42 Cabanossi left 22:43 mson joined 22:45 Cabanossi joined 22:46 Rawriful joined 22:47 leah2 left 22:48 Guest44505 left 22:55 leah2 joined, cdg joined
Thrush Is there a standard way to get time resolution in milliseconds? (Kind of like in python.) 22:57
jnthn m: say now 22:58
camelia Instant:1509490738.142339
Thrush jnthn: Huh... somehow I missed that. Thanks. 22:59
23:00 cdg left
ivans m: say now - now 23:01
camelia -0.0012876
ivans m: say (BEGIN now) - now
camelia -0.008511
ivans m: say now - BEGIN now
camelia 0.007443
Thrush I'm not quite sure what: say now - BEGIN now; is doing. 23:02
I assume it computed the "now" in the BEGIN expression right away, before the other. Am I right?
23:02 mcmillhj joined
jnthn BEGIN means "at compile time" 23:03
So `BEGIN now` is "the instant this line of code was compiled" 23:04
ivans m: say (BEGIN now) - BEGIN now
camelia -0.0296554
ivans m: say(BEGIN now) - BEGIN now 23:05
camelia WARNINGS for <tmp>:
Instant:1509491150.219156
Useless use of "-" in expression "say(BEGIN now) - BEGIN now" in sink context (line 1)
23:07 mcmillhj left
geekosaur spaces matter 23:08
say(BEGIN now) treats the () as parameter delimiters
knight__ Begin block is in compile time? 23:09
geekosaur yes
ivans geekosaur: thought so, just wanted to check 23:10
some of my perl5 instincts are still right
23:15 mcmillhj joined
timotimo Thrush: when you just type @a in the REPL it'll give you the .gist output, which in the case of an array has all items without quotations and separated only by spaces 23:16
m: say (^10).List.gist; say (^10).List.perl
camelia (0 1 2 3 4 5 6 7 8 9)
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
23:20 mcmillhj left
ivans m: my @a = ^10; say "@a"; say @a; say @a.gist 23:20
camelia @a
[0 1 2 3 4 5 6 7 8 9]
[0 1 2 3 4 5 6 7 8 9]
23:22 raschipi joined
geekosaur I think you wanted @a.Str (equivalently ~@a) 23:22
ivans m: my @a = ^10; say ~@a 23:23
camelia 0 1 2 3 4 5 6 7 8 9
timotimo m: my @a = ^10; say "@a[]"
camelia 0 1 2 3 4 5 6 7 8 9
ivans ahh
thank you 23:24
timotimo things with $ sigil will interpolate by themselves, anything else only interpolates if followed by a postcircumfix of some kind
this makes [email@hidden.address] not try to interpolate @bar or even @bar.com 23:25
however, this bites people when writing html in their strings
because "<em>$foobar</em>" will interpolate $foobar</em> as if you were looking up the key "/em" in $foobar (as if it were a hash)
m: my $foobar; $foobar</em> = 99;
camelia ( no output )
timotimo m: my $foobar; $foobar</em> = 99; say $foobar
camelia {/em => 99}
ivans ha 23:26
I'm not doing html so I'm good
23:27 mcmillhj joined 23:30 mempko joined
knight__ What is the cleanest way to make following: I am using some CPAN6 modules like HTTP:Tinyish for example. And my task is make something like if I cannot find module HTTP:Tinyish I have to make prettier error msg. When I use 'use something' - it is compiling time, but in case of require, I am not sure. Based on perl5doc what I understand require "includes" files from path. 23:30
timotimo perl5doc isn't the right place to look for perl 6 docs :) 23:31
knight__ I know
But I do not understand require
in perl6
raschipi what require doesn't do is to include the nmes in the local scope
names* 23:32
timotimo docs.perl6.org/syntax/require - you looked at this?
23:32 wamba left
raschipi SO you'll have to either use the full name HTTP:Tinyish:somefunc() 23:32
23:32 mcmillhj left
timotimo right. since it works at run time, the compiler can't know what the module will be exporting 23:32
raschipi Or add aliases to the local scope manually.
timotimo you're allowed to put a list of names that you know will be there after the require, yes
HoboWithAShotgun but it is possible to call "import" yourself 23:33
jnthn Another trick is at the top of your script to put BEGIN { require HTML::Tinyish; CATCH { note "Some nice message"; exit 1 } }; use HTML::Tinyish;
timotimo aye, runtime-inside-compiletime has nice benefits 23:34
(except it's totally torture for the implementors)
HoboWithAShotgun well, that's the motto, isnt it?
timotimo it is
23:37 Rawriful left
knight__ Thank you, I will try it. 23:39
I am thinking about diffrences between perl6 require/use vs. python import
uch, I must go, Good night and thank you for help. 23:43
23:43 knight__ left 23:44 knight__ joined
knight__ So, In compile time, every symbols from modules is "includes" to namespace? 23:45
Because I know which symbol exists...
and in case require I can modify dynamically state of object, thus I must check every object in runtime?
And require is second case? 23:46
23:47 mcmillhj joined
knight__ In case 2 In python I can add method to class in runtime, I guess it is same reason in Perl 23:48
For require
(AM I RIGHT)? 23:49
23:50 cpage_ joined 23:51 mcmillhj left, HoboWithAShotgun left
timotimo symbols in packages (what you get from use/require/import) is different from methods in objects 23:52
in perl6
knight__ but, I do not understand of purpose of require. if something is in compile time for example module. I cannot change state of object it is something like interface for me and I can handle it in compile time - because I cannot change it. 23:53
23:53 wander left
knight__ And I think require is In case, when I have some Class/Object/ from dynamic viewpoint 23:53
I can change the symbols in object 23:54
dynamically
and add some methods/variables AKA symbols. 23:55
and interpreter calls/delegate required symbols/message to object
and returns what I want. 23:56
Thrush I'm signing off now. Thank you all for all your help.
knight__ if it exists...
buggable New CPAN upload: Test-Color-1.001002.tar.gz by HOLLI cpan.metacpan.org/authors/id/H/HO/...002.tar.gz
23:56 Thrush left
knight__ timotimo: Am I Right? 23:58