»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
00:01 kurahaupo joined 00:04 cpan-p6 left 00:05 kurahaupo left, kurahaupo joined 00:08 ufobat_ left, kurahaupo_ joined 00:09 kurahaupo_ left, kurahaupo_ joined, kurahaupo left 00:11 ufobat joined 00:13 notagoodidea left 00:16 rindolf left 00:28 silug joined 00:32 zacts joined, zacts left, zacts joined 00:35 kurahaupo_ left 00:36 kurahaupo joined 00:44 zacts left 00:46 zacts joined 00:49 kurahaupo_ joined 00:53 kurahaupo left 00:57 cfa left 01:01 hythm_ left 01:18 mowcat joined 01:23 dct_ joined 01:29 markoong left 01:36 dct_ left 01:45 zacts left 01:55 matiaslina joined 02:10 molaf left 02:16 jme` joined 02:18 reach_satori joined 02:23 molaf joined 02:36 matiaslina left 02:49 holyghost joined 02:55 kurahaupo joined, kurahaupo left 02:56 kurahaupo joined 02:57 kurahaupo_ left 02:58 leont left 03:09 kurahaupo left 03:10 kurahaupo joined, irced joined
irced so i'm reading a book on perl and it says to try 0.1 + 0.2 in my favorite language 03:12
is there something in my favorite language i should be seeing besides 0.3?
put 0.1 + 0.2
evalable6 0.3
timotimo irced: subtract 0.3 from it and see what it gives 03:13
from the result, that is
irced ok!
irced smiles.
MasterDuke irced: in most languages you won't get exactly 0.3 because of the limitations of floating point representation
irced std::cout << std::fixed << std::setprecision(50) << c << "\n"; in c++ and printf("%.50f\n", c); gave 0.00000000000000005551115123125782702118158340454102 03:18
so, how to i get the same precision from my perl6 code ? 03:19
buEuler, buEuler 03:20
MasterDuke irced: well, in perl6 it is exactly 0.3. do you want to print more zeroes after the 3? 03:21
irced yep 03:22
irced folds his arms.
MasterDuke m: printf("%.50f\n", 0.3) 03:23
camelia 0.30000000000000000000000000000000000000000000000000
irced claps.
camelia does c, apparently.
irced holds camelia in higher esteem.
irced thanks MasterDuke heartily.
MasterDuke np, but it's more like perl6 does printf pretty similarly to c 03:24
irced m: my $a=0.1; my $b=0.2; my $c=a+b; printf("%.50f\n", c);
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routines:
a used at line 1
b used at line 1
c used at line 1
irced indubitably!
03:24 kurahaupo left
irced scratches his head. 03:24
03:25 kurahaupo joined
irced m: my $a=0.1; 03:25
camelia ( no output )
MasterDuke m: my $a=0.1; my $b=0.2; my $c=$a+$b; printf("%.50f\n", $c);
camelia 0.30000000000000000000000000000000000000000000000000
irced doh!
thanks.
that's $$$
irced converses with himself appreciably. 03:26
03:26 cpan-p6_ left 03:27 cpan-p6 joined
irced :m put Inf 03:32
hah, stumped you camelia!
camelia?
irced looks into the blank stare of camelia's eyes. 03:33
:m put 3.14*10**30.^name 03:35
03:35 kurahaupo left
irced :m put 3.14.^name 03:35
:m put 3.14.^name;
:m say 3.14.^name;
03:35 kurahaupo joined
irced oh yeah, she's gone. 03:35
MasterDuke irced: m:, not :m
irced m: put Inf 03:36
camelia Inf
irced whoa, time for break
irced takes a break.
MasterDuke m: say "ab" ~~ /a<at(1)>/; say "ab" ~~ /a<at(2)>/ 03:40
camelia 「a」
at => 「」
Nil
MasterDuke anyone know what that ^^^ is called? 03:41
i.e., the <at(1)> syntax/regex capability 03:42
03:43 Khisanth left 03:45 kurahaupo left, kurahaupo joined
b2gills m:put 0.1e0 + 0.2e0 03:49
evalable6 0.30000000000000004
b2gills m: put (0.1 + 0.2).nude.join('/') 03:50
camelia 3/10
03:56 kurahaupo left 03:57 kurahaupo joined 04:07 kurahaupo left, kurahaupo joined 04:15 aborazmeh left 04:18 kurahaupo left 04:19 kurahaupo joined 04:30 kurahaupo left, kurahaupo joined 04:31 atweiden-air joined 04:33 tech joined 04:37 tech left 04:40 kurahaupo left, kurahaupo joined 04:52 kurahaupo left 04:53 kurahaupo joined
irced gasps. 05:02
m: put 0.1e0 + 0.2e0
camelia 0.30000000000000004
irced m: put 0.3e0 -0.2e0
camelia 0.09999999999999998
irced m: put 0.3e0
camelia 0.3
irced sacre blue!
irced sacre bleu! 05:03
05:03 kurahaupo left, kurahaupo joined
irced sacré bleu! 05:03
irced pats b2gills forcefully on the back over a steep and perilous precipice. 05:04
irced watches b2gills plummet to a stalactitic and bloody end. 05:06
05:13 kurahaupo left, kurahaupo joined 05:26 kurahaupo left, kurahaupo joined 05:27 atweiden-air left 05:36 kurahaupo left, kurahaupo joined 05:43 nelsonhb joined 05:51 kurahaupo left, kurahaupo joined 05:54 sno left 06:03 irced left 06:06 kurahaupo left 06:07 kurahaupo joined 06:15 jmerelo joined 06:17 kurahaupo left, kurahaupo joined 06:20 sno joined 06:26 sauvin joined, nelsonhb left 06:27 kurahaupo left 06:28 kurahaupo joined 06:29 mowcat left 06:33 molaf left
sno In case someone has an answer; stackoverflow.com/questions/545289...ve-integer 06:38
06:42 kurahaupo left, kurahaupo joined
Geth doc: 81de538149 | (JJ Merelo)++ | 2 files
Restructure and reflow refs #2483
06:43
jmerelo sno: the problem is the width of the native integer, not the natural integer 06:45
sno: Ints have arbitrary precision
sno: my money is on array subscripts using nativeints. 06:52
sno jmerelo: since there are results larger than 2^64 (which is finally the largest size of native ints on that platform), there is more involved than native ints ... 06:54
jmerelo: please treat me as someone who has no clue about Perl6 opportunities and just copied the code from Rosettacode and playing with it
06:55 domidumont joined
jmerelo sno: I've answered already. The "native int" error you get is because array subscripts use native ints. You might have to solve the problem by creating your own array, or trying to avoid using array subscripts. Cached function calls might be a good option 06:56
06:57 kurahaupo left, kurahaupo joined
sno jmerelo: I'm sorry - I don't understand 06:58
jmerelo sno: you are using @[m][n] as state. [] call AT-POS in Array, but use "int" (native int) as argument. When you turn the Int m into int in @[][], you get the error. 06:59
sno: when I say "you", I mean the program, of course. I'm just trying to explain the error in the program. 07:01
sno jmerelo: I copied code from Rosettacode and played with it ;)
Any fineness in that code isn't from me ... and when I remove line 3 I get an error which seems not related to @[m][n]
jmerelo sno: I know, I'm using "you" generically. I'm just trying to explain the error. When you remove line you lose the cache, so the error is different. In that case it's likely that you hit the limit of the "unlimited" precision 07:02
07:02 domidumont left
jmerelo sno: Again, my money is on some of the operations having a precision that's not so unlimited, maybe ** 07:02
sno jmerelo: that's a more helpful answer - but since that's an example where Perl6 is trying to show it's abilities to the world, I'd like to get a "I'm sure" answer and maybe a task for fixing that ;) 07:03
jmerelo sno: checking the source now... 07:04
sno: Int ** Int yields Real. The code is coercing it Back to Int. 07:07
jmerelo finds movie titles in what I have said: Back to Int. 07:08
sno jmerelo: so the (2 ** n - 1) causes the issue
07:09 cpan-p6_ joined
jmerelo sno: right. it hits this error: github.com/rakudo/rakudo/blob/mast...#L391-L401 07:10
07:10 kurahaupo left
jmerelo sno: the result is too big, it becomes "Num", it raises the error. 07:10
07:11 kurahaupo joined, cpan-p6 left
jmerelo sno: I'd have to go into NQP to see exactly when that happens, and that's somewhere I wouldn't want to go... 07:11
sno jmerelo: maybe someone else could do ;) 07:12
At least, that's a very good answer what wents wrong ...
07:16 w17t joined 07:18 ravenousmoose joined
jmerelo sno: I don't know if it's worth the while, anyway. It's quite clear that Int has any precision as long as it's not involved in some operations like ** 07:20
sno jmerelo: I didn't expect the type change -> Real when doing Int ** Int 07:25
07:25 kurahaupo left 07:26 kurahaupo joined
jmerelo sno: What I don't understand is why it throws when it's actually a Num that's returned. It should simply return it as Real. 07:27
.tell cfa I run the profiler, it's not very helpful. It's allocating lots of array, and using 20% of the time garbage-collection. But arrays have lexical scope, so I don't get what's the matter. 07:28
yoleaux jmerelo: I'll pass your message to cfa.
07:28 domidumont joined
sno how do I create a n list of the same element? In perl5 it was (s) x $n 07:30
docs.perl6.org/type/Array doesn't say anything about that, neither perl6intro.com/#_arrays 07:31
jmerelo sno almost the same 07:32
(s) xx $n
m: say "foo" xx 33
camelia (foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo)
sno thanks 07:36
07:36 kurahaupo left 07:37 kurahaupo joined 07:48 kurahaupo left, kurahaupo joined
Geth doc: 13ca3ad749 | cfa++ | doc/Language/create-cli.pod6
=item2 → =head2
07:50
synopsebot Link: doc.perl6.org/language/create-cli
07:51 crella joined
crella Hi, I am a newbie from East Asia 07:52
p6 -e "say 3;" -> 3\n
My English is not good. 07:53
moritz hi crella, welcome to #perl6 07:56
m: say 3
camelia 3
crella rakudo start 2018.10 implementing perl 6.c 07:59
07:59 kurahaupo left 08:00 kurahaupo joined
crella Will perl6 next version improve much performance ? 08:01
08:01 crella left 08:02 crella joined
moritz crella: there's a steady improvement in performance over most releases 08:02
crella I used debian 8 for some time during my university life, but my current job needs much work in MSOffice/WPS. I hate the complicated grammar and NO LINE FEED in excel functions, and free WPS doesn't provide VBA, so I am working to use perl6 to help me deal with the reports. 08:05
=IF(A2=0,0,IF(A2<=10,10*K2,IF(A2<=100,A2*K2,IF(A2<=300,100*K2+(A2-100)*L2,IF(A2<=500,300*L2+(A2-300)*M2,IF(A2<=800,500*M2+(A2-500)*N2,IF(A2>800,800*N2+(A2-800)*O2))))))) 08:06
I hate formulas like this in excel:'( 08:07
08:08 andrzejku_ joined
ravenousmoose given the amount of parens in that formula, you might want to look into Lisp 08:10
you'd feel right at home :')
08:11 kurahaupo left, andrzejku left, andrzejku_ is now known as andrzejku, kurahaupo joined
crella With perl6, I don't always need to declare the type of a variable, this is very convenient for me and stops me for switching to VB.net and lua, although sometimes I always find a variable printing (Any) because it isn't used or assigned. 08:12
08:13 reach_satori left 08:14 reach_satori joined
crella And using perl6, I am free from the vlookup in Excel which takes up much time, because without VBA, some vlookup results store in cells, and one results needs 5 vlookups:'( . 08:14
I want to ask how can I stop the script when a variable hasn't been assigned a value? 08:16
One example file: 08:18
** start of a \t divided txt **
a 1
b 3
Sorry, Wechat can withdraw the message and I am not used to Pidgin :-( 08:19
ravenousmoose If I understand your question correctly, I think you might be able to do what you want by checking if the variable is defined 08:20
jmerelo hi, crella!
crella: you can use defined
ravenousmoose ^
jmerelo m: my $x; exit if ! defined $x; say $x;
camelia ( no output )
jmerelo m: my $x=3; exit if ! defined $x; say $x;
camelia 3
jmerelo m: my $x=3; exit if ! $x.defined; say $x; 08:21
camelia 3
jmerelo m: my $x; exit if ! $x.defined; say $x;
camelia ( no output )
jmerelo m: my $x; exit if $x.!defined; say $x;
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed postfix call
at <tmp>:1
------> 3my $x; exit if $x.7⏏5!defined; say $x;
crella I mean that if a variable is not assigned, that the program will quit with a relative message like 'use strict; use warnings;' in perl 5
jmerelo m: my $x; exit if $x!defined; say $x;
camelia 5===SORRY!5=== Error while compiling <tmp>
Private method call to defined must be fully qualified with the package containing the method
at <tmp>:1
------> 3my $x; exit if $x!defined7⏏5; say $x;
expecting any of:
method…
crella that needn't I check all the variable by hand 08:22
jmerelo crella: you need to define the scope or type of all variables in perl6 08:23
m: say $x
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$x' is not declared
at <tmp>:1
------> 3say 7⏏5$x
08:23 kurahaupo left 08:24 kurahaupo joined
jmerelo strict ahd warnings are there by default. 08:24
crella Oh, oh
And I want to ask another question 08:26
jmerelo crella: sure 08:27
crella ** start of a tab divided txt **
a3
b4
c5
b6
a3
c9
** end of the txt **
I need to add up all the numbers with A and all the numbers with B separately, the txt can be up to 20MB large with a million lines, how can I write the script to finish the work with less time? 08:29
I currently use "for $rf.line -> $curline" as the main cycle 08:30
jmerelo m: my @list = ( <a 3>, <b 2>, <a 3>}; say sum @list.grep( *[0] eq 'a' ).map( *[1] ) 08:32
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
------> 3my @list = ( <a 3>, <b 2>, <a 3>7⏏5}; say sum @list.gr…
jmerelo m: my @list = ( <a 3>, <b 2>, <a 3>}; say sum @list.grep( *.[0] eq 'a' ).map( *.[1] )
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
------> 3my @list = ( <a 3>, <b 2>, <a 3>7⏏5}; say sum @list.gr…
jmerelo m: my @list = ( <a 3>, <b 2>, <a 3>}; say @list.grep( *.[0] eq 'a' )
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
------> 3my @list = ( <a 3>, <b 2>, <a 3>7⏏5}; say @list.grep(…
jmerelo m: my @list = ( <a 3>, <b 2>, <a 3>); say @list.grep( *.[0] eq 'a' )
camelia ((a 3) (a 3))
jmerelo m: my @list = ( <a 3>, <b 2>, <a 3>); say @list.grep( *.[0] eq 'a' ).map( *.[1] )
crella My laptop is 4G mem and i3 4005u processor, and if I can't make use of the two physical cpu cores, it takes really much time. On my office PC with G4650 Gold, it still takes some time, so I wonder the performance improvement
camelia (3 3)
jmerelo m: my @list = ( <a 3>, <b 2>, <a 3>); say sum @list.grep( *.[0] eq 'a' ).map( *.[1] )
camelia 6
jmerelo crella ^^^ First you select those whose first column is equal to a, then you select the second element of that. You can use hyper also to speed it up. 08:33
m: my @list = ( <a 3>, <b 2>, <a 3>); say sum @list.hyper.grep( *.[0] eq 'a' ).map( *.[1] )
camelia 6
jmerelo ^^^ crella Your mileage might vary, though. 08:34
crella My example text is far too easy comparing with my real job.:-[ Can your device support East Asian fonts?
08:34 dakkar joined
jmerelo crella: it does. No problem 08:35
08:35 ufobat_ joined
crella I paste the example source to pastebin, wait a moment 08:36
08:37 ufobat__ joined, kurahaupo left, crella left, crella joined 08:38 kurahaupo joined
crella Oh my annotation is all in Chinese, and you won't be able to understand. 08:38
08:39 ufobat left
jmerelo crella: I can use google translate. But there should be no problem if you use anything instead of "a". Perl6 does Unicode all the way. 08:39
crella Few workmates support me to use scripts rather than WPS to finish the job, although WPS sometimes break down because the data is too large 08:40
08:40 ufobat_ left
jmerelo crella: no idea what's WPS. Perl6 shouldn't be a problem... Just give it a try 08:42
08:43 ufobat_ joined
ravenousmoose jmerelo, WPS is a free Office suite 08:43
jmerelo ravenousmoose: ah, OK. Didn't know. 08:44
ravenousmoose: thanks.
crella Usually there're 3000 lines in the source file, Row A with 200 names that are not repeated, Row B as numbers, Row C as text, ... , And among the 200 names, there are 40 A-type names and 160 B-type names. One B-type name is a child to a special A-type name. 08:45
jmerelo crella: if by child you mean it's a combination of characters, perl 6 can do that too. 08:46
crella: as I say, shouldn't be a problem.
08:46 ufobat__ left
crella If I use the sum @lists.grep method, can it still be as fast as the cycle 'for $readfile.lines -> $curline'? 08:46
08:48 crella left, crella joined
jmerelo crella: grep should be a bit faster. Hyper would use multithreading if available, should make it 4x faster. 08:48
crella Actually I am a statistical clerk in a logistics company
moritz if you are reading from a file, that will usually be the slowest part 08:49
08:49 kurahaupo left 08:50 kurahaupo joined, w17t left
crella Now I have a try 08:50
jmerelo crella: good luck. 08:53
08:55 crella1 joined, crella1 left, crella1 joined
crella1 If i am reading from a tabbed-divided txt file ? I once slurp all the lines and split '\t' and stored them in an array and that use too much memory, as my txt contains Chinese text 08:56
08:56 rindolf joined 08:57 crella left
crella1 The annoying CMCC Net 08:57
08:58 scimon joined 08:59 nelsonhb joined
crella1 I think it's not good because a tabbed-divided file isn't a list or array 09:01
09:01 kurahaupo left
crella1 Reading from a txt really consumes time. 09:01
09:02 kurahaupo joined
crella1 If only I have 16G memory! 09:02
09:03 volkov joined
crella1 Is there a method to read 2 lines in a time and use subs to work with the 2 lines in a time while keeping the data summary is accurate, like the excel multiprocessing summarizing, with low memory usage? 09:07
Comparing to excel, scripts use much more memory when reading all the text file 09:08
jmerelo crella1: reading from a file is "lazy". It will only read what is being processed. 09:09
09:10 dct_ joined, kurahaupo left 09:11 kurahaupo joined 09:12 w17t joined
crella1 Will perl6 reading from sqlite3 much faster? How fast? Because small data needn't to be converted to sqlite3, while large data needs 09:14
jmerelo crella1: there's a SqLite driver that's quite good. Also pgsql and mysql.
crella1: the last ones are concurrent, so that might be quite faster. More memory consuming, too. 09:15
09:15 crella1 left 09:16 crella1 joined
crella1 Oh the pidgin support of IRC is outdated I think ,what clients do you use? 09:16
eseyman crella1: irssi 09:18
crella1 In China, when I am studying in a primary school , the computer lesson teaches PC Logo (cracked version) in Grade 5 and VB6 in Grade 6, Flash and Photoshop in junior high school and senior high school. The national computer rank exam checks C lang with codeblocks or Java with Netbeans or MSAccess or MSOffice skills, and I failed the Java exam during university. 09:20
kudzo crella1, xchat 09:21
crella1 Now python exam is also provided/
After my failure in Java exams, I completely give up to change my career to a programmer. It feels that you can understand all things you read , but you can't use them to work out a result. 09:23
09:26 nelsonhb left
crella1 And I find perl6 printing to cygwin sometimes miss some string. Windows cmd doesn't support many functions. I currently using powershell, and powershell launches perl6 use much a lot of time than cmd. 09:32
jmerelo crella1: weechat 09:34
09:34 w17t left
jmerelo crella1: that might be a console problem, not a perl6 problem... Try and save to file. 09:34
09:34 w17t joined
crella1 All thanks to the f**king windows 10 09:35
scimon I had all kinds of horrible times using powershell on Windows 10. 09:39
jmerelo crella1: amazing (except for the Flash thing, of course) Java is not the best thing to learn, probably... 09:40
09:42 crella1 left, crella joined 09:44 volkov left
scimon If it helps I drop out from Uni, spent a few years working retail and for a bank before learning Perl and actually getting a career in it. My first coding job I was 28. 09:47
09:50 kurahaupo left 09:56 reach_satori left 09:58 yqt joined
crella After the national exam added python3, I think many classmates will hate python, because most people recommend to use python in place of Java because of python's simplicity, while python isn't always easy. Tabs can easily get classmates crazy, who can't even install an Office 2010 with KMS activated, or install a CAD 2010 09:58
jmerelo crella: well, it's simple. Probably not easy, but simple. 10:00
10:08 crella left 10:20 crella joined
crella And if there's any GUI support for perl6 right now? I doesn't know how to use the perl6 modules searching. 10:21
10:22 aborazmeh joined, aborazmeh left, aborazmeh joined
crella Now I use PECMD.exe extracted from common PE images for Windows, and PECMD supports message box and background executing files. 10:22
ravenousmoose Also dropped out of uni for CS, but luckily landed a programming job straight away 10:25
although it *is* mainly in Java, so that may or may not be any better than working retail for now
crella And between the two methods below, which is faster ? Method A: for $readfile.lines -> $curline { dosomejob();} Method B: my $lineid = 0; my $linestr = ''; while $lineid <= $readfile.lines.elems { $linestr = $readfile.lines[$lineid]; dosomejob(); $lineid++;} 10:27
And how can I reduce memory usage by setting some variables to null or ''? 10:28
10:28 Kaiepi left
jnthn crella: Method A will read the file line by line and discard each after it's been read (though of course if you stash it somewhere it lives on). Method B will retain every string in memory, which probably means more GC work. It's probably also more work anyway; the lines iterator is well optimized. 10:30
crella Oh thanks 10:34
10:34 lizmat joined, crella left 10:36 Kaiepi joined 10:37 cpan-p6_ left, cpan-p6 joined 10:39 vrurg left 10:43 evalable6 left, statisfiable6 left, reportable6 left, shareable6 left, squashable6 left, quotable6 left, greppable6 left, reportable6 joined, ChanServ sets mode: +v reportable6 10:44 quotable6 joined, ChanServ sets mode: +v quotable6, greppable6 joined 10:45 shareable6 joined, domidumont left 10:46 evalable6 joined, ChanServ sets mode: +v evalable6, squashable6 joined, ChanServ sets mode: +v squashable6 10:47 statisfiable6 joined, ChanServ sets mode: +v statisfiable6 10:50 crella_p joined 10:51 zakharyas joined
crella_p right now can i write a gui program with perl6? i switched to android irc software and miss the chat record before 10:53
perl 5's win32gui is pretty good 10:55
jmerelo crella_p: there's a GTK module. 10:56
crella_p: github.com/perl6/gtk-simple
crella_p ok
jmerelo crella_p: not sure about Windows, though.
10:58 bisectable6 left 11:00 bisectable6 joined, ChanServ sets mode: +v bisectable6 11:01 yqt left 11:02 yqt joined 11:03 Kaypie joined 11:05 zakharyas left, aeruder_ left
scimon crella_p: gtk-simple is pretty easy to use. I managed to learn it an knock up a GUI with it in a few days for the Advent calendar last year. (As every other idea I had someone else did first). 11:06
11:06 Kaiepi left, kent\n left, kent\n joined 11:09 aeruder joined
crella_p I remembered that during some time in my university, I use debian8 or opensuse, thus I have to give up revising my vb6 easy skills in high scholl. That time I hadn't heard of nodejs, and I kept thinking I am doing usefulness thing in a browser by using javascript. And I once copyed the html to android and opened it in android browser to test the js running result. Bored of javascript in a browser, I heard that all linux dists provides perl, not p… 11:11
…ython, originally, so I picked perl5 to learn.
Even in my school's CS major, HCI labs, few people except the leaders had heard of perl, so that time when I asked why my perl scripts ran so slow, I got few answers. That time python and ruby was vert popular in China, and manh articles about perl was outdated and not detailed. 11:14
Now some UGC web blogs have provided useful contents created by individual bloggers, such as Jianshu. I read some translated tutorials from Jianshu. It is easy to recognize some words and some lines in foreign language, but not easy for a whole article. 11:21
In China's quora-like platform, Zhihu, there're still people criticising perl6 as hard to read and recode, by giving some special complicated examples (grammar candies). 11:28
11:28 wi15ht joined
AlexDaniel crella_p: that's interesting 11:29
11:30 w17t left, wi15ht left 11:31 w17t joined
crella_p But when introducing python, they always provide python examples that show the shortest scripts and clapped that python is great! 11:32
11:33 w17t left, w17t joined
crella_p I can't use python, or I will try to write perl6 scripts with same functions, and most important, provide the snaps that I just wrote it in notepad2mod. (always) 11:34
If I combine my work scripts in a files and add a input line as a shell, it's up to 1000 lines. 11:35
I have learned and practised to keep scripts and database not in a file, which benefits a lot. And later different functions need different database, so I divided the 1000-line script into a few smaller independent pieces. 11:38
Ulti crella_p: github.com/Garland-g/perl6-libui/wiki if you want to be super edgy 11:42
my personal preference is just make a webapp even if its for local UI
11:42 crella_p2 joined 11:43 leont joined
crella_p2 Miniblink, which is free to use with fewer functions than its commercial version, is a simplified CEF that supports nodejs. 11:44
11:45 RubioTerra joined, crella_p left
crella_p2 It provides C API, and I am an idiot to C lang, or I will choose it to write GUI. 11:45
timotimo chrome embedded framework? 11:46
crella_p2 Yes, a simplified one.
timotimo ah
there is an electron module for perl6! i have not tried it
github.com/azawawi/perl6-electron 11:47
11:48 leont left 11:49 domidumont joined, Xliff joined, domidumont left
Xliff m: "ns.field" ~~ / [ <:letter>+ ] %% '.' / 11:50
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing quantifier on the left argument of %%
at <tmp>:1
------> 3"ns.field" ~~ / [ <:letter>+ ] %%7⏏5 '.' /
Xliff m: "ns.field" ~~ / [ <:letter>+ ]+ %% '.' /
camelia ( no output )
Xliff m: "ns.field" ~~ / [ <:letter>+ ]+ %% '.' /.say
camelia / [ <:letter>+ ]+ %% '.' /
Xliff m: ("ns.field" ~~ / [ <:letter>+ ]+ %% '.' /).gist.say
camelia 「ns.field」
crella_p2 Haha, chrome is getting more and more crazy when consuming larger and larger memory.
Xliff m: ("ns.field" ~~ / [ <:letter>+ ] ** 1..3 %% '.' /).gist.say
camelia 「ns.field」
Xliff m: ("ns.field." ~~ / [ <:letter>+ ] ** 1..3 %% '.' /).gist.say
camelia 「ns.field.」
Xliff m: ("ns.table.field." ~~ / [ <:letter>+ ] ** 1..3 %% '.' /).gist.say 11:51
camelia 「ns.table.field.」
Xliff m: ("ns.table.field.bad" ~~ / [ <:letter>+ ] ** 1..3 %% '.' /).gist.say
camelia 「ns.table.field.」
Xliff m: ("ns.table.field.bad" ~~ / [ <:letter>+ ] ** 1..3 %% '.' <!before '.'> /).gist.say
camelia 「ns.table.field.」
Xliff m: ("ns.table.field." ~~ / [ <:letter>+ ] ** 1..3 %% '.' <!before '.'> /).gist.say
camelia 「ns.table.field.」
11:53 kensanata joined, aborazmeh left
crella_p2 While chrome-based browsers optimise the memory usage quite good. I use chrome-based browser English version, because the Chinese version usually annoys users in many ways. 11:53
In China now is spring festival so I have some free time to chat╮(‵▽′)╭ 11:56
jmerelo crella_p2: you celebrate spring festival in winter? Still 45 days to get to spring here... 12:00
crella_p2 agricultural calendar, common in coutries like Japan, Korea, Vietnam ... 12:02
Xliff \o jmerelo 12:04
".field" ~~ /^ [ <!after '.'> [ <:letter>+ ] ** 1..2 %% '.' ] / <- Is there a way to get perl6 to throw an error in this situation?
12:09 crella_p2 left 12:10 crella_p joined
Xliff m: ("..field" ~~/ <!after '.'> [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say 12:13
camelia 「ield」
Xliff m: ("..field" ~~/ [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say 12:14
camelia 「field」
Xliff m: ("..field" ~~/ '.'{die ":P"} [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say
camelia :P
in block <unit> at <tmp> line 1
Xliff m: (".field" ~~/ '.'{die ":P"} [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say
camelia :P
in block <unit> at <tmp> line 1
Xliff m: ("field" ~~/ '.'{die ":P"} [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say
camelia Nil
Xliff m: ("ns.field" ~~/ '.'{die ":P"} [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say 12:15
camelia :P
in block <unit> at <tmp> line 1
Xliff m: ("ns.field" ~~/ ^ '.'{die ":P"} [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say
camelia Nil
Xliff m: ("ns.field" ~~/ ^ '.'{die ":P"}? [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say
camelia 5===SORRY!5=== Error while compiling <tmp>
Can only quantify a construct that produces a match
at <tmp>:1
------> 3("ns.field" ~~/ ^ '.'{die ":P"}?7⏏5 [ [ <:letter>+ '.' ]? <:letter>+ '.' ]?
Xliff m: ("ns.field" ~~/ ^ '.'?{die ":P"} [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say
camelia :P
in block <unit> at <tmp> line 1
Xliff m: ("ns.field" ~~/ ^ ['.'{die ":P"}]? [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say
camelia 「ns.field」
Xliff m: (".ns.field" ~~/ ^ ['.'{die ":P"}]? [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say 12:16
camelia :P
in block <unit> at <tmp> line 1
Xliff m: (".ns.field" ~~/ ^ ['.'{.gist.say}]? [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say 12:21
camelia .ns.field
「.ns.field」
Xliff m: (".ns.field" ~~/ ^ ['.'{$/.gist.say}]? [ [ <:letter>+ '.' ]? <:letter>+ '.' ]? <:letter>+ /).gist.say
camelia 「.」
「.ns.field」
Xliff m: ("ns.table.field." ~~ / [ <:letter>+ ] ** 1..3 %% '.' { .gist.say} <!before '.'> /).gist.say 12:23
camelia ns.table.field.
「ns.table.field.」
Xliff m: ("/ns.table.field." ~~ / [ <:letter>+ ] ** 1..3 %% '.' { .gist.say} <!before '.'> /).gist.say
camelia /ns.table.field.
「ns.table.field.」
Xliff m: ("..ns.table.field." ~~ / [ <:letter>+ ] ** 1..3 %% '.' { .gist.say} <!before '.'> /).gist.say
camelia ..ns.table.field.
「ns.table.field.」
Xliff m: ("..ns.table.field." ~~ / [ <:letter>+ ] ** 1..3 %% '.' { $/ = Nil if .starts-with('.') or .ends-with('.') } <!before '.'> /).gist.say 12:24
camelia 「ns.table.field.」
Xliff m: ("..ns.table.field." ~~ / [ <:letter>+ ] ** 1..3 %% '.' { Nil if .starts-with('.') or .ends-with('.') } <!before '.'> /).gist.say
camelia 「ns.table.field.」
Xliff m: ("..ns.table.field." ~~ / [ <:letter>+ ] ** 1..3 %% '.' { .fail if .starts-with('.') or .ends-with('.') } <!before '.'> /).gist.say 12:25
camelia No such method 'fail' for invocant of type 'Str'. Did you mean any of these?
all
flip
tail

in block <unit> at <tmp> line 1
Xliff m: ("..ns.table.field." ~~ / [ <:letter>+ ] ** 1..3 %% '.' { $/.fail if .starts-with('.') or .ends-with('.') } <!before '.'> /).gist.say
camelia No such method 'fail' for invocant of type 'Match'. Did you mean any of these?
all
flip
tail

in block <unit> at <tmp> line 1
12:25 mowcat joined
Xliff m: ("..ns.table.field." ~~ / [ <:letter>+ ] ** 1..3 %% '.' { .FAILGOAL if .starts-with('.') or .ends-with('.') } <!before '.'> /).gist.say 12:26
camelia No such method 'FAILGOAL' for invocant of type 'Str'
in block <unit> at <tmp> line 1
12:27
12:38 nelsonhb joined 12:41 crella_p left, Xliff left 12:48 giraffe_ left 12:49 giraffe joined, giraffe is now known as Guest22118 12:56 yqt left 13:00 domidumont joined 13:01 mscha joined 13:03 aborazmeh joined, aborazmeh left, aborazmeh joined 13:05 dogbert2_ joined 13:09 mscha left 13:31 mowcat left 13:49 w17t left, w17t joined 13:50 w17t left, nelsonhb left 13:58 aborazmeh left 13:59 cpan-p6_ joined 14:02 cpan-p6 left 14:10 ccc_ joined 14:11 lizmat left 14:20 Kaypie left 14:22 Kaiepi joined 14:23 vrurg joined
ccc_ p6: sub nlst(UInt :$pos, :@lstoflst) {say @lstoflst[$pos]}; say nlst(:n(0), :@lstoflst([[0,2,3],[1,4]])); say nlst(:n(0), :@lstoflst([[0,2,3]])) 14:25
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '@lstoflst' is not declared
at <tmp>:1
------> 3{say @lstoflst[$pos]}; say nlst(:n(0), :7⏏5@lstoflst([[0,2,3],[1,4]])); say nlst(:n
ccc_ p6: sub nlst(UInt :$pos, :@lstoflst) {say @lstoflst[$pos]}; say nlst(:n(0), :lstoflst([[0,2,3],[1,4]])); say nlst(:n(0), :lstoflst([[0,2,3]])) 14:26
camelia Unexpected named argument 'n' passed
in sub nlst at <tmp> line 1
in block <unit> at <tmp> line 1
ccc_ p6: sub nlst(UInt :$pos, :@lstoflst) {say @lstoflst[$pos]}; say nlst(:pos(0), :lstoflst([[0,2,3],[1,4]])); say nlst(:pos(0), :lstoflst([[0,2,3]])) 14:27
camelia [0 2 3]
True
0
True
ccc_ p6: sub nlst(UInt :$pos, :@lstoflst) {say @lstoflst[$pos]}; nlst(:pos(0), :lstoflst([[0,2,3],[1,4]])); nlst(:pos(0), :lstoflst([[0,2,3]]))
camelia [0 2 3]
0
ccc_ Why isn't the output «[0 2 3]␤[0 2 3]␤» ? 14:29
When there's a single item in the list it seems to throw away the outer list 14:30
jnthn Single argument rule
ccc_ p6: hmm?
camelia 5===SORRY!5=== Error while compiling <tmp>
Bogus postfix
at <tmp>:1
------> 3hmm7⏏5?
expecting any of:
infix
infix stopper
statement end
statement modifier
statement modifier loop
ccc_ hmm? 14:31
jnthn [one-iterable-thing-here] will always iterate the thing to provide the elments for the array
That's why you can write [1..10] to get an Array of 10 elements, not one element.
ccc_ so how would I write nlst to do the right thing 14:32
jnthn Needs to be `[[0,2,3],]` instead, so that the single argument is a List
ccc_ how does the caller know to do that
jnthn I don't think nlst is the problem, just the input that you're passing
ccc_ p6: say [[0,2,3]]
camelia [0 2 3]
jnthn It's just a general Perl 6 array behavior
*array literal 14:33
ccc_ so I want a list of lists to stay a list of lists even if there's only 1 item how do I do that
jnthn Add the trailing , like I showed
ccc_ how's the done dynamicly? 14:34
this is for a method
timotimo m: my @foo; @foo[0] = [1, 2, 3]; say @foo.perl
camelia [[1, 2, 3],]
ccc_ the caller has to check if there's one element or I have to check if there's one element is that what you're saying?
what does the signature have to be so that a list (or array) stays a list or array even if there's only 1 item 14:36
jnthn I'd expect the caller to correctly form an array of arrays if that's what they meant to pass. [[1,2,3] is simply not an array of array
Everf
*Ever
oops, I missed the closing ]
And that happens at the time the array is being formed, before the call takes place. 14:37
MasterDuke ccc_: docs.perl6.org/type/Signature#Type...parameters might help
jnthn Also docs.perl6.org/syntax/Single%20Argument%20Rule 14:38
ccc_ so my problem is simply syntax of a literal array = nlst would work with with an array of arrays of 1 item that was computed? 14:39
jnthn Yes
14:41 andrzejku left
MasterDuke [] don't create arrays/lists, commas do. 14:42
ccc_ p6:sub nlst(UInt :$p, :@lst) {say @lst[$p]}; my @arg = [[0,2,3],[1,4]]; nlst(:n(0), @arg); pop(@arg); nlst(:n(0), $arg)
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/6cLLj22r29
Variabl…
ccc_, Full output: gist.github.com/e497671c1ebe4be3cb...d24f898e5b
ccc_ p6:sub nlst(UInt :$p, :@lst) {say @lst[$p]}; my @arg = [[0,2,3],[1,4]]; nlst(:n(0), :lst(@arg)); pop(@arg); nlst(:n(0), :lst(@arg)) 14:43
evalable6 (exit code 1) Unexpected named argument 'n' passed
in sub nlst at /tmp/dKs0pyI7De line 1
in block <unit> at /tmp/dKs0pyI7De line 1
14:43 Xliff joined
Xliff \o 14:44
ccc_ p6:sub nlst(UInt :$p, :@lst) {say @lst[$p]}; my @arg = [[0,2,3],[1,4]]; nlst(:p(0), :lst(@arg)); pop(@arg); nlst(:p(0), :lst(@arg))
evalable6 [0 2 3]
[0 2 3]
ccc_ OK
Thanks 14:45
14:45 ccc_ left
Xliff m: "..table.field" ~~ / [<:letter>+]+ %% 14:50
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing quantifier on the left argument of %%
at <tmp>:1
------> 3"..table.field" ~~ / [<:letter>+]+ %%7⏏5<EOL>
Xliff m: "..table.field" ~~ / [<:letter>+]+ %%
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing quantifier on the left argument of %%
at <tmp>:1
------> 3"..table.field" ~~ / [<:letter>+]+ %%7⏏5<EOL>
Xliff m: ("..table.field" ~~ / [<:letter>+]+ %% '.' /).gist.say
camelia 「table.field」
Xliff ^^ Is there any way to write a regex that will not match due to the '..' at the beginning without anchoring?
m: ("..table.field" ~~ / <!after '.'> [<:letter>+]+ %% '.' /).gist.say 14:51
camelia 「able.field」
Xliff m: ("..table.field" ~~ / <?after '.'>{ say "wrong dot"} [<:letter>+]+ %% '.' /).gist.say
camelia wrong dot
wrong dot
「table.field」
Xliff Just getting used to triggering code in regexes, too. 14:52
14:53 RubioTerra left
moritz there's a chapter in my regexes+grammars book that talks about that :) 14:53
Xliff Ah!
14:58 pmurias joined
Xliff moritz: Reading. Which chapter would that be? 15:00
11? 15:01
m: ("..table.field" ~~ / [<:letter>+]+ %% '.' { die "Illegal prefix" if .starts-with('..'); die "Illegal suffix!" if .ends-with('.') } /).gist.say 15:14
camelia Illegal prefix
in block <unit> at <tmp> line 1
Xliff m: (".table.field" ~~ / [<:letter>+]+ %% '.' { die "Illegal prefix" if .starts-with('..'); die "Illegal suffix!" if .ends-with('.') } /).gist.say
camelia 「table.field」
Xliff m: ("table.field/" ~~ / [<:letter>+]+ %% '.' { die "Illegal prefix" if .starts-with('..'); die "Illegal suffix!" if .ends-with('.') } /).gist.say
camelia 「table.field」
Xliff m: ("table.field." ~~ / [<:letter>+]+ %% '.' { die "Illegal prefix" if .starts-with('..'); die "Illegal suffix!" if .ends-with('.') } /).gist.say
camelia Illegal suffix!
in block <unit> at <tmp> line 1
15:15
Xliff \o/
moritz Xliff: 4 15:21
Xliff OK, thanks! 15:24
15:30 zacts joined 15:35 skids joined 16:02 pmurias left 16:19 ravenousmoose left 16:39 lucasb joined 16:47 zacts left 16:54 domidumont left 16:56 abraxxa1 left 16:58 jme` left 17:00 xenowoolfy joined 17:04 xenowoolfy left 17:13 vrurg left 17:16 cpan-p6_ left 17:17 cpan-p6 joined 17:22 scimon left 17:26 dakkar left 17:45 robertle joined 17:52 kensanata left, sadf joined, sadf left 18:10 reach_satori joined 18:13 markoong joined 18:23 sno left 18:29 vrurg joined 18:33 rindolf left 18:36 rindolf joined 18:37 Sgeo_ left 18:38 Sgeo_ joined
timotimo .tell cygx i look forward to you having a look at my pull requests and issues for Image::RGBA::Text :) :) 18:44
yoleaux timotimo: I'll pass your message to cygx.
19:02 mowcat joined 19:21 sno joined 19:26 rindolf left 19:27 sauvin left 19:29 rindolf joined 19:32 molaf joined 19:38 tyilanmenyn left 19:47 tyilanmenyn joined 19:49 leont joined 19:57 pecastro joined, tyilanmenyn left 20:00 xinming_ joined 20:02 xinming left 20:04 xenowoolfy joined 20:06 rindolf left 20:08 tyilanmenyn joined, rindolf joined 20:09 xenowoolfy left 20:12 zakharyas joined
Geth doc: 2cbf85b171 | Coke++ | 2 files
brace/bracket cleanup
20:14
doc: 7e3866c13b | Coke++ | doc/Type/IO/Path.pod6
allow example to compile
synopsebot Link: doc.perl6.org/type/IO::Path
20:22 leont left 20:23 leont joined 20:30 cpan-p6 left, cpan-p6 joined 20:37 jmerelo left 20:44 reach_satori left 20:49 lucasb left 21:01 xenowoolfy joined 21:04 xenowoolfy left
SyrupThinker p6: use NativeCall; sub strlen(Str) returns size_t is native { * }; say strlen("Test").WHAT 21:07
camelia (Int)
SyrupThinker I'd guess this is unintended, right? 21:08
MasterDuke SyrupThinker: what is unintended? 21:23
21:25 eseyman left, dvdl joined 21:26 dogbert2_ left, robertle left
jnthn size_t is a native type, .WHAT is an object operation, and native integer types will be boxed into an Int in order to do .WHAT 21:27
21:33 zakharyas left 21:34 eseyman joined 21:36 skids left 21:39 pmurias joined
SyrupThinker I see, so when I return that size_t in a subroutine I must use Int for the typecheck? 21:46
tobs m: use NativeCall; sub strlen(Str) returns size_t is native { * }; sub f ($s --> Int) { strlen($s) }; say f "Test" 21:48
camelia 4
21:48 ExtraCrispy left
tobs SyrupThinker: from that I'd guess the boxing is automatic 21:48
SyrupThinker Yes, what I tried was...
m: use NativeCall; sub strlen(Str) returns size_t is native { * }; sub f($s --> size_t) { strlen($s) }; say f("Test"); 21:49
camelia 4
SyrupThinker Wut
m: use NativeCall; sub strlen(Str) returns size_t is native { * }; sub f($s --> size_t:D) { strlen($s) }; say f("Test"); 21:50
camelia Type check failed for return value; expected NativeCall::Types::size_t:D but got Int (4)
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1
SyrupThinker Ahh
So... I guess the problem is that native types don't have a concept of undefiendness and the :D makes no sense...
Anyway, thanks, that clears it up for me 21:51
21:53 rindolf left
tobs There's a snippet on docs.perl6.org/type/Signature#inde...raint_%3AD which makes me believe that :D is equivalent to testing .DEFINITE, which would require boxing to an Int again, I suppose 21:54
But I don't _know_ more than you about it.
21:55 vrurg left 21:56 rindolf joined
timotimo SyrupThinker is right, natives don't have a concept of undefinedness 22:08
22:09 vrurg joined 22:10 dvdl left 22:38 rindolf left
TreyHarris It looks like the built-in USAGE generator doesn't do any line wrapping. Is there a way to specify a line break in a declarator POD block? 22:39
Altreus I can construct a DateTime from a list of 6 integers, and I can construct a list of 6 "integers" by applying a regex to a string, but I can't figure out how to correctly deconstruct the Match object so I can slip it directly into DateTime.new «DateTime.new( $dt ~~ /(\d ** 5)(\d ** 2) ** 5/ )» 22:40
22:41 rindolf joined
Altreus Obviously this is a very perl5 thing to do, but it's also kinda why I use perl :P 22:41
Also obviously this makes a bit of a multidimensional result 22:42
it's DRYer though :P
leont TreyHarris: you can override the default usage generator 22:47
Altreus: I suspect the solution will involve zipping 22:48
Altreus I got away with 2 lines 22:54
one doing the regex; and then DateTime.new($/[0], |$/[1])
tobs m: DateTime.new: |("123456" ~~ /(\d) ** 6/).values».Int 22:55
camelia ( no output )
tobs m: say DateTime.new: |("123456" ~~ /(\d) ** 6/).values».Int
camelia 0001-02-03T04:05:06Z
22:56 cpan-p6_ joined
leont Sounds like DateTime is lacking a good strptime 22:57
Altreus so is DateTime::Format 22:58
:)
23:00 cpan-p6 left
Altreus I couldn't see a simple way of turning my match into a single list 23:01
or, I guess, otherwise splitting the string into a 4 and five 2s
TreyHarris A Match is a Capture, in that Match is a subclass of Capture. So...
m: my $d = '17:22 GMT 2017-01-22'; DateTime.new(|($d ~~ /$<hour>=(\d\d?) ':' $<minute>=(\d\d) <ws> 'GMT' <ws> $<year>=(\d**4)'-'$<month>=(\d\d)'-'$<day>=(\d\d)/)) 23:02
camelia ( no output )
TreyHarris m: my $d = '17:22 GMT 2017-01-22'; say DateTime.new(|($d ~~ /$<hour>=(\d\d?) ':' $<minute>=(\d\d) <ws> 'GMT' <ws> $<year>=(\d**4)'-'$<month>=(\d\d)'-'$<day>=(\d\d)/))
camelia 2017-01-22T17:22:00Z
Altreus well yeah but that's more complicated
especially since that's not my format :)
TreyHarris I'm a little bewildered by your format... you have 5 groups of 5 digits followed by 2 digits. How do 35 digits become a DateTime object? 23:07
Semantically, I mean... you're asking about the syntax 23:08
b2gills m: my $d = '17:22 GMT 2017-01-22'; say DateTime.new: |+«$d.comb(/\d+/)[2,3,4,0,1], 0 23:11
camelia 2017-01-22T17:22:00Z
23:11 rindolf left 23:12 Grauwolf left
Altreus do I? 23:13
TreyHarris b2gills: sure, I was going to develop from the above most-explicit version to more-and-more golfed, but since Altreus says the issue is his format, I'm wondering how 35 digits make up a 5-element DateTime
Altreus (\d ** 5)(\d ** 2) ** 5
sorry I keep doing that
(\d ** 4)(\d ** 2) ** 5
did it in my program too and took me ages to figure out why it stopped matching 23:14
TreyHarris Yes, 7 times 5 is 35. 6 times 5 is 30... how do 30 digits become a DateTime? 12 would be the usual number of digits
Altreus but
it's 4 digits and 5 groups of 2
TreyHarris Oh, I see. I was decomposing into rx's on my side to try to make it easier, but I grouped it wrong 23:17
b2gills m: my $d = '20190205171724'; say DateTime.new: |$d.comb(/^\d ** 4|\d ** 2/) 23:19
camelia 2019-02-05T17:17:24Z
23:20 dct_ left
Altreus comb :o 23:22
so many routines new to perl6
TreyHarris But that comb only works because DateTime happens to supply a positionals-only .new. 23:25
tobs m: multi mycomb (Str:D $s, *@sizes) { $s.comb.rotor(@sizes)».join }; say DateTime.new: "20180206002640".&mycomb(4, 2 xx 5) 23:27
camelia Cannot resolve caller new(DateTime:U: List:D); none of these signatures match:
(DateTime: \y, \mo, \d, \h, \mi, \s, :$timezone = 0, :&formatter, *%_ --> DateTime:D)
(DateTime: :$year!, :$month = 1, :$day = 1, :$hour = 0, :$minute = 0, :$se…
tobs m: multi mycomb (Str:D $s, *@sizes) { $s.comb.rotor(@sizes)».join }; say DateTime.new: |"20180206002640".&mycomb(4, 2 xx 5)
camelia 2018-02-06T00:26:40Z
tobs at some point, maybe it's best to define your own sub? 23:28
Elronnd there seems to be a typo at docs.perl6.org/language/io-guide#S..._IO::Path; 'foo'.IO should be 'foo'.Str? Is there somewhere I can open a ticket about this? 23:33
jnthn Elronnd: github.com/perl6/doc/issues 23:36
23:37 tyil left 23:38 tyilanmenyn is now known as tyil, tyil left 23:39 tyil joined
TreyHarris Elronnd: No, that's actually correct, it's just that the intro is poorly worded 23:41
Note the earlier example uses `~` to stringify the IO object. The second uses .absolute and .relative 23:42
If $path were a Str object, the example would be pointless because Str doesn't have .absolute and .relative methods 23:43
23:43 pmurias left 23:47 ferreira left 23:48 ferreira1 joined
Elronnd TreyHarris: ahhh 23:48
TreyHarris IMO, if you're passing a sequence into a positional, unless you're one-off or one-lining it, you should break it up into a couple steps in most cases--this one is maybe the exception because DateTime has a well-ordered sequence of arguments that all have 0 defaults. That's really rare. 23:49
23:58 pecastro left
kybr i think someone kybr: to me in the last few days. does anyone know how to search the backlog in weechat? i am not much of an IRC user anymore :) 23:59