Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2016-09-12

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:07 MilkmanDan joined #perl6
00:21 itaipu joined #perl6
00:55 MilkmanDan joined #perl6
01:08 FROGGS_ joined #perl6
01:10 awwaiid mmm. I think not directly, but maybe something else can be used to create it. Not sure
01:23 kalkin-_ joined #perl6
01:28 Actualeyes joined #perl6
01:30 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 canopus joined #perl6
01:30 TimToady we have delimited continuations internally, but we hide continuations from mere mortals
01:33 poohman joined #perl6
01:35 MasterDuke i've always thought of racket as the most Perlish of the the Schemes, with its batteries included kind of approach
01:35 MasterDuke which might explain why i liked it so much
01:36 MasterDuke so i find it kind of interesting that Perl 6 doesn't take much from it
01:36 MasterDuke is that intentional?
01:37 rgrinberg joined #perl6
01:38 TimToady it's just convergent evolution, I suspect
01:39 TimToady driven by similar goals of being a metalanguage for other languages
01:39 labster joined #perl6
01:39 sQuEE joined #perl6
01:42 wbill joined #perl6
01:47 ilbot3 joined #perl6
01:47 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
01:48 canopus joined #perl6
01:54 bob777 joined #perl6
01:58 wamba joined #perl6
02:03 bpmedley joined #perl6
02:18 AlexDaniel is there any way to get a list of arguments inside a subroutine?
02:18 AlexDaniel I mean, I want this:
02:18 AlexDaniel m: sub foo(*@args) { say @args }; foo(42, ‘hello’)
02:18 camelia rakudo-moar 04af57: OUTPUT«[42 hello]␤»
02:18 AlexDaniel but like this:
02:18 AlexDaniel m: sub foo($foo, $bar) { say @args }; foo(42, ‘hello’)
02:18 camelia rakudo-moar 04af57: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '@args' is not declared␤at <tmp>:1␤------> 3sub foo($foo, $bar) { say 7⏏5@args }; foo(42, ‘hello’)␤»
02:19 AlexDaniel without doing this:
02:19 AlexDaniel m: sub foo(*@args) { my ($foo, $bar) = @args; say @args; say $foo; say $bar }; foo(42, ‘hello’)
02:19 camelia rakudo-moar 04af57: OUTPUT«[42 hello]␤42␤hello␤»
02:27 noganex_ joined #perl6
02:28 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 signature␤at <tmp>:1␤------> 3sub7⏏5 foo($foo, $bar) { say @_ }; foo(42, ‘he␤»
02:28 MasterDuke interesting, i'd never seen that error before
02:29 AlexDaniel what does it mean?
02:30 geekosaur @_ is not always generated like it is in perl 5, it is generated for default signatures only
02:30 geekosaur if you use them with a real signature yu should get that error (which probably ought to be like the p5 warnings)
02:30 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
02:31 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 #perl6
02:33 AlexDaniel b2gills: nice! Lovely! What about named arguments?
02:34 Pierre_ joined #perl6
02:35 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 #perl6
02:39 geekosaur that should work for *%_ / %_ as well
02:39 geekosaur (slurpy for named parameters)
02:40 AlexDaniel b2gills: thank you!
02:55 bjz joined #perl6
03:03 TEttinger joined #perl6
03:25 kyclark_ joined #perl6
03:47 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:58 TimToady skids: hash values are kept in a scalar container
04:00 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: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␤␤»
04:00 TimToady innersting
04:01 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])␤»
04:01 skids Yeah, it makes sense what is going on, but makes things difficult.
04:02 TimToady arguably, |@d should turn pairs into named args
04:03 TimToady unless that's a feature...
04:03 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:03 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␤␤»
04:03 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
04:03 camelia rakudo-moar 04af57: OUTPUT«[foo => (1 2 3)]␤A.new(foo => [1, 2, 3])␤A.new(foo => [1, 2, 3])␤»
04:03 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:03 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␤␤»
04:04 TimToady seems like a bit of a can't-get-there-from-here though
04:05 skids right.  You can build a nonscalarized hash with := but... that's real ugly.
04:07 skids 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
04:07 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␤␤»
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(|$d).perl.say
04:07 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])␤»
04:08 TimToady a capture object is probably the best way to indirect multiple named args currently
04:10 poohman joined #perl6
04:22 AngeloMichael left #perl6
04:22 poohman joined #perl6
04:28 perlawhirl joined #perl6
04:29 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:36 MilkmanDan joined #perl6
04:37 grondilu joined #perl6
04:55 wamba joined #perl6
05:03 Cabanossi joined #perl6
05:24 bob777 joined #perl6
05:30 domidumont joined #perl6
05:31 djbkd joined #perl6
05:35 domidumont joined #perl6
05:37 CIAvash joined #perl6
05:40 itaipu joined #perl6
05:55 bob777 joined #perl6
05:59 brrt joined #perl6
06:03 itaipu joined #perl6
06:04 djbkd joined #perl6
06:04 labster joined #perl6
06:23 nadim joined #perl6
06:24 domidumont joined #perl6
06:25 firstdayonthejob joined #perl6
06:26 nebuchadnezzar joined #perl6
06:33 wamba joined #perl6
06:34 domidumont joined #perl6
06:45 imcsk8 hello, is there a loop control statement like "continue"?
06:46 lizmat next?
06:46 lizmat last?
06:46 lizmat redo?
06:46 lizmat not sure what you mean by "continue"
06:46 imcsk8 oh its next, thanks!
06:47 lizmat yw  :)
06:49 geekosaur continue is what C calls next
06:49 geekosaur (and C++ and Java)
06:49 geekosaur not perl5's continue block
06:50 geekosaur er, for clarity: what they call perl's next
07:06 perlawhirl btw... just wanted to say...
07:07 perlawhirl lizmat++ for the awesome performance gains on permutations
07:12 Pierre_ joined #perl6
07:17 darutoko joined #perl6
07:19 ufobat joined #perl6
07:40 zakharyas joined #perl6
07:48 Pierre_ joined #perl6
07:54 pierrot joined #perl6
07:56 RabidGravy joined #perl6
08:00 Psy-Q left #perl6
08:03 arnsholt At least most languages have *either* continue or next
08:03 arnsholt Except AWK which has both
08:04 araujo joined #perl6
08:04 jonas2 joined #perl6
08:04 moritz continext
08:05 aries_liuxueyang joined #perl6
08:05 arnsholt =D
08:06 arnsholt In AWK continue is loop control for "normal" loops, while next is loop control for the implicit loop over records
08:08 araujo_ joined #perl6
08:09 xiaomiao joined #perl6
08:09 g4 joined #perl6
08:10 ab6tract joined #perl6
08:13 * [Coke] waves from Leeds
08:14 El_Che Leeds
08:14 El_Che how exotic :)
08:15 El_Che aren't you US-based?
08:18 [Coke] aye
08:18 [Coke] dublin yesterday, leeds for 3 days, then back to the us
08:18 El_Che hollidays?
08:18 stigo joined #perl6
08:20 DrForr Be on the lookout for vampires :)
08:20 El_Che DrForr: vampires is more your neighbourhood thing, isn't?
08:21 DrForr Someone's not read Stross' latest :)
08:22 [Coke] no, business.
08:23 [Coke] (people go to leeds for pleasure?)
08:24 kim1599 joined #perl6
08:25 El_Che [Coke]: be nice to the locals, you're not yet out of the woods
08:28 [Coke] :)
08:28 [Coke] I've been here several times for work, doesn't look like much has changed. :)
08:28 pdcawley joined #perl6
08:29 bjz_ joined #perl6
08:32 gfldex joined #perl6
08:39 El_Che so Leeds, are you into wool? :)
08:40 [Coke] It's financial-adjacent.
08:47 bjz joined #perl6
08:48 arnsholt DrForr: Vampires? Invading space-elves on FCl_3-belching dragons, more like =p
08:48 DrForr Well, that too, yes :)
08:52 arnsholt No wait, it's ClF_3 =D
08:53 arnsholt Chlorine trifluoride
08:58 moritz sounds like a nasty component :-)
08:58 moritz or compound, rather
09:03 DrForr Just about the strongest oxidizer known to man.
09:09 user9 joined #perl6
09:14 Pierre_ joined #perl6
09:20 pierrot joined #perl6
09:21 wamba m: my $a=True but role { method Bool {False} }; say $a
09:21 camelia rakudo-moar 137917: OUTPUT«False␤»
09:24 denis38 joined #perl6
09:28 eliasr joined #perl6
09:38 Actualeyes joined #perl6
09:38 arnsholt moritz: http://blogs.sciencemag.org/pipeline/archiv​es/2008/02/26/sand_wont_save_you_this_time
09:40 arnsholt It sounds pretty damn scary
09:43 moritz arnsholt: and to put things into perspective, I'm too scared to deal with HF or F_2 myself :-)
09:44 moritz 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! =)
09:44 arnsholt 10:52 < arnsholt> No wait, it's ClF_3 =D
09:44 arnsholt http://blogs.sciencemag.org/pipeline/ar​chives/2004/03/03/things_i_wont_touch_1
09:46 arnsholt ISTR there being an article recounting all the chemists who managed to kill themselves trying to isolate F_2 as well
09:46 arnsholt (There being a very large number of casualties due to that particular effort)
09:55 DrForr I was involved in a debate over ClF_3 vs. F_2O_2 at YAPC :)
10:00 stmuk_ I think I was on that table!
10:03 DrForr Wouldn't surprise me.
10:04 user9 joined #perl6
10:07 Zoffix joined #perl6
10:07 Zoffix New blog post "Perl 6 Core Hacking: Grammatical Babble": http://perl6.party/post/Perl-6-​Core-Hacking-Grammatical-Babble
10:10 Zoffix And those inspired to do some core hacking, check out our selection of bugs to fix: http://perl6.fail/
10:11 lizmat wow
10:27 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! http://www.meetup.com/Toronto-​Perl-Mongers/events/233588645/
10:28 Pierre_ joined #perl6
10:44 stmuk_ Zoffix: is it possible to add "testneeded" to your perl6.fail tag cloud?
10:45 Zoffix buggable, tag TESTNEEDED
10:45 buggable Zoffix, There are no tickets tagged with TESTNEEDED
10:45 Zoffix stmuk_, ^ that's accurate. I took care of them all on the weekend
10:46 stmuk_ :O
10:46 stmuk_ Zoffix++
10:53 kaare__ joined #perl6
10:56 smls joined #perl6
10:56 moritz Zoffix++
10:59 timotimo \o/
10:59 Pierre_ joined #perl6
11:03 stmuk_ Zoffix: status "deleted" tickets are visible (eg. RT#129226)
11:03 synopsebot6 Link:  https://rt.perl.org/rt3//Publ​ic/Bug/Display.html?id=129226
11:14 wamba joined #perl6
11:21 smls Is there any way to dublicate an IO::Pipe in order to feed it into the STDIN of two separate commands?
11:22 smls Like the `tee` command on Linux.
11:23 smls 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"
11:24 smls feed it how?
11:24 smls m: say IO::Pipe.new.print: "foo";
11:24 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␤␤»
11:24 stmuk_ I think RT#126840 can be closed
11:24 synopsebot6 Link:  https://rt.perl.org/rt3//Publ​ic/Bug/Display.html?id=126840
11:27 timotimo smls: yes, send the data into the pipe
11:28 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:29 smls It may not be possible to manually open a pipe at all.
11:30 timotimo yeah, IO::Pipe.new may want to explode instead
11:30 timotimo or do something like mkfifo
11:30 timotimo but when you run a process you can just use the pipe it creates for you
11:32 smls how can I get a writable pipe to its STDIN?
11:33 smls This exits without printing anything:
11:33 smls my $p = run "echo", :in;  $p.in.print: "Hello";
11:34 [ptc] joined #perl6
11:35 timotimo 1) use cat instead of echo
11:35 timotimo 2) don't forget to close the pipe
11:35 timotimo 3) might have to wait for the process to exit before exiting your own script
11:38 smls Ah, thanks!
11:42 bob777 joined #perl6
11:49 BenGoldberg joined #perl6
11:56 smls_ joined #perl6
12:00 aries_liuxueyang joined #perl6
12:06 poohman_ joined #perl6
12:06 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: https://gist.github.com/tbrowder/​fecfedbe4d1524ca6f2373655477a542
12:07 tbrowder a belated good morning (CDT), #perl6!
12:09 [Coke] happy lunch time is over.
12:14 DrForr Afternoon.
12:15 DrForr tbrowder: Did my comment on reddit (yes, I've finally joined) make sense?
12:15 El_Che maven & docker builds. Feel my pain
12:16 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 #perl6
12:17 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
12:17 El_Che something broke that day
12:19 tbrowder DrForr: oh, you're talking about module Perl::Tidy?
12:19 DrForr Yeah.
12:20 timotimo RabidGravy: i hope you find some time to spend for perl6 between all that tweeting :)
12:22 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:24 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:31 El_Che DrForr: we like to complain
12:31 El_Che :)
12:31 El_Che DrForr: I think the most important function is code formatting, so teams can format they code on a uniform way
12:32 El_Che DrForr: best practices is such a moving target
12:32 El_Che DrForr: inside-out objects! :)
12:32 DrForr We barely have targets, much less moving targets.
12:33 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 #perl6
12:34 DrForr I'm thinking of the long game.
12:39 tbrowder DrForr: I finally found yr comments!  And yes, to me, the comments make sense.  Thanks again for yr efforts.
12:40 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 #perl6
12:45 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?
12:45 yoleaux 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?
12:47 pmurias [Coke]: src/vm/js/Operations.nqp:533
12:51 itaipu joined #perl6
12:57 tzimisces joined #perl6
12:59 rgrinberg joined #perl6
13:00 mcmillhj joined #perl6
13:03 cdg joined #perl6
13:05 AlexDaniel joined #perl6
13:08 [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 #perl6
13:18 kyclark_ joined #perl6
13:19 spider-mario joined #perl6
13:28 pmurias [Coke]: should be fairly easy to implement
13:35 MilkmanDan joined #perl6
13:36 pmurias [Coke]: what are you using the list of implemented ops for?
13:39 Pierre_ m: class c { multi method a(Int $i) { say $i}; multi a(Str $s) { say $s } }
13:39 camelia rakudo-moar 9d1a08: ( no output )
13:39 Pierre_ m: class c { multi method !a(Int $i) { say $i}; multi !a(Str $s) { say $s } }
13:39 camelia rakudo-moar 9d1a08: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Private multi-methods are not supported␤at <tmp>:1␤------> 3class c { multi method7⏏5 !a(Int $i) { say $i}; multi !a(Str $s) ␤»
13:41 Pierre_ is it not supported yet, or it will never get supported
13:43 jnthn "Not yet"; I expect it will be added in a future Perl 6 language version.
13:43 jnthn It's not impossible, just some design/impl effort to make it happen
13:46 Pierre_ ok, makes sense
13:46 Pierre_ i will just not "document" the multi method that should not be seen
13:55 mcmillhj joined #perl6
13:57 kyclark_ I’m trying to learn Grammars, so I have this sort of working: http://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
13:58 [Coke] right now, that test greps source code to try to guess.
13:59 DrForr kyclark_: I just use 'make' on its own, the $/ is implicit in general.
14:00 kyclark_ I suspected that but was not sure.  Thanks.
14:00 DrForr so line 12: 'make $<record>>>.made'
14:00 kyclark_ Yeah, that’s a guess...
14:00 kyclark_ Since “record” will be plural as will <member>
14:01 kyclark_ What I’d like is an array or <record>s, and each will have one <id> and one or more <member>s
14:02 Khisanth joined #perl6
14:04 DrForr Also, I'd break line 6 down a bit more, so \d+ => <integer> and such.
14:05 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.
14:05 DrForr (line 4)
14:05 kyclark_ Should that be ^^ or just lose it?
14:05 DrForr Just drop it.
14:06 DrForr ^ means the start of the string, so it'll never advance beyond the first <token>
14:09 DrForr 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.
14:10 DrForr I'd personally break down lines into:
14:11 DrForr <int> <id> <gi-thing> 'at' <pct>, because you'll need those for other format variants.
14:11 kyclark_ Great, now it parses two records.
14:11 DrForr That also means that lines 25-28 can have names instead of match indexes,makes your expression clearer.
14:12 kyclark_ This is better?
14:12 kyclark_ http://lpaste.net/187760
14:12 Pierre_ joined #perl6
14:13 DrForr I'd probably also drop the anchors around #4.
14:13 DrForr 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
14:15 kyclark_ Right, I could do better with <pct>: http://lpaste.net/187760
14:16 wamba joined #perl6
14:17 tbrowder timotimo: the DrForr reddit link is here: https://www.reddit.com/r/perl6/comments/4spj7c​/perl6tidy_a_tidierformatter_for_perl_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?
14:17 DrForr Looks better on the action side.
14:18 DrForr Oh. CDHit.parse(...).ast
14:18 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:20 itaipu joined #perl6
14:21 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 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
14:21 mst an error to stderr sounds like a warn
14:22 DrForr tbrowder: Yeah, thanks. The whitespace stuff is like being licked to death by camels.
14:23 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.
14:24 AlexDaniel “Internal error: zeroed target thread ID in work pass” :'(
14:24 AlexDaniel .seen Skarsnik
14:24 yoleaux I saw Skarsnik 27 Aug 2016 00:01Z in #perl6: <Skarsnik> probably a bug
14:25 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 ;)
14:26 mst I *believe* that the 'require' version for perl6 should be CATCHable
14:26 cygx joined #perl6
14:26 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 #perl6
14:26 sena_kun
14:27 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
14:27 cygx not sure why it doesn't work with camelia
14:29 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»
14:29 AlexDaniel committable6: releases use MASTOPs:from<NQP>; MAST::Ops::<%codes>.say
14:29 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»
14:29 arnsholt m: use MASTOps:from<NQP>; MAST::Ops::<%codes>.say # What about this?
14:29 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…»
14:31 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 khw joined #perl6
14:32 cygx arnsholt++ # curse you, case-insensitive file system!
14:34 Pierre_ Any good source to start to play with Native Call?
14:35 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
14:36 [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?...
14:36 Pierre_ ok, i'll check that
14:37 tbrowder DrForr: i'm not sure about using %% in the last case--haven't tried that, but i will
14:39 tbrowder 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($_) }
14:39 camelia nqp-moarvm: OUTPUT«flattenropes␤param_on2_s␤decodertakeallch​ars␤asyncudp␤islist␤hllizefor␤newexception␤ctxca​llerskipthunks␤spawnprocasync␤sp_p6ogetvc_o␤atpo​s3d_s␤prof_allocated␤freelib␤sp_get_i64␤indexat␤​getstderr␤semacquire␤strtocodes␤sp_deref_ge…»
14:39 cygx [Coke]: ^^
14:40 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
14:40 moritz RT #129252
14:40 synopsebot6 Link:  https://rt.perl.org/rt3//Publ​ic/Bug/Display.html?id=129252
14:40 moritz since there didn't seem to be much support for the idea, and good alternatives are available
14:40 cygx [Coke]: you might want to filter out the spesh stuff
14:41 Pierre_ Actually, the docs are not too bad, i should jsut have checked https://docs.perl6.org/language/nativecall first
14:42 Pierre_ with the link to https://github.com/jnthn/zavolaj
14:42 Pierre_ it's pretty good :)
14:44 [Coke] cygx++
14:46 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'"␤»
14:47 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 #perl6
14:47 tbrowder m: my $s = sprintf "\%\%s"; say "s = '$s'"
14:47 camelia rakudo-moar 15532d: OUTPUT«s = '%s'␤»
14:48 tbrowder DrForr: another sprintf parse problem IMHO, thanks
14:48 araujo joined #perl6
14:49 moritz no, a string parsing problem
14:49 rindolf joined #perl6
14:49 moritz m: my $s = sprintf '%%s'; say "s = '$s'";
14:49 camelia rakudo-moar 15532d: OUTPUT«s = '%s'␤»
14:50 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:
14:51 TimToady m: my $s = sprintf "\%%s"; say "s = '$s'"
14:51 camelia rakudo-moar 15532d: OUTPUT«s = '%s'␤»
14:51 TimToady m: my $s = sprintf "%\%s"; say "s = '$s'"
14:51 camelia rakudo-moar 15532d: OUTPUT«s = '%s'␤»
14:51 TimToady m: my $s = sprintf "%%\s"; say "s = '$s'"
14:51 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␤      …»
14:51 TimToady heh
14:52 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 :)
14:54 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'";␤»
14:54 tbrowder m: my $str = 'foo'; my $s = sprintf  "\%%string =  '$str'"; say "s = '$s'";
14:54 camelia rakudo-moar 15532d: OUTPUT«s = '%string =  'foo''␤»
14:55 MilkmanD1n joined #perl6
14:56 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:57 moritz tbrowder: we have lots of string formats already; why not use one of them?
14:57 moritz tbrowder: like, if you only want backslash escapes, use q:b'...' or some such
14:57 tbrowder just looking down the road...
14:57 moritz m: printf q:b'%%s\n%%d'
14:57 camelia rakudo-moar 15532d: OUTPUT«%s␤%d»
14:58 moritz special-casing is much less powerful and more confusing than adverbs
14:58 tbrowder okay, i'll be quiet for a while--thanks
14:59 moritz tbrowder: I don't mean to silence you, just trying to point out more generic things that already exist :-)
15:00 moritz tbrowder: sorry if that came out a bit harsh
15:02 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:05 woolfy joined #perl6
15:07 woolfy joined #perl6
15:08 woolfy joined #perl6
15:09 DrForr tbrowder: Common Lisp has a very interestng (format) method, including handling nested data.
15:10 tbrowder i'm to hear suitable module names for convenience functions
15:10 woolfy joined #perl6
15:10 perlawhirl joined #perl6
15:11 perlawhirl hi perlers
15:11 perlawhirl I can't interpolate strings as P5 regex... am i doing something wrong... or bug?
15:11 perlawhirl m: my ($s,$p) = 'p.*','Perl'; say $p ~~ m:i/<$s>/; say $p ~~ m:i:P5/<$s>/; say $p ~~ m:i:P5/p.*/
15:11 camelia rakudo-moar 15532d: OUTPUT«「Perl」␤False␤「Perl」␤»
15:14 woolfy joined #perl6
15:14 timotimo huh, is that the syntax for interpolating a string in a pcre?
15:15 perlawhirl well... for P6 Regex it's <$var>, but i'm just trying to do with a P5 regex
15:15 perlawhirl m:P5/$var/ doesn't work either
15:16 perlawhirl use case: accepting regex via cmdline from a user who's only familiar with PCRE flavour of regex
15:19 cdc joined #perl6
15:19 perlawhirl i also tried compiling is, ala: rx:P5/.../ but still no good
15:19 timotimo load libpcre.so :P
15:19 perlawhirl haha
15:19 perlawhirl yeah, i did think about it
15:20 perlawhirl but wanted to confirm if it's a bug, if so i'll log it
15:21 girafe joined #perl6
15:23 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:25 DrForr I have a partial one in P5 :)
15:26 MetaZoffix joined #perl6
15:27 MetaZoffix m: my $re = ".+"; say q|<.+>| ~~ m:P5/<$re>/
15:27 camelia rakudo-moar 15532d: OUTPUT«「<.+>」␤»
15:27 MetaZoffix m: my $re = ".+"; say q|.+| ~~ m:P5/$re/
15:27 camelia rakudo-moar 15532d: OUTPUT«「.+」␤»
15:27 MetaZoffix m: my $re = ".+"; say q|meow| ~~ EVAL qq|m:P5/$re/|
15:27 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…»
15:27 MetaZoffix m: my $re = ".+"; say q|meow| ~~ qq|m:P5/$re/|.EVAL
15:27 camelia rakudo-moar 15532d: OUTPUT«「meow」␤»
15:27 pmurias tbrowder: the Perl 5 Lisp::Fmt has a licence that prevents it being used for anything
15:28 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 perl6-most-wanted: a22f699 | (Tom Browder)++ | most-wanted/modules.md:
15:28 dalek perl6-most-wanted: add a desired module for text processing
15:28 dalek perl6-most-wanted:
15:28 dalek perl6-most-wanted: from IRC chat with DrForr, this idea of a module was born
15:28 dalek perl6-most-wanted: review: https://github.com/perl6/perl6​-most-wanted/commit/a22f6999e9
15:29 tbrowder pmurias: roger
15:29 DrForr Hee.
15:30 ilmari[m] joined #perl6
15:31 tbrowder DrForr: you can now add it as p6 WIP and call it Lisp::Format, and I'll be glad to help
15:32 Xliff rakudo\o
15:32 Xliff Wheee
15:32 Xliff \o #perl6
15:32 Xliff rakudobrew is still broken on debian. Is there a workaround, yet?
15:33 Xliff 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})/
15:33 camelia rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling /home/camelia/EVAL_0␤Unsupported 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}␤»
15:33 perlawhirl MetaZoffix: Ahh, i see... So it's interpreting as a literal
15:33 timotimo we just need to change some use statement somewhere?
15:33 MetaZoffix Xliff: what's debian perl? (version)
15:33 MetaZoffix m: my $re = q|.+b|; say q|.+abc| ~~ m:P5/(??{$re})/
15:33 camelia rakudo-moar 15532d: OUTPUT«「.+ab」␤»
15:34 MetaZoffix Xliff: and what's broken, exactly.
15:34 moritz fwiw hack.p6c.org runs Debian stable + rakudobrew to build the docs
15:35 perlawhirl MetaZoffix: ok, that did the trick. nice workaround
15:35 moritz it doesn't seem insurmountable broken, or anything :-)
15:35 perlawhirl m: my $re = 'p.+'; say 'Perl' ~~ m:i:P5/(??{$re})/
15:35 camelia rakudo-moar 15532d: OUTPUT«「Perl」␤»
15:35 cygx moritz: there's an open issue about upcoming changes to @INC: https://github.com/MoarVM/MoarVM/issues/403
15:35 Xliff http://fpaste.scsys.co.uk/533511
15:35 MetaZoffix perlawhirl: it might not be the right workaround
15:36 MetaZoffix Oh...
15:36 * MetaZoffix reads perldoc perlre
15:36 perlawhirl yeah it's not
15:36 perlawhirl m: my $re = 'p[ea]rl'; say 'Perl' ~~ m:i:P5/(??{$re})/
15:36 camelia rakudo-moar 15532d: OUTPUT«False␤»
15:36 telex joined #perl6
15:36 perlawhirl sad face
15:36 perlawhirl i gotta go
15:36 perlawhirl will backlog later
15:37 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
15:37 MetaZoffix Xliff: and what's the problem?
15:37 Xliff MetaZoffix: See the link I just pasted.
15:37 MetaZoffix ah
15:38 cygx MetaZoffix: as I guessed, the problem is that . was removed from the default @INC, and build::setup will not be found
15:39 MetaZoffix Xliff: do you still have that issue when not using rakudobrew?
15:39 MetaZoffix cygx: I see.
15:41 moritz wow, I didn't even know perl defaulted to . in @INC
15:41 timotimo yeah, that seems a bit broken
15:41 Xliff Yup
15:42 moritz anyway, pish fuxed, or something :-)
15:43 Xliff Yeah, and unfortunately is is not as easily fixed as adding a "-I."
15:43 moritz why not?
15:43 Xliff Doing it at the top level will not pass down to the other Configure.pl processes.
15:44 moritz ah, but a "use lib '.';' helps there
15:44 Xliff I know this because I just tried it.
15:44 timotimo isn't this only for moarvm's configure.pl?
15:44 Xliff Lemme check.
15:44 moritz which is what I just pushed
15:44 timotimo right
15:46 Xliff Yeah. Seems to be working, now.
15:51 Xliff Finished compiling. moritz++
15:54 TimToady I was not clear earlier that I consider the "%%s" thing to be a plain old bug
15:55 TimToady m: say "@@s"
15:55 camelia rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '@s' is not declared␤at <tmp>:1␤------> 3say "@7⏏5@s"␤»
15:55 TimToady same bug
15:56 TimToady a prior @ or % should not change the subsequent rules to $ parsing rules, but it is
15:56 TimToady s:1st/rules/sigil/
15:56 SourceBaby TimToady, Something's wrong: â�¤ERR: [31m===[0mSORRY![31m===[0m Error while compiling -eâ�¤Unable to parse expression in argument list; couldn't find final ')' â�¤at -e:6â�¤------> [32m    put sourcery( 1[33mâ��[31mst/rules/sigil/ )[1];[0mâ�¤    expecting any of:â�¤        whitespaceâ�¤
15:56 TimToady bah
15:57 TimToady SourceBaby should require a space after the :
16:00 Pierre_ joined #perl6
16:01 djbkd joined #perl6
16:02 tadzik joined #perl6
16:02 M-Illandan joined #perl6
16:02 Matthew[m] joined #perl6
16:03 cdg joined #perl6
16:05 notcha joined #perl6
16:07 SourceBaby joined #perl6
16:07 notcha s:1st/rules/sigil/
16:07 notcha s: &say
16:07 SourceBaby notcha, Sauce is at https://github.com/rakudo/rakudo/blob​/15532db/src/core/io_operators.pm#L20
16:08 TimToady unbah :)
16:14 domidumont joined #perl6
16:30 obfusk joined #perl6
16:40 xfix joined #perl6
16:46 wamba joined #perl6
16:48 amalia joined #perl6
16:58 wtw joined #perl6
17:02 Pierre_ joined #perl6
17:09 sjoshi joined #perl6
17:30 monada joined #perl6
17:31 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␤␤»
17:32 timotimo nah
17:32 DrForr Arguably a degenerate case, but would it make sense to add another signature?
17:32 monada m: use Test; subtest {; }, Q{bug?};
17:32 camelia rakudo-moar 15532d: OUTPUT«    1..0␤ok 1 - bug?␤»
17:33 monada What would it be doing? You're giving it a Hash instead of a code with subtests to run.
17:34 timotimo execute the hash :P
17:34 DrForr It's just surprising is a.
17:34 DrForr *all
17:34 monada m: map { }, ^10
17:34 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␤␤»
17:35 monada m: grep { }, ^10
17:35 camelia rakudo-moar 15532d: ( no output )
17:35 monada well, the latter makes sens
17:35 monada m: say +grep { }, { }
17:35 camelia rakudo-moar 15532d: OUTPUT«0␤»
17:35 monada m: my $x = { }; say +grep $x, $x
17:35 camelia rakudo-moar 15532d: OUTPUT«0␤»
17:35 monada :/
17:38 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.
17:39 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
17:41 monada 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␤»
17:41 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 ?
17:41 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
17:41 monada tbrowder: you mean you're augmenting core types?
17:42 tbrowder of course the modules would be public so the naming needs public comment
17:43 tbrowder monada: yep, that's what i want to do
17:43 DrForr tbrowder: Forgot that I added this a while back: https://github.com/drforr/Text-Format-Lisp
17:43 timotimo monada: what makes you say quietly isn't cheap?
17:43 monada m: my $x;  $x++ for ^1000_000; say now - INIT now;
17:43 camelia rakudo-moar 15532d: OUTPUT«0.41941525␤»
17:44 monada m: my $x;  quietly $x++ for ^1000_000; say now - INIT now;
17:44 camelia rakudo-moar 15532d: OUTPUT«1.3147166␤»
17:44 timotimo wow
17:44 timotimo m: my $x; { $x++  CONTROL { .resume } } for ^1000_000; say now - INIT now
17:44 camelia rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3my $x; { $x++7⏏5  CONTROL { .resume } } for ^1000_000; s␤    expecting any of:␤        infix␤        infix stopper␤        statement end␤        sta…»
17:44 tbrowder DrForr: okay!  mind if i put it in most wanted as WIP?
17:44 timotimo m: my $x; { $x++; CONTROL { .resume } } for ^1000_000; say now - INIT now
17:44 camelia rakudo-moar 15532d: OUTPUT«1.1653503␤»
17:45 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?
17:45 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
17:45 DrForr Well, it's in perl5, not 6...
17:46 monada timotimo: seems to be just a single op: https://github.com/rakudo/rakudo/bl​ob/nom/src/Perl6/Actions.nqp#L2163
17:46 DrForr Maybe I'll do a quick conversion of what I have.
17:47 timotimo right. but how's the code look that generates the handler? does it become 100% inlined?
17:48 TimToady m: my $x;  quietly $x++ for ^1000_000; say now - INIT now;
17:48 camelia rakudo-moar 15532d: OUTPUT«1.352484␤»
17:48 TimToady m: my $x;  quietly { $x++ for ^1000_000 }; say now - INIT now;
17:48 camelia rakudo-moar 15532d: OUTPUT«0.41940168␤»
17:48 monada ¯\_(ツ)_/¯ wouldn't even know how to check
17:48 monada oooo
17:48 firstdayonthejob joined #perl6
17:48 TimToady m: my $x;  quietly ( $x++ for ^1000_000 ); say now - INIT now;
17:48 camelia rakudo-moar 15532d: OUTPUT«1.268981␤»
17:48 monada TimToady++
17:48 TimToady that's very odd
17:48 TimToady quietly should be outside the 'for' in any case, since it's a statement_prefix
17:49 rgrinberg joined #perl6
17:50 jnthn I guess the blockless form makes it no longer regarded as statement list level, however
17:50 jnthn So it won't get the range loop optimization
17:51 jnthn 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
17:51 jnthn If we're seeing one or both of those, that'd easily explain the difference.
17:51 timotimo like, no "resume" op anywhere
17:52 timotimo also, camelia is really rather noisy about timings, isn't she?
17:52 timotimo we fell into that particular trap again :)
17:52 cygx joined #perl6
17:53 cygx m: my $x;  say (quietly $x++ for ^1000_000).^name
17:53 camelia rakudo-moar 15532d: OUTPUT«List␤»
17:53 timotimo now you're just asking for it
17:55 cygx m: my $x;  (quietly $x++) for ^1000_000; say now - INIT now;
17:55 camelia rakudo-moar 15532d: OUTPUT«1.0957423␤»
17:56 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 #perl6
17:59 TimToady jnthn: I agree, that's probably what's going on here
18:00 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…»
18:00 timotimo bug! "quietly" inside strings is super slow!
18:02 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;
18:02 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␤»
18:03 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 ?
18:03 monada timotimo: heh
18:03 timotimo Str::LeftPad
18:03 monada tbrowder: kinda non-descript. ::Extra what? ::More what? Is it really that generic?
18:06 firstdayonthejob joined #perl6
18:06 labster joined #perl6
18:08 tbrowder monada: okay, then, Str::Sprintf (actually containing variant methods wrapping sprintf)
18:08 monada cool
18:08 monada .oO( Sprintf::Extra :) )
18:10 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?
18:11 tbrowder monada: well, sprintf is a method on Str
18:12 canopus joined #perl6
18:13 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»
18:13 monada m: say sprintf 'and this one is a sub';
18:13 camelia rakudo-moar 15532d: OUTPUT«and this one is a sub␤»
18:17 FROGGS joined #perl6
18:25 geraud joined #perl6
18:28 * TimToady is testing a likely fix for the "%%s" problem, if someone wants to rakudobug it
18:30 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␤␤»
18:31 monada m: "%%foo @@bar".say
18:31 camelia rakudo-moar 15532d: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '%foo' is not declared␤at <tmp>:1␤------> 3"%7⏏5%foo @@bar".say␤»
18:32 monada TimToady: https://rt.perl.org/Ticket/Display.html?id=129257
18:33 TimToady > p6 '"%%foo @@bar".say'
18:33 TimToady %%foo @@bar
18:34 tbrowder m:
18:35 tbrowder exit
18:35 smls TimToady: Does "foo $(2 + 2) bar" still work?
18:36 smls For when you don't want the block scope that comes with { }
18:37 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␤»
18:37 monada :o
18:37 smls m: sleep 1;  say "Completed in $(now - ENTER now) sec"
18:37 camelia rakudo-moar 15532d: OUTPUT«Completed in 1.0017096 sec␤»
18:37 smls ^^ That's an example where you can't use { } in the string
18:38 mst tbrowder: and then 'my $h = $orig_h but IO::Handle::Sprintf;' ?
18:38 Xliff \o
18:38 Xliff Any new news on this error I've run into?
18:38 Xliff https://gist.github.com/Xliff/0​f537c12b415fa0800a55f9484a25b1a
18:38 * mst is pleased to note that the 'export methods as scalars' trick works
18:38 Xliff It could be mine, but...
18:38 sjoshi joined #perl6
18:38 mst $thing.$_imported_name(...)
18:38 mst <3
18:38 Xliff mst: oooo! Details, pls?
18:38 mst Xliff: ^^
18:39 mst basically, 'my $_foo = method (...) { ... };'
18:39 mst then $obj.$_foo(...)
18:39 mst (I use the _ to signify it's weird, ala http://p3rl.org/Safe::Isa)
18:39 Xliff But what's the point of $obj?
18:39 mst eh?
18:39 Xliff O.
18:40 tbrowder mst: good point, what should it be, then?
18:40 Xliff W8.
18:40 AlexDaniel joined #perl6
18:40 Xliff Does $_foo have access to self?
18:40 mst yes
18:40 mst seems to so far
18:40 Xliff And can it be defined outside of the Class module?
18:41 Xliff So "use Class; my $c = Class.new; my $_foo = method (...) { ... }; $obj.$_foo(...)"
18:41 smls m: my method a { self };  say 4.&a;
18:41 camelia rakudo-moar 15532d: OUTPUT«4␤»
18:41 mst m: my $_add = method ($inc_by) { self.map: *+$inc_by }; my @foo = ^10; @foo.$_add(3).join(' ').say
18:41 camelia rakudo-moar 15532d: OUTPUT«3 4 5 6 7 8 9 10 11 12␤»
18:41 Xliff And it all Just Works?
18:41 mst Xliff: ^^
18:42 smls Xliff: methods can live in my scope ^^
18:42 Xliff OO
18:42 TimToady monada: fixed, tests needed somewhere or other
18:42 Xliff mst++: That's wicked!!!
18:43 Xliff I like
18:43 monada marking as such
18:43 tbrowder mst: IO::Handle::Extra or IO::Handle::Super?
18:43 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"
18:43 smls Xliff: In fact, every regex is a method that lives outside a class.
18:43 smls m: say /a/.^mro
18:43 camelia rakudo-moar 15532d: OUTPUT«((Regex) (Method) (Routine) (Block) (Code) (Any) (Mu))␤»
18:43 mst (note that Safe::Isa is one of my CPAN modules)
18:44 mst 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 mst then you don't need any further cleverness
18:44 mst if you're adding more than sprintf, what other things are you adding?
18:44 dogbert17 o/ #perl6
18:46 canopus joined #perl6
18:47 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'
18:47 camelia rakudo-moar 15532d: OUTPUT«42␤»
18:47 masak tbrowder: and, for consistency, name it `ssayf` :P
18:48 Xliff Can someone look at my Gist, pls?   ^^
18:48 dogbert17 dumb question of the day
18:48 monada m: sub esprintf { sprintf $^two, $^one }; say 42.&esprintf: '%d'
18:48 camelia rakudo-moar 15532d: OUTPUT«42␤»
18:48 cygx well, only if it calls .gist - otherwise, if should be .sputf
18:48 mst tbrowder: er, so maybe IO::Handle::FormatSugar ?
18:48 TimToady seems a fancy way to not call .fmt('%d')
18:48 dogbert17 m: say "123123".trans("23" => "", :complement)  # why does the results differ between this and
18:48 camelia rakudo-moar 15532d: OUTPUT«2323␤»
18:48 dogbert17 m: say 123123.trans("23" => "", :complement)  # this ?
18:48 mst monada: oh, hah, hadn't thought about the & form
18:48 camelia rakudo-moar 15532d: OUTPUT«11␤»
18:49 mst (largely because that would totally not have worked in perl5)
18:49 mst (well, my sub esprintf ($self, $format) { ... }; ... $obj->${\\&esprintf}(...) but ... no)
18:49 masak mst: fun fact of the & method call form -- it went *unnoticed* for months or possibly years after introducing the $obj.$method form
18:49 monada dogbert17: wild guess: we aren't passing the adverbs from Cool to Str
18:50 monada s: 123123, 'trans', \("23" => "", :complement)
18:50 SourceBaby monada, Sauce is at https://github.com/rakudo/rakudo/b​lob/15532db/src/core/Cool.pm#L131
18:50 monada s: '123123', 'trans', \("23" => "", :complement)
18:50 mst masak: hahahahahaha
18:50 SourceBaby monada, Sauce is at https://github.com/rakudo/rakudo/b​lob/15532db/src/core/Str.pm#L1554
18:50 dogbert17 monada: you' beginning to sound like Zoffix :-)
18:50 masak mst: I don't recall who discovered it. either it was me or I wish it was.
18:50 monada dogbert17: Zoffix?
18:50 grondilu lizmat: since you've been busy improving permutations/combinations lately, may I remind you a quicker algorithm has been authorized last year.  See https://github.com/perl6/roast/issues/79
18:50 mst Xliff: btw, http://shadow.cat/blog/matt-s​-trout/madness-with-methods/ is my various lunatic perl5 tricks; perhaps some of them will prove reusable
18:51 mst 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
18:51 monada dogbert17: wanna fix that bug? Change the *@a and @a to |c here: https://github.com/rakudo/rakudo/b​lob/15532db/src/core/Cool.pm#L131
18:51 dogbert17 monada: that would be a first for me
18:51 monada \o/
18:52 TimToady m: my $s = sprintf "%%s"; say "$s = '$s'"
18:52 camelia rakudo-moar a9ed67: OUTPUT«%s = '%s'␤»
18:52 TimToady tbrowder: ^^^
18:52 mst HAH
18:52 mst masak: which means, logically, $() will also work so
18:52 dogbert17 monada: should I start with an RT?
18:52 masak o.O
18:52 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␤»
18:52 mst masak: fuckin' A.
18:52 masak \o/
18:53 Xliff mst++: Bookmarked. Thanks.
18:53 TimToady yes, composability for the win
18:53 tbrowder TimToady: thanks!
18:53 monada dogbert17: sure. Good to have a record.
18:53 mst TimToady: $() is so much nicer than ${\} :D
18:54 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('_'))
18:54 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␤   …»
18:54 mst m: class Foo { method say_hello () { say "hello" } }; Foo.new.$(<say hello>.join('_'))
18:54 camelia rakudo-moar a9ed67: OUTPUT«No such method 'CALL-ME' for invocant of type 'Str'␤  in block <unit> at <tmp> line 1␤␤»
18:55 mst hrmf
18:55 TimToady it's only hard refs
18:55 TimToady we picked that too :P
18:55 mst $obj->${\join('_', qw(say hello))} would work in perl5
18:55 mst I was kinda fond of variants on that theme
18:55 mst that's ok though
18:56 TimToady symbolic refs always have a different syntax in p6
18:56 TimToady so no need for strict refs
18:56 mst I thought $obj."foo" was a thing somehow
18:56 El_Che "mst is learning perl 6. Chapter 1: the cornercases"
18:56 TimToady needs parens
18:56 mst $obj.("foo") ?
18:56 TimToady no, after
18:56 mst oh hah
18:56 mst so $obj."foo"() is ok?
18:56 TimToady otherwise too ambiguous with ends of quoted sentences
18:57 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␤␤»
18:57 mst m: class Foo { method say_hello () { say "hello" } }; Foo.new."$(<say hello>.join('_'))"()
18:57 camelia rakudo-moar a9ed67: OUTPUT«hello␤»
18:57 mst ah, there we go.
18:57 mst wasn't too far off :D
18:57 TimToady you can interplate with {} there too
18:57 TimToady *pol
18:58 mst as in "{<say hello>.join('_')}" I guess?
18:58 dogbert17 monada: done, https://rt.perl.org/Public/​Bug/Display.html?id=129258
18:58 TimToady yeah
18:58 aindilis joined #perl6
18:59 monada dogbert17: OK, now fork Rakudo: https://github.com/rakudo/rakudo/
18:59 TimToady m: say "@@s"
18:59 camelia rakudo-moar a9ed67: OUTPUT«@@s␤»
18:59 TimToady m: say "@@s<>"
18:59 camelia rakudo-moar a9ed67: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '@s' is not declared␤at <tmp>:1␤------> 3say "@7⏏5@s<>"␤»
18:59 TimToady m: say @@s
18:59 camelia rakudo-moar a9ed67: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '@s' is not declared␤at <tmp>:1␤------> 3say @7⏏5@s␤»
18:59 monada dogbert17: then follow these steps to make the change and test it: https://gist.github.com/zoffixznet​/444b0b8b001021319ba9b556465ab59d
18:59 TimToady m: say "@$s"
18:59 camelia rakudo-moar a9ed67: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$s' is not declared␤at <tmp>:1␤------> 3say "@7⏏5$s"␤»
19:00 TimToady m: say "$@s"
19:00 camelia rakudo-moar a9ed67: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '@s' is not declared␤at <tmp>:1␤------> 3say "$7⏏5@s"␤»
19:00 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
19:00 TimToady those all seem right
19:00 monada dogbert17: and bonus points for also submitting a test for the bug into roast (I think it's explained here: http://perl6.party/post/Hacking-on-Raku​do-Perl-6-Compiler-Mix-Your-Fix#roastit )
19:00 Actualeyes joined #perl6
19:01 aindilis joined #perl6
19:01 dogbert17 monada: I'll see what I can do
19:01 monada dogbert17++
19:01 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 #perl6
19:05 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
19:06 El_Che yeah, that admin-hate part at yapce was funny
19:06 El_Che (besides the "f*, my talks is 20 minutes shorter that expected", also funny)
19:08 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
19:09 monada dogbert17: If you have any trouble, ping Zoffix in #perl6-dev
19:09 * monada &
19:13 TheLemonMan joined #perl6
19:14 mcmillhj joined #perl6
19:18 Ven joined #perl6
19:19 canopus joined #perl6
19:21 itaipu joined #perl6
19:22 labster joined #perl6
19:46 andrzejku joined #perl6
19:58 Ven joined #perl6
19:58 mr-foobar joined #perl6
20:00 Ven joined #perl6
20:05 nadim_ joined #perl6
20:06 Ven joined #perl6
20:09 cdg joined #perl6
20:22 lizmat grondilu: noted the PR, will look at it after the P6W
20:50 woolfy joined #perl6
21:00 devmikey joined #perl6
21:00 devmikey joined #perl6
21:02 AlexDaniel hehe, RT does not like 🦋
21:03 El_Che nor does my utf8 configure irc client
21:03 geraud joined #perl6
21:31 espadrine joined #perl6
21:31 kyclark joined #perl6
21:33 geraud joined #perl6
21:37 canopus joined #perl6
21:45 john51 joined #perl6
21:51 dylanwh of note, the fib example on perl6.org does little to discourage negative connotations to perl6. :(
21:52 Zoffix dylanwh, and what negative connotations are those? :)
21:52 dylanwh "line noise, hur hur hur"
21:53 * Zoffix never heard of that applied to Perl 6
21:53 Zoffix 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
21:54 * Zoffix wishes those code examples were runnable
21:54 Zoffix and editable
21:54 Zoffix Like on perl6.party
21:54 Zoffix (we can use perl6.party's backend for it too).
21:54 dylanwh https://gist.github.com/dylanwh/​382ce787b63e92f2df36a366372e277c
21:55 Zoffix haha :)
21:55 Zoffix You gotta have your critics ;)
21:55 Zoffix dylanwh, what channel is that?
21:55 dylanwh a work channel
21:55 RESPONDANTS joined #perl6
21:55 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
21:56 dylanwh and they only remember porting horrible releng code from perl to python
21:56 dylanwh sigh
21:56 Zoffix The Whatever Star is actually ridiculously straightforward. It's a bit jarring on first sight, but is very concise and useful.
21:57 Zoffix m: say (* * * * * * * * * * * * * * * * * * * * * * * * * * *)(|(^14+1))
21:57 camelia rakudo-moar 22946e: OUTPUT«87178291200␤»
21:57 Zoffix Show them that :P
21:57 dj_goku :blinks:
21:57 Zoffix :D
21:58 Zoffix Here's a version with multiplication ops replaced with fancy-pants version:
21:58 Zoffix m: say (* × * × * × * × * × * × * × * × * × * × * × * × * × *)(|(^14+1))
21:58 camelia rakudo-moar 22946e: OUTPUT«87178291200␤»
21:59 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
22:00 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 …»
22:00 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
22:01 Zoffix m: say ^10 .map: *+*
22:01 camelia rakudo-moar 22946e: OUTPUT«(1 5 9 13 17)␤»
22:01 Zoffix Here, I'm using map to loop over 10 items, 2 at a time, returning the sums of each of two items....
22:01 Zoffix m: say ^10 .pick(*)
22:01 camelia rakudo-moar 22946e: OUTPUT«(3 6 2 4 0 7 9 1 5 8)␤»
22:02 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 Zoffix m: say 1, 3, 9 … 1000 < *
22:02 camelia rakudo-moar 22946e: OUTPUT«(1 3 9 27 81 243 729 2187)␤»
22:03 Zoffix Here, I'm generating multiples of 3 while the current element is below 1000
22:03 Zoffix And adding up my soliloquy into one piece, you get my @fib = 0, 1, *+* ... *; that contains all Fib numbers
22:04 Zoffix Can also be written as    my @fib = 0, 1, *+* ... ∞;
22:04 dylanwh Zoffix: that.. isn't going to change their mind. XD
22:04 Zoffix :)
22:04 Zoffix It's fine with me :)
22:05 Zoffix They can use whatever 20-line fib method they prefer instead 😜
22:06 Sgeo joined #perl6
22:12 lizmat and another Perl 6 Weekly hits the Net: https://p6weekly.wordpress.com/20​16/09/12/warmen-up-das-youtuben/
22:13 kyclark joined #perl6
22:16 dalek perl6.org: 385c187 | (Zoffix Znet)++ | source/index.html:
22:16 dalek perl6.org: Change fib example to primes example
22:16 dalek perl6.org: review: https://github.com/perl6/p​erl6.org/commit/385c18755a
22:16 Zoffix m: my @primes = ^∞ .grep: *.is-prime; say "1001ˢᵗ prime is @primes[1000]";
22:16 camelia rakudo-moar 22946e: OUTPUT«1001ˢᵗ prime is 7927␤»
22:16 Zoffix Changed it to that.
22:17 Zoffix Still not the best. I think the fancy pants sequence operator is a good example
22:19 canopus joined #perl6
22:25 pierrot joined #perl6
22:28 aries_liuxueyang joined #perl6
22:30 zacts joined #perl6
22:31 _slade_ joined #perl6
22:31 woolfy I LOVE YOU ALL WITH A GREAT HUGE LOVE!!!
22:31 woolfy (thought I'd mention that, haven't seen somebody say this for a while, missed it a bit)
22:31 cpage_ joined #perl6
22:34 skids joined #perl6
22:36 Zoffix woolfy == Yaakov? :)
22:41 kyclark joined #perl6
22:42 TEttinger joined #perl6
22:54 mcmillhj joined #perl6
22:58 pierrot joined #perl6
23:03 kyclark joined #perl6
23:08 tailgate what does | mean in a function argument list i.e. method foo(|c)
23:09 Zoffix tailgate, a slip
23:09 Zoffix tailgate, in your particular example, that looks like a slip of a capture
23:09 Zoffix m: sub tunnel (|c) { say |c };   tunnel 2, "42", class {}
23:09 camelia rakudo-moar 22946e: OUTPUT«242(<anon|67412688>)␤»
23:09 Zoffix ^ so it shuttles the arguments
23:10 Zoffix 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␤»
23:10 Zoffix m: sub foo ($arg1, $arg2) {}; my @args = 1, 2; foo |@args
23:10 camelia rakudo-moar 22946e: ( no output )
23:11 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 Zoffix huggable, Slip
23:11 huggable Zoffix, A kind of List that automatically flattens into an outer container: https://docs.perl6.org/type/Slip
23:11 Zoffix huggable, Capture
23:11 huggable Zoffix, Argument list suitable for passing to a: https://docs.perl6.org/type/Capture
23:11 tailgate interesting...goes to read Slip documentation
23:16 mcmillhj joined #perl6
23:17 kyclark http://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:18 kyclark Basically I don’t understand how things get “made”.
23:22 Zoffix kyclark, add .made after your .parse() call
23:22 Zoffix my $result = CDHit.parse($clusters.IO.slurp, :actions(CDHit::Actions)).made
23:24 Zoffix m: grammar { token TOP { {make: 42} } }.parse('').made.say
23:24 camelia rakudo-moar 22946e: OUTPUT«(Any)␤»
23:24 Zoffix m: grammar { token TOP { {make 42} } }.parse('').made.say
23:24 camelia rakudo-moar 22946e: OUTPUT«42␤»
23:24 Zoffix kyclark, and I think the colons after your makes shouldn't be there
23:24 Juerd kyclark: I found it easier to work with grammars when I first did so, to do it without make/made
23:25 Juerd 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:!␤»
23:26 Zoffix m: https://gist.github.com/zoffixznet​/98dea1911c297cabefc146cb8625912b
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…»
23:27 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
23:27 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(":")
23:27 camelia rakudo-moar 22946e: OUTPUT«x:x:x:x:x:x:x:x:x:x:x:x:x␤»
23:27 kyclark I’m feverishly hacking the above suggestions to understand
23:28 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:29 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:30 Juerd You can think of 'make $x;' as '$/.made = $x;', except the latter isn't valid :)
23:35 kyclark http://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:36 kyclark The <seq_id> token can occur in two places, and both times I just want to discard the “>”
23:40 Juerd In your loop, you "say" the match object itself
23:40 Juerd That stringifies to the matched string. To get what you stored with "make", use "$record<id>.made" instead of "$record<id>"
23:41 Zoffix m: https://gist.github.com/zoffixznet​/887cd4ffaca5403c19d0bd4f3b9511dd
23:41 camelia rakudo-moar 22946e: OUTPUT«Str $result = "Cluster_5086"␤»
23:41 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.
23:44 Juerd 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:46 kyclark Wow, all this is great.  Thanks Zoffix and Juerd!
23:49 aa__ joined #perl6
23:50 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:51 Juerd Also, I think the > is probably not part of the data, so should be outside the tokens
23:52 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>
23:52 kyclark The great thing about standards is that there are so many to choose from.  :-)
23:52 Juerd Instead of having > in the definition of seq_id
23:53 Juerd That way, seq_id itself purely matches the thing that is the id, without the delimiter >
23:54 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 kyclark Dang, I have to go, but I
23:54 kyclark I’ll study on this for a while.  Thanks, again!
23:56 Juerd Oh, they left. Darn, just refactored the thing :)
23:56 Juerd http://lpaste.net/192201
23:56 aries_liuxueyang joined #perl6

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo