»ö« 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:05
MilkmanDan left
00:07
MilkmanDan joined
00:14
itaipu left
00:21
itaipu joined
00:27
itaipu left
00:38
MilkmanDan left
00:40
nadim left
00:50
sQuEE` left
00:55
MilkmanDan joined
01:08
FROGGS_ joined
|
|||
awwaiid | mmm. I think not directly, but maybe something else can be used to create it. Not sure | 01:10 | |
01:11
FROGGS left
01:15
nebuchadnezzar left
01:23
kalkin- left,
kalkin-_ joined
01:24
canopus left
01:28
Actualeyes joined
|
|||
TimToady | dataangel: I have no idea if racket copied us there, but if not, it's just independent invention, because we didn't copy much of anything from racket | 01:30 | |
01:30
canopus joined
|
|||
TimToady | we have delimited continuations internally, but we hide continuations from mere mortals | 01:30 | |
01:33
poohman joined
01:35
poohman_ left
|
|||
MasterDuke | i've always thought of racket as the most Perlish of the the Schemes, with its batteries included kind of approach | 01:35 | |
which might explain why i liked it so much | |||
so i find it kind of interesting that Perl 6 doesn't take much from it | 01:36 | ||
is that intentional? | |||
01:37
rgrinberg joined
|
|||
TimToady | it's just convergent evolution, I suspect | 01:38 | |
driven by similar goals of being a metalanguage for other languages | 01:39 | ||
01:39
labster joined,
sQuEE joined
01:42
wbill joined,
canopus left
01:44
lichtkind_ left
01:45
ilbot3 left
01:47
ilbot3 joined
01:48
canopus joined
01:54
bob777 joined
01:58
wamba joined
02:03
bpmedley joined
02:08
jimlenz left
|
|||
AlexDaniel | is there any way to get a list of arguments inside a subroutine? | 02:18 | |
I mean, I want this: | |||
m: sub foo(*@args) { say @args }; foo(42, ‘hello’) | |||
camelia | rakudo-moar 04af57: OUTPUT«[42 hello]» | ||
AlexDaniel | but like this: | ||
m: sub foo($foo, $bar) { say @args }; foo(42, ‘hello’) | |||
camelia | rakudo-moar 04af57: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '@args' is not declaredat <tmp>:1------> 3sub foo($foo, $bar) { say 7⏏5@args }; foo(42, ‘hello’)» | ||
AlexDaniel | without doing this: | 02:19 | |
m: sub foo(*@args) { my ($foo, $bar) = @args; say @args; say $foo; say $bar }; foo(42, ‘hello’) | |||
camelia | rakudo-moar 04af57: OUTPUT«[42 hello]42hello» | ||
02:27
noganex_ joined
|
|||
MasterDuke | m: sub foo($foo, $bar) { say @_ }; foo(42, ‘hello’) | 02:28 | |
camelia | rakudo-moar 04af57: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Placeholder variable '@_' cannot override existing signatureat <tmp>:1------> 3sub7⏏5 foo($foo, $bar) { say @_ }; foo(42, ‘he» | ||
MasterDuke | interesting, i'd never seen that error before | ||
AlexDaniel | what does it mean? | 02:29 | |
02:29
geraud left,
noganex left
|
|||
geekosaur | @_ is not always generated like it is in perl 5, it is generated for default signatures only | 02:30 | |
if you use them with a real signature yu should get that error (which probably ought to be like the p5 warnings) | |||
MasterDuke | "If no signature is provided but either of the two automatic variables @_ or %_ are used in the function body, a signature with *@_ or *%_ will be generated." from the docs | ||
b2gills | m: sub foo (*@_ ($foo, $bar)) { say '@_ ',@_, '$bar ', $bar }; foo(42, ‘hello’) | 02:31 | |
camelia | rakudo-moar 04af57: OUTPUT«@_ [42 hello]$bar hello» | ||
02:31
bob778 joined,
bob777 left,
bob778 is now known as bob777
|
|||
AlexDaniel | b2gills: nice! Lovely! What about named arguments? | 02:33 | |
02:34
Pierre_ joined
|
|||
b2gills | m: sub foo ( *%_ ( :$bar, :$foo ) ){ say %_ }; foo :bar, :foo | 02:35 | |
camelia | rakudo-moar 04af57: OUTPUT«{bar => True, foo => True}» | ||
02:35
geraud joined
|
|||
geekosaur | that should work for *%_ / %_ as well | 02:39 | |
(slurpy for named parameters) | |||
AlexDaniel | b2gills: thank you! | 02:40 | |
02:42
canopus left,
Actualeyes left
02:47
rgrinberg left
02:55
bjz joined
02:59
bob777 left
03:03
TEttinger joined
03:23
eliasr left
03:25
kyclark_ joined
03:28
kyclark_ left
|
|||
skids | m: my %d = :foo(1,2,3); %d.say; class A { has @.foo }; A.new(:foo(1,2,3)).perl.say; A.new(|%d).perl.say # :/ | 03:47 | |
camelia | rakudo-moar 04af57: OUTPUT«{foo => (1 2 3)}A.new(foo => [1, 2, 3])A.new(foo => [(1, 2, 3),])» | ||
03:52
wamba left
|
|||
TimToady | skids: hash values are kept in a scalar container | 03:58 | |
m: my @d = :foo(1,2,3); @d.say; class A { has @.foo }; A.new(:foo(1,2,3)).perl.say; A.new(|@d).perl.say | 04:00 | ||
camelia | rakudo-moar 04af57: OUTPUT«[foo => (1 2 3)]A.new(foo => [1, 2, 3])Default constructor for 'A' only takes named arguments in block <unit> at <tmp> line 1» | ||
TimToady | innersting | ||
04:01
poohman left
|
|||
TimToady | m: my $d = :foo(1,2,3); $d.say; class A { has @.foo }; A.new(:foo(1,2,3)).perl.say; A.new(|$d).perl.say | 04:01 | |
camelia | rakudo-moar 04af57: OUTPUT«foo => (1 2 3)A.new(foo => [1, 2, 3])A.new(foo => [1, 2, 3])» | ||
skids | Yeah, it makes sense what is going on, but makes things difficult. | ||
TimToady | arguably, |@d should turn pairs into named args | 04:02 | |
unless that's a feature... | 04:03 | ||
m: my @d = :foo(1,2,3); @d.say; class A { has @.foo }; A.new(:foo(1,2,3)).perl.say; A.new(|$@d).perl.say | |||
camelia | rakudo-moar 04af57: OUTPUT«[foo => (1 2 3)]A.new(foo => [1, 2, 3])Default constructor for 'A' only takes named arguments in block <unit> at <tmp> line 1» | ||
TimToady | m: my @d = :foo(1,2,3); @d.say; class A { has @.foo }; A.new(:foo(1,2,3)).perl.say; A.new(|@d[0]).perl.say | ||
camelia | rakudo-moar 04af57: OUTPUT«[foo => (1 2 3)]A.new(foo => [1, 2, 3])A.new(foo => [1, 2, 3])» | ||
TimToady | m: my @d = :foo(1,2,3); @d.say; class A { has @.foo }; A.new(:foo(1,2,3)).perl.say; A.new(|@d[*]).perl.say | ||
camelia | rakudo-moar 04af57: OUTPUT«[foo => (1 2 3)]A.new(foo => [1, 2, 3])Default constructor for 'A' only takes named arguments in block <unit> at <tmp> line 1» | ||
TimToady | seems like a bit of a can't-get-there-from-here though | 04:04 | |
skids | right. You can build a nonscalarized hash with := but... that's real ugly. | 04:05 | |
Though for my particular application it may be workable. | 04:07 | ||
TimToady | m: my $d = \(:foo(1,2,3), :bar<a b c>); $d.say; class A { has @.foo }; A.new(:foo(1,2,3)).perl.say; A.new(|$).perl.say | ||
camelia | rakudo-moar 04af57: OUTPUT«\(:bar(("a", "b", "c")), :foo((1, 2, 3)))A.new(foo => [1, 2, 3])Default constructor for 'A' only takes named arguments in block <unit> at <tmp> line 1» | ||
TimToady | m: my $d = \(:foo(1,2,3), :bar<a b c>); $d.say; class A { has @.foo }; A.new(:foo(1,2,3)).perl.say; A.new(|$d).perl.say | ||
camelia | rakudo-moar 04af57: OUTPUT«\(:bar(("a", "b", "c")), :foo((1, 2, 3)))A.new(foo => [1, 2, 3])A.new(foo => [1, 2, 3])» | ||
TimToady | a capture object is probably the best way to indirect multiple named args currently | 04:08 | |
04:10
poohman joined
04:11
khw left
04:15
MilkmanDan left
04:22
poohman left,
AngeloMichael left,
poohman joined,
Pierre_ left
04:28
perlawhirl joined
|
|||
perlawhirl | m: my @d = :foo(1,2,3); @d[0].say; class A { has @.foo }; A.new(|@d[0]).perl.say | 04:29 | |
camelia | rakudo-moar 04af57: OUTPUT«foo => (1 2 3)A.new(foo => [1, 2, 3])» | ||
04:31
labster left
04:33
skids left
04:36
MilkmanDan joined
04:37
grondilu joined
04:55
wamba joined
04:59
AlexDaniel left
05:00
Cabanossi left
05:03
Cabanossi joined
05:07
djbkd left
05:11
holyghost left
05:17
FROGGS_ left
05:24
bob777 joined
05:31
domidumont joined,
djbkd joined
05:35
domidumont left,
domidumont joined
05:36
bob777 left
05:37
CIAvash joined
05:40
itaipu joined
05:43
wamba left
05:47
djbkd left
05:52
itaipu left
05:55
bob777 joined
05:58
domidumont left
05:59
bob777 left,
brrt joined
06:03
itaipu joined
06:04
djbkd joined,
labster joined
06:05
_slade_ left
06:23
nadim joined
06:24
itaipu left,
domidumont joined
06:25
firstdayonthejob joined
06:26
nebuchadnezzar joined,
brrt left
06:33
wamba joined,
domidumont left
06:34
domidumont joined
06:37
firstdayonthejob left
|
|||
imcsk8 | hello, is there a loop control statement like "continue"? | 06:45 | |
lizmat | next? | 06:46 | |
last? | |||
redo? | |||
not sure what you mean by "continue" | |||
imcsk8 | oh its next, thanks! | ||
lizmat | yw :) | 06:47 | |
geekosaur | continue is what C calls next | 06:49 | |
(and C++ and Java) | |||
not perl5's continue block | |||
er, for clarity: what they call perl's next | 06:50 | ||
perlawhirl | btw... just wanted to say... | 07:06 | |
lizmat++ for the awesome performance gains on permutations | 07:07 | ||
07:12
Pierre_ joined
07:17
darutoko joined
07:19
ufobat joined
07:29
robertle left
07:31
perlawhirl left
07:40
zakharyas joined
07:42
pierrot left
07:46
Pierre_ left
07:49
Pierre_ joined
07:54
pierrot joined
07:56
RabidGravy joined
08:00
Psy-Q left
|
|||
arnsholt | At least most languages have *either* continue or next | 08:03 | |
Except AWK which has both | |||
08:03
araujo__ left,
aries_liuxueyang left
08:04
araujo joined,
jonas2 joined
|
|||
moritz | continext | 08:04 | |
08:05
aries_liuxueyang joined
|
|||
arnsholt | =D | 08:05 | |
In AWK continue is loop control for "normal" loops, while next is loop control for the implicit loop over records | 08:06 | ||
08:07
xiaomiao left
08:08
araujo_ joined
08:09
xiaomiao joined,
g4 joined
08:11
ab6tract joined,
araujo left
|
|||
[Coke] waves from Leeds | 08:13 | ||
El_Che | Leeds | 08:14 | |
how exotic :) | |||
aren't you US-based? | 08:15 | ||
08:17
stigo left
|
|||
[Coke] | aye | 08:18 | |
dublin yesterday, leeds for 3 days, then back to the us | |||
El_Che | hollidays? | ||
08:18
stigo joined
|
|||
DrForr | Be on the lookout for vampires :) | 08:20 | |
El_Che | DrForr: vampires is more your neighbourhood thing, isn't? | ||
DrForr | Someone's not read Stross' latest :) | 08:22 | |
[Coke] | no, business. | ||
(people go to leeds for pleasure?) | 08:23 | ||
08:24
kim1599 joined
08:25
pdcawley left
|
|||
El_Che | [Coke]: be nice to the locals, you're not yet out of the woods | 08:25 | |
[Coke] | :) | 08:28 | |
I've been here several times for work, doesn't look like much has changed. :) | |||
08:28
pdcawley joined
08:29
bjz_ joined
08:32
gfldex joined,
bjz left
08:35
djbkd left
|
|||
El_Che | so Leeds, are you into wool? :) | 08:39 | |
[Coke] | It's financial-adjacent. | 08:40 | |
08:40
Pierre_ left
08:45
araujo_ left,
bjz_ left
08:47
bjz joined
|
|||
arnsholt | DrForr: Vampires? Invading space-elves on FCl_3-belching dragons, more like =p | 08:48 | |
DrForr | Well, that too, yes :) | ||
arnsholt | No wait, it's ClF_3 =D | 08:52 | |
Chlorine trifluoride | 08:53 | ||
moritz | sounds like a nasty component :-) | 08:58 | |
or compound, rather | |||
DrForr | Just about the strongest oxidizer known to man. | 09:03 | |
09:08
user9 left
09:09
user9 joined
09:11
gfldex left
09:14
Pierre_ joined
09:16
pierrot left
09:20
pierrot joined
|
|||
wamba | m: my $a=True but role { method Bool {False} }; say $a | 09:21 | |
camelia | rakudo-moar 137917: OUTPUT«False» | ||
09:24
denis38 joined
09:27
Pierre_ left
09:28
eliasr joined
09:38
Actualeyes joined
|
|||
arnsholt | moritz: blogs.sciencemag.org/pipeline/archi..._this_time | 09:38 | |
It sounds pretty damn scary | 09:40 | ||
moritz | arnsholt: and to put things into perspective, I'm too scared to deal with HF or F_2 myself :-) | 09:43 | |
and I know some folks how work with very watery HF and hate every second of it | 09:44 | ||
arnsholt | Oh, he has an article about HF as well! =) | ||
10:52 < arnsholt> No wait, it's ClF_3 =D | |||
blogs.sciencemag.org/pipeline/archi...nt_touch_1 | |||
09:44
wbill left
|
|||
arnsholt | ISTR there being an article recounting all the chemists who managed to kill themselves trying to isolate F_2 as well | 09:46 | |
(There being a very large number of casualties due to that particular effort) | |||
09:49
kim1599 left
|
|||
DrForr | I was involved in a debate over ClF_3 vs. F_2O_2 at YAPC :) | 09:55 | |
09:59
labster left
|
|||
stmuk_ | I think I was on that table! | 10:00 | |
DrForr | Wouldn't surprise me. | 10:03 | |
10:04
user9 left,
user9 joined
10:07
Zoffix joined
|
|||
Zoffix | New blog post "Perl 6 Core Hacking: Grammatical Babble": perl6.party/post/Perl-6-Core-Hackin...cal-Babble | 10:07 | |
And those inspired to do some core hacking, check out our selection of bugs to fix: perl6.fail/ | 10:10 | ||
lizmat | wow | 10:11 | |
Zoffix | Call for attendees and speakers: Sep 29, 7PM, Toronto. The Toronto Perl Mongers will be hosting a series of lightning talks including my own "Perl 6: What Programming in The Future is Like?". Do a talk of your own (5-10 minutes) or come listen to the speakers. It's FREE! www.meetup.com/Toronto-Perl-Mongers...233588645/ | 10:27 | |
10:28
Pierre_ joined
|
|||
stmuk_ | Zoffix: is it possible to add "testneeded" to your perl6.fail tag cloud? | 10:44 | |
Zoffix | buggable, tag TESTNEEDED | 10:45 | |
buggable | Zoffix, There are no tickets tagged with TESTNEEDED | ||
Zoffix | stmuk_, ^ that's accurate. I took care of them all on the weekend | ||
stmuk_ | :O | 10:46 | |
Zoffix++ | |||
10:53
kaare__ joined
10:56
smls joined
|
|||
moritz | Zoffix++ | 10:56 | |
10:56
Pierre_ left
|
|||
timotimo | \o/ | 10:59 | |
10:59
Pierre_ joined
11:00
[ptc] left
|
|||
stmuk_ | Zoffix: status "deleted" tickets are visible (eg. RT#129226) | 11:03 | |
synopsebot6 | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=129226 | ||
11:03
wamba left
11:14
wamba joined
|
|||
smls | Is there any way to dublicate an IO::Pipe in order to feed it into the STDIN of two separate commands? | 11:22 | |
Like the `tee` command on Linux. | |||
I can slurp-rest the pipe, but `run :in($string)` does not work, and there seems to be no way to construct a Pipe from a string manually. | 11:23 | ||
timotimo | yeah, you'll have to have a worker feed it, or use the unix(?) function "sendfile" | ||
smls | feed it how? | 11:24 | |
m: say IO::Pipe.new.print: "foo"; | |||
camelia | rakudo-moar 137917: OUTPUT«IO::Pipe is disallowed in restricted setting in sub restricted at src/RESTRICTED.setting line 1 in method new at src/RESTRICTED.setting line 32 in block <unit> at <tmp> line 1» | ||
stmuk_ | I think RT#126840 can be closed | ||
synopsebot6 | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=126840 | ||
timotimo | smls: yes, send the data into the pipe | 11:27 | |
smls | timotimo: Do you have a code example of how to do that? Because `IO::Pipe.new.print` and `IO::Pipe.new.open` throw errors about "requires an object with REPR MVMOSHandle" | 11:28 | |
It may not be possible to manually open a pipe at all. | 11:29 | ||
timotimo | yeah, IO::Pipe.new may want to explode instead | 11:30 | |
or do something like mkfifo | |||
but when you run a process you can just use the pipe it creates for you | |||
smls | how can I get a writable pipe to its STDIN? | 11:32 | |
This exits without printing anything: | 11:33 | ||
my $p = run "echo", :in; $p.in.print: "Hello"; | |||
11:34
[ptc] joined
|
|||
timotimo | 1) use cat instead of echo | 11:35 | |
2) don't forget to close the pipe | |||
3) might have to wait for the process to exit before exiting your own script | |||
smls | Ah, thanks! | 11:38 | |
11:42
bob777 joined
11:49
BenGoldberg joined
11:55
TEttinger left
11:56
smls_ joined,
smls left
11:59
aries_liuxueyang left
12:00
aries_liuxueyang joined
12:02
denis38 left
12:06
poohman_ joined
|
|||
tbrowder | ref sprintf doc proposed redo: see the original gist with MasterDuke's suggestions and other corrections, including table changes (removed, change to code) so as to render properly given the current state of pod6: gist.github.com/tbrowder/fecfedbe4...655477a542 | 12:06 | |
a belated good morning (CDT), #perl6! | 12:07 | ||
12:07
poohman left
|
|||
[Coke] | happy lunch time is over. | 12:09 | |
12:11
poohman_ left
|
|||
DrForr | Afternoon. | 12:14 | |
tbrowder: Did my comment on reddit (yes, I've finally joined) make sense? | 12:15 | ||
El_Che | maven & docker builds. Feel my pain | ||
tbrowder | DrForr: haven't seen it--don't check there often--I'll look now... | 12:16 | |
DrForr | "Make's too complex, I know, let's use XML." Now you've got OMGWTFBBQ MY EYES, THE GOGGLES! THEY DO NOTHING! | ||
12:16
TEttinger joined
|
|||
DrForr | tbrowder: I just happened to see your comment, and for that matter, people commenting on my modules w/o my knowledge :) | 12:17 | |
El_Che | on the other hand, I was there when Solaris started to define it's system services in xml | ||
something broke that day | |||
tbrowder | DrForr: oh, you're talking about module Perl::Tidy? | 12:19 | |
DrForr | Yeah. | ||
timotimo | RabidGravy: i hope you find some time to spend for perl6 between all that tweeting :) | 12:20 | |
tbrowder | DrForr: I must admit I haven't done any serious review of the module, but I think I recognize the problem you're solving, and it will eventually scratch an itch I have, thus a big Thank You for tackling it! | 12:22 | |
12:24
wamba left
|
|||
DrForr | Yeah. I'm playing kind of a long game with the module, but I keep seeing people complaining about the fact that we don't have tidy and "best practices"; the latter is tiresome because there's not 15 years of production code using Perl 6, people keep getting confused between 5 and 6, or deliberately assume that 6 has the same history as 5 because they can rip on it easier. | 12:24 | |
12:29
smls_ is now known as smls
|
|||
El_Che | DrForr: we like to complain | 12:31 | |
:) | |||
DrForr: I think the most important function is code formatting, so teams can format they code on a uniform way | |||
DrForr: best practices is such a moving target | 12:32 | ||
DrForr: inside-out objects! :) | |||
DrForr | We barely have targets, much less moving targets. | ||
El_Che | wasn't world domination for 100 years one of the target with the camelia logo being part of the plan? | 12:33 | |
timotimo | totes | ||
12:33
itaipu joined
12:34
BenGoldberg left
|
|||
DrForr | I'm thinking of the long game. | 12:34 | |
tbrowder | DrForr: I finally found yr comments! And yes, to me, the comments make sense. Thanks again for yr efforts. | 12:39 | |
timotimo | where can i find the reddit thread you are talking about? | 12:40 | |
DrForr | It's short. tbrowder probably has a link, I don't. | ||
12:42
pmurias joined
12:44
itaipu left
|
|||
pmurias | DrForr: perltidy is great as it allows consistent formatting without doing boring manual formatting | 12:45 | |
yoleaux | 2 Sep 2016 16:50Z <ab6tract> pmurias: I've tried to make the the 'no precompilation' hit as minimal as possible. are you using a terminal client which automatically updates COLUMNS and ROWS in the environment for you as you resize? | ||
7 Sep 2016 15:45Z <[Coke]> pmurias: src/vm/js/Chunk.nqp uses nqp::list_s - where is list_s defined for the js backend? | |||
pmurias | [Coke]: src/vm/js/Operations.nqp:533 | 12:47 | |
12:51
itaipu joined
12:57
tzimisces joined
12:58
tzimisces left
12:59
rgrinberg joined
13:00
mcmillhj joined
13:03
cdg joined
13:04
Sgeo left
13:05
AlexDaniel joined
|
|||
[Coke] | ah. thanks. my "did someone define an op" logic is super cheaty, and didn't see that dynamic creation. | 13:08 | |
[Coke] now wants an nqp op called opcodes that returns an array of opcode information | |||
13:15
skids joined
13:18
kyclark_ joined
13:19
spider-mario joined,
TEttinger left
|
|||
pmurias | [Coke]: should be fairly easy to implement | 13:28 | |
13:33
MilkmanDan left
13:35
MilkmanDan joined
|
|||
pmurias | [Coke]: what are you using the list of implemented ops for? | 13:36 | |
Pierre_ | m: class c { multi method a(Int $i) { say $i}; multi a(Str $s) { say $s } } | 13:39 | |
camelia | ( no output ) | ||
Pierre_ | m: class c { multi method !a(Int $i) { say $i}; multi !a(Str $s) { say $s } } | ||
camelia | rakudo-moar 9d1a08: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Private multi-methods are not supportedat <tmp>:1------> 3class c { multi method7⏏5 !a(Int $i) { say $i}; multi !a(Str $s) » | ||
Pierre_ | is it not supported yet, or it will never get supported | 13:41 | |
jnthn | "Not yet"; I expect it will be added in a future Perl 6 language version. | 13:43 | |
It's not impossible, just some design/impl effort to make it happen | |||
Pierre_ | ok, makes sense | 13:46 | |
i will just not "document" the multi method that should not be seen | |||
13:50
Khisanth left
13:52
mcmillhj left
13:55
mcmillhj joined
|
|||
kyclark_ | I’m trying to learn Grammars, so I have this sort of working: lpaste.net/187760 The grammar works on just one record but not two. Also I have no idea how to “make” the return value into a simple array-of-hashes rather than the Match objects. | 13:58 | |
[Coke] | pmurias: (using list of ops) t/docs/opcodes.t | ||
right now, that test greps source code to try to guess. | |||
DrForr | kyclark_: I just use 'make' on its own, the $/ is implicit in general. | 13:59 | |
kyclark_ | I suspected that but was not sure. Thanks. | 14:00 | |
DrForr | so line 12: 'make $<record>>>.made' | ||
kyclark_ | Yeah, that’s a guess... | ||
Since “record” will be plural as will <member> | |||
What I’d like is an array or <record>s, and each will have one <id> and one or more <member>s | 14:01 | ||
14:02
Khisanth joined
14:03
Pierre_ left
|
|||
DrForr | Also, I'd break line 6 down a bit more, so \d+ => <integer> and such. | 14:04 | |
kyclark_ | I guess then I could refer to <thing>s instead of positional captures (?) | 14:05 | |
DrForr | Also, the '^' in your ID tag is a problem. | ||
(line 4) | |||
kyclark_ | Should that be ^^ or just lose it? | ||
DrForr | Just drop it. | ||
^ means the start of the string, so it'll never advance beyond the first <token> | 14:06 | ||
I.E. the <id> tag will only ever match at the start of the file, so any records you have that don't start at the beginning of the file will be ignored. | 14:09 | ||
kyclark_ | Which is exactly what’s happening. Thanks. | ||
DrForr | I'd personally break down lines into: | 14:10 | |
<int> <id> <gi-thing> 'at' <pct>, because you'll need those for other format variants. | 14:11 | ||
kyclark_ | Great, now it parses two records. | ||
DrForr | That also means that lines 25-28 can have names instead of match indexes,makes your expression clearer. | ||
kyclark_ | This is better? | 14:12 | |
lpaste.net/187760 | |||
14:12
Pierre_ joined
|
|||
DrForr | I'd probably also drop the anchors around #4. | 14:13 | |
Also #8 looks wrong to me; \N should be the very antithesis of what 74.00 matches :) | 14:14 | ||
kyclark_ | I was just worried it might find the other “>” used in the <member> line | ||
Right, I could do better with <pct>: lpaste.net/187760 | 14:15 | ||
14:16
wamba joined
|
|||
tbrowder | timotimo: the DrForr reddit link is here: www.reddit.com/r/perl6/comments/4s...rl_6_code/ | 14:17 | |
kyclark_ | Perhaps my biggest question is how to not get “Match $match = Match.new(ast => Any, list => (),…” back but just an array of hashes? | ||
DrForr | Looks better on the action side. | ||
Oh. CDHit.parse(...).ast | 14:18 | ||
14:18
itaipu left
|
|||
skids | Hrm... how do you get a value OUT of a Scalar container when you cannot assume anything about listiness? | 14:18 | |
DrForr | Or 'say CDHit.parse(...).ast.perl; # dump the Perl6 object. | ||
14:18
tadzik left,
ilmari[m] left,
M-Illandan left,
Matthew[m] left
14:20
itaipu joined
|
|||
kyclark_ | OK, I’ve made some progress! Thanks, DrForr. Gotta get off the couch and get the kids to school now. I’ll rejoin later! | 14:21 | |
14:21
kyclark_ left
|
|||
nadim | hi \o/, I was playing a bit with some P5 code when I noticed that when a compilation error happens in an eval there is a text error on stderr and a message in $@ ... not the same message. How does it work in P6 and is it possible to catch the message that's on STDERR too? the P6 page says very little about errors. | 14:21 | |
mst | perl5 should only put the error in eval | ||
an error to stderr sounds like a warn | |||
DrForr | tbrowder: Yeah, thanks. The whitespace stuff is like being licked to death by camels. | 14:22 | |
tbrowder | the reddit search leaves something to be desired... | 14:23 | |
DrForr | And at this point there's a lot of boilerplate because I'm being intensely anal about the layout. | ||
AlexDaniel | “Internal error: zeroed target thread ID in work pass” :'( | 14:24 | |
.seen Skarsnik | |||
yoleaux | I saw Skarsnik 27 Aug 2016 00:01Z in #perl6: <Skarsnik> probably a bug | ||
DrForr | I also want Slang authors to be able to subclass or inject roles into the code so their tools can merge their tokens into the existing grammar. | 14:25 | |
mst | nadim: so, basically, I wouldn't expect perl6 to do that because I wouldn't expect perl5 to do that ;) | ||
I *believe* that the 'require' version for perl6 should be CATCHable | 14:26 | ||
14:26
cygx joined
|
|||
cygx | m: use MASTOPs:from<NQP>; MAST::Ops::<%codes>.say | 14:26 | |
camelia | rakudo-moar 9d1a08: OUTPUT«===SORRY!===While looking for 'MASTOPs.moarvm': no such file or directory» | ||
14:26
sena_kun joined
|
|||
sena_kun | 14:26 | ||
nadim | it is a warning on stderr, although it is about the error, but the warning is more helpfull than the error. P6 error message ... yeah! | 14:27 | |
cygx | [Coke]: the code above is what I use to get an oplist on moarvm | ||
not sure why it doesn't work with camelia | |||
AlexDaniel | committable6: HEAD use MASTOPs:from<NQP>; MAST::Ops::<%codes>.say | 14:29 | |
committable6 | AlexDaniel, ¦«HEAD»: ===SORRY!===While looking for 'MASTOPs.moarvm': no such file or directory «exit code = 1» | ||
AlexDaniel | committable6: releases use MASTOPs:from<NQP>; MAST::Ops::<%codes>.say | ||
committable6 | AlexDaniel, ¦«2015.10,2015.11,2015.12,2016.02,2016.03,2016.04,2016.05,2016.06,2016.07.1,2016.08.1,HEAD»: ===SORRY!===While looking for 'MASTOPs.moarvm': no such file or directory «exit code = 1» | ||
arnsholt | m: use MASTOps:from<NQP>; MAST::Ops::<%codes>.say # What about this? | 14:30 | |
camelia | rakudo-moar 9d1a08: OUTPUT«{DEPRECATED_0 => 544, abs_I => 431, abs_i => 71, abs_n => 99, accept_sk => 490, acos_n => 106, add_I => 425, add_i => 63, add_n => 93, append_f => 461, arg_i => 128, arg_n => 129, arg_o => 131, arg_s => 130, argconst_i => 132, argconst_n => 133, argconst_s…» | ||
tbrowder | DrForr: the itch i want to scratch some time is the current requirement in the format statement for sprintf here "%3\$d %d %d\n" to have to escape the '$', and i don't think it should be needed; seems like that ought to be a special case that could be added to the snake pit, no? | 14:31 | |
14:31
khw joined
|
|||
cygx | arnsholt++ # curse you, case-insensitive file system! | 14:32 | |
14:34
AlexDaniel left
|
|||
Pierre_ | Any good source to start to play with Native Call? | 14:34 | |
tbrowder | DrForr: and also this sprintf format case "<b>\%s</b>\n"; don't think the '%' needs to be escaped; both category cases are only used, as far as i know, for format strings for sub/methods 'sprintf', 'printf', and 'fmt' | 14:35 | |
arnsholt | Pierre_: Not really any good docs AFAIK (sorry!), but the test suite should give some pretty good indications on how it works | ||
[Coke] | cygx: can you give me NQP code to do that? | 14:36 | |
DrForr | Well, traditionally '%%' is how to express a single '%'. Did that get changed too?... | ||
Pierre_ | ok, i'll check that | ||
tbrowder | DrForr: i'm not sure about using %% in the last case--haven't tried that, but i will | 14:37 | |
DrForr: the %% would not be appropriate in the last case, the problem currently is the parser doesn't recognize the '%s' as a format specifier without the backslash, the '%%' is used to output '%' as an ordinary char in a printf output string | 14:39 | ||
cygx | nqp-m: for %MAST::Ops::codes { say($_) } | ||
camelia | nqp-moarvm: OUTPUT«flattenropesparam_on2_sdecodertakeallcharsasyncudpislisthllizefornewexceptionctxcallerskipthunksspawnprocasyncsp_p6ogetvc_oatpos3d_sprof_allocatedfreelibsp_get_i64indexatgetstderrsemacquirestrtocodessp_deref_ge…» | ||
cygx | [Coke]: ^^ | ||
DrForr | Just a thought. I actually intend at one point to add '%r' to sprintf formats, but it's down the stack. | 14:40 | |
moritz | I've taken the freedom to reject | ||
RT #129252 | |||
synopsebot6 | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=129252 | ||
moritz | since there didn't seem to be much support for the idea, and good alternatives are available | ||
cygx | [Coke]: you might want to filter out the spesh stuff | ||
Pierre_ | Actually, the docs are not too bad, i should jsut have checked docs.perl6.org/language/nativecall first | 14:41 | |
with the link to github.com/jnthn/zavolaj | 14:42 | ||
it's pretty good :) | |||
[Coke] | cygx++ | 14:44 | |
tbrowder | m: my $s = sprintf "%%s"; say "$s = '$s'" | 14:46 | |
camelia | rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '%s' is not declared. Did you mean '$s'?at <tmp>:1------> 3my $s = sprintf "%7⏏5%s"; say "$s = '$s'"» | ||
tbrowder | m: my $s = sprintf "%%s"; say "s = '$s'" | 14:47 | |
camelia | rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '%s' is not declared. Did you mean '$s'?at <tmp>:1------> 3my $s = sprintf "%7⏏5%s"; say "s = '$s'"» | ||
14:47
araujo joined,
araujo left,
araujo joined
|
|||
tbrowder | m: my $s = sprintf "\%\%s"; say "s = '$s'" | 14:47 | |
camelia | rakudo-moar 15532d: OUTPUT«s = '%s'» | ||
14:48
araujo left
|
|||
tbrowder | DrForr: another sprintf parse problem IMHO, thanks | 14:48 | |
14:48
araujo joined
|
|||
moritz | no, a string parsing problem | 14:49 | |
14:49
rindolf joined
|
|||
moritz | m: my $s = sprintf '%%s'; say "s = '$s'"; | 14:49 | |
camelia | rakudo-moar 15532d: OUTPUT«s = '%s'» | ||
TimToady | it shouldn't be looking for %s unless there are brackets on it, but apparently the %%s causes it to care for some reason | 14:50 | |
tbrowder | well, yes, single quotes do work, but what if i want to do this: | ||
TimToady | m: my $s = sprintf "\%%s"; say "s = '$s'" | 14:51 | |
camelia | rakudo-moar 15532d: OUTPUT«s = '%s'» | ||
TimToady | m: my $s = sprintf "%\%s"; say "s = '$s'" | ||
camelia | rakudo-moar 15532d: OUTPUT«s = '%s'» | ||
TimToady | m: my $s = sprintf "%%\s"; say "s = '$s'" | ||
camelia | rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unrecognized backslash sequence: '\s'at <tmp>:1------> 3my $s = sprintf "%%\7⏏5s"; say "s = '$s'" expecting any of: argument list double quotes prefix …» | ||
TimToady | heh | ||
moritz | TimToady: that's why "string parsing problem", not "user error" :-). Should have been more explicit, I guess | 14:52 | |
TimToady | wasn't contradicting you, just expanding :) | ||
tbrowder | m: my $str = 'foo'; my $s = sprintf "%%string = '$str'"; say "s = '$s'"; | 14:54 | |
camelia | rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '%string' is not declared. Did you mean 'Stringy'?at <tmp>:1------> 3my $str = 'foo'; my $s = sprintf "%7⏏5%string = '$str'"; say "s = '$s'";» | ||
tbrowder | m: my $str = 'foo'; my $s = sprintf "\%%string = '$str'"; say "s = '$s'"; | ||
camelia | rakudo-moar 15532d: OUTPUT«s = '%string = 'foo''» | ||
14:55
MilkmanD1n joined,
wamba left,
MilkmanDan left
|
|||
tbrowder | anyhow, back to DrForr's project, couldn't the parser be modded to treat sprintf format string as special cases of string parsing to eliminate some of the current backslash requirements? | 14:56 | |
moritz | tbrowder: we have lots of string formats already; why not use one of them? | 14:57 | |
tbrowder: like, if you only want backslash escapes, use q:b'...' or some such | |||
tbrowder | just looking down the road... | ||
moritz | m: printf q:b'%%s\n%%d' | ||
camelia | rakudo-moar 15532d: OUTPUT«%s%d» | ||
moritz | special-casing is much less powerful and more confusing than adverbs | 14:58 | |
tbrowder | okay, i'll be quiet for a while--thanks | ||
moritz | tbrowder: I don't mean to silence you, just trying to point out more generic things that already exist :-) | 15:00 | |
tbrowder: sorry if that came out a bit harsh | |||
15:00
Pierre_ left
15:02
cdg left
|
|||
tbrowder | moritz: i didn't take it that way, i just see p6 as so rich now with most of the stuff i lacked in p5 that i'm dreaming of more subtle itch scratching for my own use cases...probably make a module for now | 15:02 | |
15:03
zacts left
15:05
woolfy left,
woolfy joined
15:06
woolfy left
15:07
woolfy joined,
woolfy left
15:08
perlpilot_ is now known as perlpilot,
woolfy joined
|
|||
DrForr | tbrowder: Common Lisp has a very interestng (format) method, including handling nested data. | 15:09 | |
15:09
woolfy left
|
|||
tbrowder | i'm to hear suitable module names for convenience functions | 15:10 | |
15:10
woolfy joined,
perlawhirl joined
|
|||
perlawhirl | hi perlers | 15:11 | |
I can't interpolate strings as P5 regex... am i doing something wrong... or bug? | |||
m: my ($s,$p) = 'p.*','Perl'; say $p ~~ m:i/<$s>/; say $p ~~ m:i:P5/<$s>/; say $p ~~ m:i:P5/p.*/ | |||
camelia | rakudo-moar 15532d: OUTPUT«「Perl」False「Perl」» | ||
15:12
woolfy left
15:13
g4 left
15:14
woolfy joined
|
|||
timotimo | huh, is that the syntax for interpolating a string in a pcre? | 15:14 | |
15:15
woolfy left
|
|||
perlawhirl | well... for P6 Regex it's <$var>, but i'm just trying to do with a P5 regex | 15:15 | |
m:P5/$var/ doesn't work either | |||
use case: accepting regex via cmdline from a user who's only familiar with PCRE flavour of regex | 15:16 | ||
15:19
cdc joined
|
|||
perlawhirl | i also tried compiling is, ala: rx:P5/.../ but still no good | 15:19 | |
timotimo | load libpcre.so :P | ||
perlawhirl | haha | ||
yeah, i did think about it | |||
but wanted to confirm if it's a bug, if so i'll log it | 15:20 | ||
15:21
girafe joined
|
|||
tbrowder | DrForr: maybe we need a module to do clisp string formatting, is there one on cpan...there is one (Lisp::Fmt) but the license is too restrictive according to the only reviewer, and there is no lisp in the p6 modules i've been able to find | 15:23 | |
DrForr | I have a partial one in P5 :) | 15:25 | |
15:26
MetaZoffix joined
|
|||
MetaZoffix | m: my $re = ".+"; say q|<.+>| ~~ m:P5/<$re>/ | 15:27 | |
camelia | rakudo-moar 15532d: OUTPUT«「<.+>」» | ||
MetaZoffix | m: my $re = ".+"; say q|.+| ~~ m:P5/$re/ | ||
camelia | rakudo-moar 15532d: OUTPUT«「.+」» | ||
MetaZoffix | m: my $re = ".+"; say q|meow| ~~ EVAL qq|m:P5/$re/| | ||
camelia | rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>EVAL is a very dangerous function!!! (use the MONKEY-SEE-NO-EVAL pragma to override this error,but only if you're VERY sure your data contains no injection attacks)at <tmp>:1------> 3 ".+"; say q|m…» | ||
MetaZoffix | m: my $re = ".+"; say q|meow| ~~ qq|m:P5/$re/|.EVAL | ||
camelia | rakudo-moar 15532d: OUTPUT«「meow」» | ||
pmurias | tbrowder: the Perl 5 Lisp::Fmt has a licence that prevents it being used for anything | ||
MetaZoffix | So the bug seems to be just about there seemingly not being a way to use a string as a P5 regex and not a plain stirng | 15:28 | |
dalek | rl6-most-wanted: a22f699 | (Tom Browder)++ | most-wanted/modules.md: add a desired module for text processing from IRC chat with DrForr, this idea of a module was born |
||
tbrowder | pmurias: roger | 15:29 | |
DrForr | Hee. | 15:30 | |
15:30
ilmari[m] joined
|
|||
tbrowder | DrForr: you can now add it as p6 WIP and call it Lisp::Format, and I'll be glad to help | 15:31 | |
Xliff | rakudo\o | 15:32 | |
Wheee | |||
\o #perl6 | |||
rakudobrew is still broken on debian. Is there a workaround, yet? | |||
Rather, the problem isn't rakudobrew. It's debian perl with the rakudo build process. | 15:33 | ||
MetaZoffix | m: my $re = q|.{2}|; say q|.+abc| ~~ m:P5/(??{$re})/ | ||
camelia | rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling /home/camelia/EVAL_0Unsupported use of {N,M} as general quantifier; in Perl 6 please use ** N..M (or ** N..*)at /home/camelia/EVAL_0:1------> 3anon regex { .{2}7⏏5}» | ||
perlawhirl | MetaZoffix: Ahh, i see... So it's interpreting as a literal | ||
timotimo | we just need to change some use statement somewhere? | ||
MetaZoffix | Xliff: what's debian perl? (version) | ||
m: my $re = q|.+b|; say q|.+abc| ~~ m:P5/(??{$re})/ | |||
camelia | rakudo-moar 15532d: OUTPUT«「.+ab」» | ||
MetaZoffix | Xliff: and what's broken, exactly. | 15:34 | |
15:34
telex left
|
|||
moritz | fwiw hack.p6c.org runs Debian stable + rakudobrew to build the docs | 15:34 | |
perlawhirl | MetaZoffix: ok, that did the trick. nice workaround | 15:35 | |
moritz | it doesn't seem insurmountable broken, or anything :-) | ||
perlawhirl | m: my $re = 'p.+'; say 'Perl' ~~ m:i:P5/(??{$re})/ | ||
camelia | rakudo-moar 15532d: OUTPUT«「Perl」» | ||
cygx | moritz: there's an open issue about upcoming changes to @INC: github.com/MoarVM/MoarVM/issues/403 | ||
Xliff | fpaste.scsys.co.uk/533511 | ||
MetaZoffix | perlawhirl: it might not be the right workaround | 15:36 | |
Oh... | |||
MetaZoffix reads perldoc perlre | |||
perlawhirl | yeah it's not | ||
m: my $re = 'p[ea]rl'; say 'Perl' ~~ m:i:P5/(??{$re})/ | |||
camelia | rakudo-moar 15532d: OUTPUT«False» | ||
15:36
telex joined
|
|||
perlawhirl | sad face | 15:36 | |
i gotta go | |||
will backlog later | |||
15:36
perlawhirl left
|
|||
Xliff | MetaZoffix: perl 5.22.2-5 | 15:37 | |
MetaZoffix | perlawhirl: Well, it says it's compiled and used as a pattern, so I don't see why it wouldn't work. That error about P6-in-P5 may be a hint as Perl 6 parser like interferes | ||
Xliff: and what's the problem? | |||
Xliff | MetaZoffix: See the link I just pasted. | ||
MetaZoffix | ah | ||
15:38
domidumont left
|
|||
cygx | MetaZoffix: as I guessed, the problem is that . was removed from the default @INC, and build::setup will not be found | 15:38 | |
MetaZoffix | Xliff: do you still have that issue when not using rakudobrew? | 15:39 | |
cygx: I see. | |||
15:40
MetaZoffix left
|
|||
moritz | wow, I didn't even know perl defaulted to . in @INC | 15:41 | |
timotimo | yeah, that seems a bit broken | ||
Xliff | Yup | ||
15:42
zakharyas left
|
|||
moritz | anyway, pish fuxed, or something :-) | 15:42 | |
Xliff | Yeah, and unfortunately is is not as easily fixed as adding a "-I." | 15:43 | |
moritz | why not? | ||
Xliff | Doing it at the top level will not pass down to the other Configure.pl processes. | ||
moritz | ah, but a "use lib '.';' helps there | 15:44 | |
Xliff | I know this because I just tried it. | ||
timotimo | isn't this only for moarvm's configure.pl? | ||
Xliff | Lemme check. | ||
moritz | which is what I just pushed | ||
timotimo | right | ||
Xliff | Yeah. Seems to be working, now. | 15:46 | |
Finished compiling. moritz++ | 15:51 | ||
TimToady | I was not clear earlier that I consider the "%%s" thing to be a plain old bug | 15:54 | |
m: say "@@s" | 15:55 | ||
camelia | rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '@s' is not declaredat <tmp>:1------> 3say "@7⏏5@s"» | ||
TimToady | same bug | ||
a prior @ or % should not change the subsequent rules to $ parsing rules, but it is | 15:56 | ||
s:1st/rules/sigil/ | |||
SourceBaby | TimToady, Something's wrong: ERR: ===SORRY!=== Error while compiling -eUnable to parse expression in argument list; couldn't find final ')' at -e:6------> put sourcery( 1⏏st/rules/sigil/ )[1]; expecting any of: whitespace | ||
TimToady | bah | ||
SourceBaby should require a space after the : | 15:57 | ||
16:00
Pierre_ joined
16:01
djbkd joined
16:02
tadzik joined,
M-Illandan joined,
Matthew[m] joined
16:03
cdg joined
16:05
notcha joined,
Pierre_ left
16:06
SourceBaby left
16:07
SourceBaby joined
|
|||
notcha | s:1st/rules/sigil/ | 16:07 | |
s: &say | |||
SourceBaby | notcha, Sauce is at github.com/rakudo/rakudo/blob/1553...ors.pm#L20 | ||
16:07
notcha left
16:08
ab6tract left
|
|||
TimToady | unbah :) | 16:08 | |
16:14
domidumont joined
16:21
cygx left
16:29
obfusk_ left
16:30
obfusk joined
16:39
xfix left
16:40
xfix joined
16:46
wamba joined
16:48
amalia joined,
amalia is now known as Guest25635
16:49
Guest25635 left
16:58
wtw_ left,
wtw joined
17:02
Pierre_ joined
17:07
Pierre_ left
17:09
sjoshi joined
17:27
rgrinberg left
17:30
monada joined
|
|||
DrForr | m: use Test; subtest { }, Q{bug?}; | 17:31 | |
camelia | rakudo-moar 15532d: OUTPUT«Cannot resolve caller subtest(Hash, Str); none of these signatures match: (Pair $what) ($desc, &subtests) (&subtests, $desc = "") in block <unit> at <tmp> line 1» | ||
timotimo | nah | 17:32 | |
DrForr | Arguably a degenerate case, but would it make sense to add another signature? | ||
monada | m: use Test; subtest {; }, Q{bug?}; | ||
camelia | rakudo-moar 15532d: OUTPUT« 1..0ok 1 - bug?» | ||
monada | What would it be doing? You're giving it a Hash instead of a code with subtests to run. | 17:33 | |
timotimo | execute the hash :P | 17:34 | |
DrForr | It's just surprising is a. | ||
*all | |||
monada | m: map { }, ^10 | ||
camelia | rakudo-moar 15532d: OUTPUT«Cannot resolve caller map(Hash, Range); none of these signatures match: (&code, + is raw) in block <unit> at <tmp> line 1» | ||
monada | m: grep { }, ^10 | 17:35 | |
camelia | ( no output ) | ||
monada | well, the latter makes sens | ||
m: say +grep { }, { } | |||
camelia | rakudo-moar 15532d: OUTPUT«0» | ||
monada | m: my $x = { }; say +grep $x, $x | ||
camelia | rakudo-moar 15532d: OUTPUT«0» | ||
monada | :/ | ||
17:37
pierrot left
|
|||
tbrowder | assume I want to create a module to add a new method (printf) to IO::Handle, what should it b e named? IO::Handle::Printf? | 17:38 | |
DrForr | Admittedly I simply had to stare at it for a few minutes until I realied it wasn't being interpreted as I thought it would be, it's just violating the least surprise principle to me. | ||
monada | DrForr: how did you end up with an empty {} block? | 17:39 | |
DrForr | I simply wrote a test but didn't add contents yet. | 17:40 | |
monada | Ah | ||
m: 2+Any; | 17:41 | ||
camelia | rakudo-moar 15532d: OUTPUT«WARNINGS for <tmp>:Useless use of "+" in expression "2+Any" in sink context (line 1)Use of uninitialized value of type Any in numeric context in block <unit> at <tmp> line 1» | ||
tbrowder | and assume I want to create a module for adding new methods to type Str, what should it be named? Str::Extra or Str::Utils or ? | ||
monada | If I don't know what operator I'm using. Is there a way to mute warnings, without using quietly? Trying to find a cheap alternative to quietly | ||
tbrowder: you mean you're augmenting core types? | 17:42 | ||
tbrowder | of course the modules would be public so the naming needs public comment | ||
monada: yep, that's what i want to do | 17:43 | ||
DrForr | tbrowder: Forgot that I added this a while back: github.com/drforr/Text-Format-Lisp | ||
timotimo | monada: what makes you say quietly isn't cheap? | ||
monada | m: my $x; $x++ for ^1000_000; say now - INIT now; | ||
camelia | rakudo-moar 15532d: OUTPUT«0.41941525» | ||
monada | m: my $x; quietly $x++ for ^1000_000; say now - INIT now; | 17:44 | |
camelia | rakudo-moar 15532d: OUTPUT«1.3147166» | ||
timotimo | wow | ||
m: my $x; { $x++ CONTROL { .resume } } for ^1000_000; say now - INIT now | |||
camelia | rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Two terms in a rowat <tmp>:1------> 3my $x; { $x++7⏏5 CONTROL { .resume } } for ^1000_000; s expecting any of: infix infix stopper statement end sta…» | ||
tbrowder | DrForr: okay! mind if i put it in most wanted as WIP? | ||
timotimo | m: my $x; { $x++; CONTROL { .resume } } for ^1000_000; say now - INIT now | ||
camelia | rakudo-moar 15532d: OUTPUT«1.1653503» | ||
DrForr | But that's also an older version of what I have locally. Maybe I should merge what I've found in another repo. | 17:45 | |
timotimo | maybe we generate shitty code for this? | ||
monada | tbrowder: I'd go for something shorter... maybe IO::Printf ? and I'd avoid ::Utils in name as a plague. You can never rember if the name is ::Util or ::Utils | ||
DrForr | Well, it's in perl5, not 6... | ||
monada | timotimo: seems to be just a single op: github.com/rakudo/rakudo/blob/nom/....nqp#L2163 | 17:46 | |
DrForr | Maybe I'll do a quick conversion of what I have. | ||
timotimo | right. but how's the code look that generates the handler? does it become 100% inlined? | 17:47 | |
TimToady | m: my $x; quietly $x++ for ^1000_000; say now - INIT now; | 17:48 | |
camelia | rakudo-moar 15532d: OUTPUT«1.352484» | ||
TimToady | m: my $x; quietly { $x++ for ^1000_000 }; say now - INIT now; | ||
camelia | rakudo-moar 15532d: OUTPUT«0.41940168» | ||
monada | ¯\_(ツ)_/¯ wouldn't even know how to check | ||
oooo | |||
17:48
firstdayonthejob joined
|
|||
TimToady | m: my $x; quietly ( $x++ for ^1000_000 ); say now - INIT now; | 17:48 | |
camelia | rakudo-moar 15532d: OUTPUT«1.268981» | ||
monada | TimToady++ | ||
TimToady | that's very odd | ||
quietly should be outside the 'for' in any case, since it's a statement_prefix | |||
17:49
rgrinberg joined
|
|||
jnthn | I guess the blockless form makes it no longer regarded as statement list level, however | 17:50 | |
So it won't get the range loop optimization | |||
And it may even be taken as meant to produce a result list | 17:51 | ||
timotimo | i can't find anything inside the spesh log to refer to the quietly part | ||
jnthn | If we're seeing one or both of those, that'd easily explain the difference. | ||
timotimo | like, no "resume" op anywhere | ||
also, camelia is really rather noisy about timings, isn't she? | 17:52 | ||
we fell into that particular trap again :) | |||
17:52
cygx joined
|
|||
cygx | m: my $x; say (quietly $x++ for ^1000_000).^name | 17:53 | |
camelia | rakudo-moar 15532d: OUTPUT«List» | ||
timotimo | now you're just asking for it | ||
cygx | m: my $x; (quietly $x++) for ^1000_000; say now - INIT now; | 17:55 | |
camelia | rakudo-moar 15532d: OUTPUT«1.0957423» | ||
monada | m: my $x; [quietly $x++] for ^1000_000; say now - INIT now; | 17:56 | |
camelia | rakudo-moar 15532d: OUTPUT«1.60196705» | ||
17:59
robertle joined
|
|||
TimToady | jnthn: I agree, that's probably what's going on here | 17:59 | |
timotimo | m: my $x; "quietly $x++" for ^1000_000; say now - INIT now; | 18:00 | |
camelia | rakudo-moar 15532d: OUTPUT«(timeout)WARNINGS for <tmp>:Useless use of "quietly $x++" in expression "quietly $x++" in sink context (line 1)Use of uninitialized value $x of type Any in string context.Methods .^name, .perl, .gist, or .say can be used to stringify it to somethi…» | ||
timotimo | bug! "quietly" inside strings is super slow! | ||
tbrowder | monada: thanks: the reason i thought of IO::Handle::Printf is because the existing print method, as well as other output methods, are on IO::Handle | 18:02 | |
monada | m: my $x; "quietly {$x++} for ^1000_000;".EVAL; say now - INIT now; | ||
camelia | rakudo-moar 15532d: OUTPUT«WARNINGS for /home/camelia/EVAL_0:Useless use of constant integer 0 in sink context (use Nil instead to suppress this warning) (line 1)0.837581» | ||
timotimo | monada: that's cheating, you're using the block form of "quietly"! | 18:03 | |
tbrowder | monada: good idea on NOT using Utils, how about Str::Extra or Str::More or ? | ||
monada | timotimo: heh | ||
timotimo | Str::LeftPad | ||
monada | tbrowder: kinda non-descript. ::Extra what? ::More what? Is it really that generic? | 18:04 | |
18:04
firstdayonthejob left
18:06
firstdayonthejob joined,
labster joined
|
|||
tbrowder | monada: okay, then, Str::Sprintf (actually containing variant methods wrapping sprintf) | 18:08 | |
monada | cool | ||
.oO( Sprintf::Extra :) ) |
|||
tbrowder | monada: aha, you're cooking with gas! but shouldn't it be Str::Sprintf::Extra? | 18:10 | |
monada | What point does Str:: serve there? | ||
tbrowder | monada: well, sprintf is a method on Str | 18:11 | |
18:12
canopus joined
|
|||
monada | m: class Meow is Str {}.new(value => '%s').printf: 'now it is not' | 18:13 | |
camelia | rakudo-moar 15532d: OUTPUT«now it is not» | ||
monada | m: say sprintf 'and this one is a sub'; | ||
camelia | rakudo-moar 15532d: OUTPUT«and this one is a sub» | ||
18:17
FROGGS joined
18:21
geraud left
18:25
geraud joined
|
|||
TimToady is testing a likely fix for the "%%s" problem, if someone wants to rakudobug it | 18:28 | ||
18:28
labster left
18:30
cdg left
|
|||
tbrowder | m: class m is Str {}.new(value => '%s').sprintf | 18:30 | |
camelia | rakudo-moar 15532d: OUTPUT«Your printf-style directives specify 1 argument, but no argument was supplied in any at /home/camelia/rakudo-m-inst-2/share/perl6/runtime/CORE.setting.moarvm line 1 in block <unit> at <tmp> line 1» | ||
monada | m: "%%foo @@bar".say | 18:31 | |
camelia | rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '%foo' is not declaredat <tmp>:1------> 3"%7⏏5%foo @@bar".say» | ||
monada | TimToady: rt.perl.org/Ticket/Display.html?id=129257 | 18:32 | |
TimToady | > p6 '"%%foo @@bar".say' | 18:33 | |
%%foo @@bar | |||
tbrowder | m: | 18:35 | |
exit | |||
smls | TimToady: Does "foo $(2 + 2) bar" still work? | ||
For when you don't want the block scope that comes with { } | 18:36 | ||
monada | m: "foo $(say 'madness') bar" | 18:37 | |
camelia | rakudo-moar 15532d: OUTPUT«WARNINGS for <tmp>:Useless use of "foo $(say 'madness') bar" in expression "foo $(say 'madness') bar" in sink context (line 1)madness» | ||
monada | :o | ||
smls | m: sleep 1; say "Completed in $(now - ENTER now) sec" | ||
camelia | rakudo-moar 15532d: OUTPUT«Completed in 1.0017096 sec» | ||
18:37
sjoshi left
|
|||
smls | ^^ That's an example where you can't use { } in the string | 18:37 | |
mst | tbrowder: and then 'my $h = $orig_h but IO::Handle::Sprintf;' ? | 18:38 | |
Xliff | \o | ||
Any new news on this error I've run into? | |||
gist.github.com/Xliff/0f537c12b415...9484a25b1a | |||
mst is pleased to note that the 'export methods as scalars' trick works | |||
Xliff | It could be mine, but... | ||
18:38
sjoshi joined
|
|||
mst | $thing.$_imported_name(...) | 18:38 | |
<3 | |||
Xliff | mst: oooo! Details, pls? | ||
mst | Xliff: ^^ | 18:39 | |
basically, 'my $_foo = method (...) { ... };' | |||
then $obj.$_foo(...) | |||
(I use the _ to signify it's weird, ala p3rl.org/Safe::Isa) | |||
Xliff | But what's the point of $obj? | ||
mst | eh? | ||
Xliff | O. | 18:40 | |
tbrowder | mst: good point, what should it be, then? | ||
Xliff | W8. | ||
18:40
AlexDaniel joined,
Actualeyes left
|
|||
Xliff | Does $_foo have access to self? | 18:40 | |
mst | yes | ||
seems to so far | |||
Xliff | And can it be defined outside of the Class module? | ||
So "use Class; my $c = Class.new; my $_foo = method (...) { ... }; $obj.$_foo(...)" | 18:41 | ||
smls | m: my method a { self }; say 4.&a; | ||
camelia | rakudo-moar 15532d: OUTPUT«4» | ||
mst | m: my $_add = method ($inc_by) { self.map: *+$inc_by }; my @foo = ^10; @foo.$_add(3).join(' ').say | ||
camelia | rakudo-moar 15532d: OUTPUT«3 4 5 6 7 8 9 10 11 12» | ||
Xliff | And it all Just Works? | ||
mst | Xliff: ^^ | ||
smls | Xliff: methods can live in my scope ^^ | 18:42 | |
18:42
canopus left
|
|||
Xliff | OO | 18:42 | |
TimToady | monada: fixed, tests needed somewhere or other | ||
Xliff | mst++: That's wicked!!! | ||
I like | 18:43 | ||
monada | marking as such | ||
tbrowder | mst: IO::Handle::Extra or IO::Handle::Super? | ||
mst | Xliff: like I say, Safe::Isa demonstrates it in perl5, all I did was go "hmm, so, what happens if I convert this to perl6 syntax ... oh, goody" | ||
smls | Xliff: In fact, every regex is a method that lives outside a class. | ||
m: say /a/.^mro | |||
camelia | rakudo-moar 15532d: OUTPUT«((Regex) (Method) (Routine) (Block) (Code) (Any) (Mu))» | ||
mst | (note that Safe::Isa is one of my CPAN modules) | ||
tbrowder: well, I mean, I dunno. if you're just trying to add sprintf, then I'd probably do a $_sprintf ala the above trickery | 18:44 | ||
then you don't need any further cleverness | |||
if you're adding more than sprintf, what other things are you adding? | |||
dogbert17 | o/ #perl6 | 18:45 | |
18:46
canopus joined
|
|||
tbrowder | mst: i want to create at least one sprintf variant (maybe more) that append a newline to the format string, just like say's relation to print | 18:47 | |
monada | m: my method esprintf ($format) { sprintf $format, self }; say 42.&esprintf: '%d' | ||
camelia | rakudo-moar 15532d: OUTPUT«42» | ||
masak | tbrowder: and, for consistency, name it `ssayf` :P | 18:48 | |
Xliff | Can someone look at my Gist, pls? ^^ | ||
dogbert17 | dumb question of the day | ||
monada | m: sub esprintf { sprintf $^two, $^one }; say 42.&esprintf: '%d' | ||
camelia | rakudo-moar 15532d: OUTPUT«42» | ||
cygx | well, only if it calls .gist - otherwise, if should be .sputf | ||
mst | tbrowder: er, so maybe IO::Handle::FormatSugar ? | ||
TimToady | seems a fancy way to not call .fmt('%d') | ||
dogbert17 | m: say "123123".trans("23" => "", :complement) # why does the results differ between this and | ||
camelia | rakudo-moar 15532d: OUTPUT«2323» | ||
dogbert17 | m: say 123123.trans("23" => "", :complement) # this ? | ||
mst | monada: oh, hah, hadn't thought about the & form | ||
camelia | rakudo-moar 15532d: OUTPUT«11» | ||
mst | (largely because that would totally not have worked in perl5) | 18:49 | |
(well, my sub esprintf ($self, $format) { ... }; ... $obj->${\\&esprintf}(...) but ... no) | |||
masak | mst: fun fact of the & method call form -- it went *unnoticed* for months or possibly years after introducing the $obj.$method form | ||
monada | dogbert17: wild guess: we aren't passing the adverbs from Cool to Str | ||
s: 123123, 'trans', \("23" => "", :complement) | 18:50 | ||
SourceBaby | monada, Sauce is at github.com/rakudo/rakudo/blob/1553...ol.pm#L131 | ||
monada | s: '123123', 'trans', \("23" => "", :complement) | ||
mst | masak: hahahahahaha | ||
SourceBaby | monada, Sauce is at github.com/rakudo/rakudo/blob/1553...r.pm#L1554 | ||
dogbert17 | monada: you' beginning to sound like Zoffix :-) | ||
masak | mst: I don't recall who discovered it. either it was me or I wish it was. | ||
monada | dogbert17: Zoffix? | ||
grondilu | lizmat: since you've been busy improving permutations/combinations lately, may I remind you a quicker algorithm has been authorized last year. See github.com/perl6/roast/issues/79 | ||
mst | Xliff: btw, shadow.cat/blog/matt-s-trout/madnes...h-methods/ is my various lunatic perl5 tricks; perhaps some of them will prove reusable | ||
huh | 18:51 | ||
tbrowder | okay, i just want to wrap sugar around things and package it neatly for reuse, so i'll have to digest yr suggestions, thanks | ||
monada | dogbert17: wanna fix that bug? Change the *@a and @a to |c here: github.com/rakudo/rakudo/blob/1553...ol.pm#L131 | ||
dogbert17 | monada: that would be a first for me | ||
monada | \o/ | ||
TimToady | m: my $s = sprintf "%%s"; say "$s = '$s'" | 18:52 | |
camelia | rakudo-moar a9ed67: OUTPUT«%s = '%s'» | ||
TimToady | tbrowder: ^^^ | ||
mst | HAH | ||
masak: which means, logically, $() will also work so | |||
dogbert17 | monada: should I start with an RT? | ||
masak | o.O | ||
18:52
mcmillhj left
|
|||
mst | m: sub adder (Int $inc_by) { return method () { self.map: *+$inc_by } }; my @foo = ^10; @foo.$(adder(2)).join(' ').say | 18:52 | |
camelia | rakudo-moar a9ed67: OUTPUT«2 3 4 5 6 7 8 9 10 11» | ||
mst | masak: fuckin' A. | ||
masak | \o/ | ||
Xliff | mst++: Bookmarked. Thanks. | 18:53 | |
TimToady | yes, composability for the win | ||
tbrowder | TimToady: thanks! | ||
monada | dogbert17: sure. Good to have a record. | ||
mst | TimToady: $() is so much nicer than ${\} :D | ||
TimToady | well, yes, that's why we picked it :) | 18:54 | |
mst | m: class Foo { method say_hello () { say "hello" } } Foo.new.$(<say hello>.join('_')) | ||
camelia | rakudo-moar a9ed67: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Strange text after block (missing semicolon or comma?)at <tmp>:1------> 3 { method say_hello () { say "hello" } }7⏏5 Foo.new.$(<say hello>.join('_')) expecting any of: infix …» | ||
mst | m: class Foo { method say_hello () { say "hello" } }; Foo.new.$(<say hello>.join('_')) | ||
camelia | rakudo-moar a9ed67: OUTPUT«No such method 'CALL-ME' for invocant of type 'Str' in block <unit> at <tmp> line 1» | ||
mst | hrmf | 18:55 | |
18:55
ufobat left
|
|||
TimToady | it's only hard refs | 18:55 | |
we picked that too :P | |||
mst | $obj->${\join('_', qw(say hello))} would work in perl5 | ||
I was kinda fond of variants on that theme | |||
that's ok though | |||
TimToady | symbolic refs always have a different syntax in p6 | 18:56 | |
so no need for strict refs | |||
mst | I thought $obj."foo" was a thing somehow | ||
El_Che | "mst is learning perl 6. Chapter 1: the cornercases" | ||
TimToady | needs parens | ||
mst | $obj.("foo") ? | ||
TimToady | no, after | ||
mst | oh hah | ||
so $obj."foo"() is ok? | |||
TimToady | otherwise too ambiguous with ends of quoted sentences | ||
mst | m: class Foo { method say_hello () { say "hello" } }; Foo.new.$(<say hello>.join('_'))() | 18:57 | |
camelia | rakudo-moar a9ed67: OUTPUT«No such method 'CALL-ME' for invocant of type 'Str' in block <unit> at <tmp> line 1» | ||
mst | m: class Foo { method say_hello () { say "hello" } }; Foo.new."$(<say hello>.join('_'))"() | ||
camelia | rakudo-moar a9ed67: OUTPUT«hello» | ||
mst | ah, there we go. | ||
wasn't too far off :D | |||
TimToady | you can interplate with {} there too | ||
*pol | |||
mst | as in "{<say hello>.join('_')}" I guess? | 18:58 | |
dogbert17 | monada: done, rt.perl.org/Public/Bug/Display.html?id=129258 | ||
TimToady | yeah | ||
18:58
aindilis joined
|
|||
monada | dogbert17: OK, now fork Rakudo: github.com/rakudo/rakudo/ | 18:59 | |
TimToady | m: say "@@s" | ||
camelia | rakudo-moar a9ed67: OUTPUT«@@s» | ||
TimToady | m: say "@@s<>" | ||
camelia | rakudo-moar a9ed67: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '@s' is not declaredat <tmp>:1------> 3say "@7⏏5@s<>"» | ||
TimToady | m: say @@s | ||
camelia | rakudo-moar a9ed67: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '@s' is not declaredat <tmp>:1------> 3say @7⏏5@s» | ||
monada | dogbert17: then follow these steps to make the change and test it: gist.github.com/zoffixznet/444b0b8...56465ab59d | ||
TimToady | m: say "@$s" | ||
camelia | rakudo-moar a9ed67: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '$s' is not declaredat <tmp>:1------> 3say "@7⏏5$s"» | ||
TimToady | m: say "$@s" | 19:00 | |
camelia | rakudo-moar a9ed67: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '@s' is not declaredat <tmp>:1------> 3say "$7⏏5@s"» | ||
mst | El_Che: if I can't bend it at least as hard as perl5 there's not a lot of point, now is there? :D | ||
TimToady | those all seem right | ||
monada | dogbert17: and bonus points for also submitting a test for the bug into roast (I think it's explained here: perl6.party/post/Hacking-on-Rakudo-...ix#roastit ) | ||
19:00
aindilis left,
Actualeyes joined,
sjoshi left
19:01
aindilis joined
|
|||
dogbert17 | monada: I'll see what I can do | 19:01 | |
monada | dogbert17++ | ||
TimToady | the "@$s" case is not so obvious, but the @ interpolation doesn't find brackets and backtracks, so it ignores the @ and just tries to interpolate $s, which fails | ||
19:04
mcmillhj joined
|
|||
El_Che | mst: well, at least you'll get a good talk out of it? Fosdem? :) | 19:05 | |
mst | El_Che: meh, I've got a couple years' worth of talks of build system fixing to do in the mean time :D | ||
El_Che | yeah, that admin-hate part at yapce was funny | 19:06 | |
(besides the "f*, my talks is 20 minutes shorter that expected", also funny) | |||
monada | dogbert17: basically right now Cool.trans doesn't watch for :complement named arg and doesn't pass it to Str.trans. With the change I proposed... |c in signature creates a Capture named 'c' and |c in self.Str.trans(|c) slips it into the method call and so we simply shuttle the arguments to the method, without caring what they are. So this way :complement will work on both Cool and Str and so the bug is fixed. make spectest should pass a | 19:08 | |
dogbert17: If you have any trouble, ping Zoffix in #perl6-dev | 19:09 | ||
monada & | |||
19:09
monada left
19:11
mcmillhj left
19:13
canopus left,
TheLemonMan joined
19:14
mcmillhj joined,
itaipu left
19:17
geraud left
19:18
Ven joined
19:19
rindolf left,
canopus joined
19:20
domidumont left
19:21
itaipu joined
19:22
labster joined
19:43
darutoko left
19:46
andrzejku joined
19:47
cygx left
19:49
sena_kun left
19:52
wamba left
19:55
mr-foobar left
19:58
Ven left,
Ven joined,
mr-foobar joined
19:59
Ven left
20:00
Ven joined
20:05
nadim_ joined,
Ven left
20:06
CIAvash left,
Ven joined,
nadim left
20:09
rgrinberg left,
cdg joined
|
|||
lizmat | grondilu: noted the PR, will look at it after the P6W | 20:22 | |
20:23
TheLemonMan left
20:25
kaare__ left
20:33
itaipu left
20:39
andrzejku left
20:42
perlpilot left
20:44
FROGGS left
20:47
jonas2 left
20:50
woolfy joined
20:51
cpage_ left
20:54
smls left
20:56
Ven left
20:57
skids left
20:58
robertle left
21:00
devmikey joined,
devmikey left,
devmikey joined
|
|||
AlexDaniel | hehe, RT does not like 🦋 | 21:02 | |
21:02
canopus left
|
|||
El_Che | nor does my utf8 configure irc client | 21:03 | |
21:03
geraud joined
21:07
geraud left
21:10
mcmillhj left
21:16
pmurias left
21:30
kyclark left
21:31
espadrine joined,
kyclark joined
21:32
kyclark left
21:33
geraud joined
21:37
canopus joined
21:45
john51 left,
john51 joined
|
|||
dylanwh | of note, the fib example on perl6.org does little to discourage negative connotations to perl6. :( | 21:51 | |
Zoffix | dylanwh, and what negative connotations are those? :) | 21:52 | |
dylanwh | "line noise, hur hur hur" | ||
Zoffix never heard of that applied to Perl 6 | 21:53 | ||
And maybe I'm too familiar with it now, but '*+*' is kind of a give away of what's happening if you know how Fib seq is constructed | |||
Zoffix wishes those code examples were runnable | 21:54 | ||
and editable | |||
Like on perl6.party | |||
(we can use perl6.party's backend for it too). | |||
dylanwh | gist.github.com/dylanwh/382ce787b6...66372e277c | ||
Zoffix | haha :) | 21:55 | |
You gotta have your critics ;) | |||
dylanwh, what channel is that? | |||
dylanwh | a work channel | ||
21:55
RESPONDANTS joined
|
|||
Zoffix | Ah :) | 21:55 | |
dylanwh | I was a friend of mozilla today, for being friendly, so I mentioned it was because I come from perl | ||
and they only remember porting horrible releng code from perl to python | 21:56 | ||
sigh | |||
Zoffix | The Whatever Star is actually ridiculously straightforward. It's a bit jarring on first sight, but is very concise and useful. | ||
m: say (* * * * * * * * * * * * * * * * * * * * * * * * * * *)(|(^14+1)) | 21:57 | ||
camelia | rakudo-moar 22946e: OUTPUT«87178291200» | ||
Zoffix | Show them that :P | ||
dj_goku | :blinks: | ||
Zoffix | :D | ||
Here's a version with multiplication ops replaced with fancy-pants version: | 21:58 | ||
m: say (* × * × * × * × * × * × * × * × * × * × * × * × * × *)(|(^14+1)) | |||
camelia | rakudo-moar 22946e: OUTPUT«87178291200» | ||
Zoffix | And the stars signify the 14 args of to the Callable that I pass. It can be just ^14, but that includes a zero, so I shift the range by one. And I want to pass 14 args and not 1 range, so I use the | (slip operator) to slip it into the callable | 21:59 | |
21:59
RESPONDANTS left
|
|||
Zoffix | m: say ^1000 .grep: *.is-prime | 22:00 | |
camelia | rakudo-moar 22946e: OUTPUT«(2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 …» | ||
Zoffix | Here, I'm using the whatever star to create a lambda that calls .is-prime method on its argument and I grep using that, giving me all the primes | ||
m: say ^10 .map: *+* | 22:01 | ||
camelia | rakudo-moar 22946e: OUTPUT«(1 5 9 13 17)» | ||
Zoffix | Here, I'm using map to loop over 10 items, 2 at a time, returning the sums of each of two items.... | ||
m: say ^10 .pick(*) | |||
camelia | rakudo-moar 22946e: OUTPUT«(3 6 2 4 0 7 9 1 5 8)» | ||
Zoffix | Here, I'm picking a random selection from a 10-item list, using the WhateverStar to indicate that I want the same number of elements as the number of elements in the original list | 22:02 | |
m: say 1, 3, 9 … 1000 < * | |||
camelia | rakudo-moar 22946e: OUTPUT«(1 3 9 27 81 243 729 2187)» | ||
Zoffix | Here, I'm generating multiples of 3 while the current element is below 1000 | 22:03 | |
And adding up my soliloquy into one piece, you get my @fib = 0, 1, *+* ... *; that contains all Fib numbers | |||
Can also be written as my @fib = 0, 1, *+* ... ∞; | 22:04 | ||
dylanwh | Zoffix: that.. isn't going to change their mind. XD | ||
Zoffix | :) | ||
It's fine with me :) | |||
They can use whatever 20-line fib method they prefer instead 😜 | 22:05 | ||
22:06
Sgeo joined
22:08
canopus left,
girafe left
|
|||
lizmat | and another Perl 6 Weekly hits the Net: p6weekly.wordpress.com/2016/09/12/...-youtuben/ | 22:12 | |
22:13
kyclark joined
22:14
spider-mario left
|
|||
dalek | href="https://perl6.org:">perl6.org: 385c187 | (Zoffix Znet)++ | source/index.html: Change fib example to primes example |
22:16 | |
Zoffix | m: my @primes = ^∞ .grep: *.is-prime; say "1001ˢᵗ prime is @primes[1000]"; | ||
camelia | rakudo-moar 22946e: OUTPUT«1001ˢᵗ prime is 7927» | ||
Zoffix | Changed it to that. | ||
Still not the best. I think the fancy pants sequence operator is a good example | 22:17 | ||
22:19
canopus joined
22:22
aries_liuxueyang left,
devmikey left
22:25
pierrot joined
22:28
aries_liuxueyang joined
22:29
pierrot left
22:30
zacts joined
22:31
_slade_ joined
|
|||
woolfy | I LOVE YOU ALL WITH A GREAT HUGE LOVE!!! | 22:31 | |
(thought I'd mention that, haven't seen somebody say this for a while, missed it a bit) | |||
22:31
cpage_ joined
22:34
skids joined
|
|||
Zoffix | woolfy == Yaakov? :) | 22:36 | |
22:36
kyclark left
22:41
kyclark joined
22:42
TEttinger joined
22:51
nadim_ left
22:54
mcmillhj joined
22:58
pierrot joined
23:02
kyclark left
23:03
kyclark joined
|
|||
tailgate | what does | mean in a function argument list i.e. method foo(|c) | 23:08 | |
Zoffix | tailgate, a slip | 23:09 | |
tailgate, in your particular example, that looks like a slip of a capture | |||
23:09
firstdayonthejob left
|
|||
Zoffix | m: sub tunnel (|c) { say |c }; tunnel 2, "42", class {} | 23:09 | |
camelia | rakudo-moar 22946e: OUTPUT«242(<anon|67412688>)» | ||
Zoffix | ^ so it shuttles the arguments | ||
m: sub foo ($arg1, $arg2) {}; my @args = 1, 2; foo @args | 23:10 | ||
camelia | rakudo-moar 22946e: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Calling foo(Positional) will never work with declared signature ($arg1, $arg2)at <tmp>:1------> 3foo ($arg1, $arg2) {}; my @args = 1, 2; 7⏏5foo @args» | ||
Zoffix | m: sub foo ($arg1, $arg2) {}; my @args = 1, 2; foo |@args | ||
camelia | ( no output ) | ||
23:10
RabidGravy left
|
|||
Zoffix | tailgate, ^ the first version fails, because I'm passing just one arg, the @args. The second version succeeds, because I'm slipping in the items of @args in, and it has two items which get used as the two args | 23:11 | |
huggable, Slip | |||
huggable | Zoffix, A kind of List that automatically flattens into an outer container: docs.perl6.org/type/Slip | ||
Zoffix | huggable, Capture | ||
huggable | Zoffix, Argument list suitable for passing to a: docs.perl6.org/type/Capture | ||
tailgate | interesting...goes to read Slip documentation | ||
23:12
mcmillhj left
23:15
espadrine left
23:16
mcmillhj joined
|
|||
kyclark | lpaste.net/187760 This is a grammar that seems to be working, but I get back this enormous Match object. What I’d like is an array of <record>s which are hashes (or objects?) that each have an <id> and some <member>s. How can I get that? | 23:17 | |
Basically I don’t understand how things get “made”. | 23:18 | ||
Zoffix | kyclark, add .made after your .parse() call | 23:22 | |
my $result = CDHit.parse($clusters.IO.slurp, :actions(CDHit::Actions)).made | |||
m: grammar { token TOP { {make: 42} } }.parse('').made.say | 23:24 | ||
camelia | rakudo-moar 22946e: OUTPUT«(Any)» | ||
Zoffix | m: grammar { token TOP { {make 42} } }.parse('').made.say | ||
camelia | rakudo-moar 22946e: OUTPUT«42» | ||
Zoffix | kyclark, and I think the colons after your makes shouldn't be there | ||
Juerd | kyclark: I found it easier to work with grammars when I first did so, to do it without make/made | ||
m: grammar Foo { token TOP { <thing>+ }; token thing { . } }; my $r = Foo.parse("Hello, world!"); say $r<thing>.join(":") | 23:25 | ||
camelia | rakudo-moar 22946e: OUTPUT«H:e:l:l:o:,: :w:o:r:l:d:!» | ||
Zoffix | m: gist.github.com/zoffixznet/98dea19...cb8625912b | 23:26 | |
camelia | rakudo-moar 22946e: OUTPUT«Array $result = $[{:id("Cluster_5086"), :members($[{:id(Match.new(ast => "gi|317183610|gb|ADV...", list => (Match.new(ast => Any, list => (), hash => Map.new(()), orig => ">Cluster_5086\n0\t358aa, >gi|317183610|gb|ADV... at 66.76\%\n1\t361aa, >gi|315661179…» | ||
Zoffix | kyclark, ^ seems to produce something | 23:27 | |
kyclark | Yes, the Match works, but I just haven’t figured out how to iterate over the return and extract the tasty bits | ||
Juerd | m: grammar Foo { token TOP { <thing>+ }; token thing { . } }; class Foo::A { method thing ($/) { make "x" } }; my $r = Foo.parse("Hello, world!", actions => Foo::A); say $r<thing>».made.join(":") | ||
camelia | rakudo-moar 22946e: OUTPUT«x:x:x:x:x:x:x:x:x:x:x:x:x» | ||
kyclark | I’m feverishly hacking the above suggestions to understand | ||
Juerd | 'make' simply attached some data to the match object, which you can then retrieve with 'made'. But if you just want the string that was matched, simply stringify the match object itself. | 23:28 | |
23:29
bjz left
|
|||
Zoffix | kyclark, (the way I understand it). The $/ is the current Match object. You can call $/.make: $whatever (or make $whatever) to store $whatever in a Match object. You can access that $whatever from elsewhere by calling .made method. So method seq_id ($/) has the $/ for the Match object for seq_id, and by calling make you can store stuff in it and access it via .made elsewhere | 23:29 | |
Juerd | You can think of 'make $x;' as '$/.made = $x;', except the latter isn't valid :) | 23:30 | |
kyclark | lpaste.net/187760 OK, I’ve tried to fix the things you mentioned, but I feel a bit dense. I don’t get how to extract just the “Cluster_5086” string and not get the leading “>” and trailing “\n”. | 23:35 | |
The <seq_id> token can occur in two places, and both times I just want to discard the “>” | 23:36 | ||
Juerd | In your loop, you "say" the match object itself | 23:40 | |
23:40
cdg left
|
|||
Juerd | That stringifies to the matched string. To get what you stored with "make", use "$record<id>.made" instead of "$record<id>" | 23:40 | |
Zoffix | m: gist.github.com/zoffixznet/887cd4f...4f3b9511dd | 23:41 | |
camelia | rakudo-moar 22946e: OUTPUT«Str $result = "Cluster_5086"» | ||
Juerd | Likewise, in method id, you use $<seq_id>, ignoring what you made with "make", so you should use "$<seq_id>.made" there as well. | ||
And I think you should think about the names for your tokens. For example, you have "id" which then calls "<seq_id>", but you don't have id's made of seq_id's, I think. I don't know the right terminology for whatever you're doing, but perhaps a name like id_header would be more appropriate instead of id. | 23:44 | ||
23:46
aries_liuxueyang left
|
|||
kyclark | Wow, all this is great. Thanks Zoffix and Juerd! | 23:46 | |
23:49
aa__ joined
23:50
aa__ left
|
|||
Juerd | And it feels like those ">Cluster_123123" and ">gi|..." are so much different, it's unlikely they're actually the same type of data | 23:50 | |
Also, I think the > is probably not part of the data, so should be outside the tokens | 23:51 | ||
23:52
mcmillhj left
|
|||
kyclark | The “>” is a vestige from the FASTA format. It is not part of the sequence ID, but there is no standard for what is a sequence ID. It might be “p53” or it might be “gi|1847472|…” | 23:52 | |
Juerd | I understand, but I think you should have '>' <seq_id> | ||
kyclark | The great thing about standards is that there are so many to choose from. :-) | ||
Juerd | Instead of having > in the definition of seq_id | ||
That way, seq_id itself purely matches the thing that is the id, without the delimiter > | 23:53 | ||
kyclark | I was thinking Perl would see a string in word boundaries and parse the whole thing but only give me the capture with $/[0] | 23:54 | |
Dang, I have to go, but I | |||
I’ll study on this for a while. Thanks, again! | |||
23:54
kyclark left
|
|||
Juerd | Oh, they left. Darn, just refactored the thing :) | 23:56 | |
lpaste.net/192201 | |||
23:56
aries_liuxueyang joined
|