Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2016-11-01

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:03 pierre_ joined #perl6
00:18 AlexDani` joined #perl6
00:19 nebuchad` joined #perl6
00:19 dalek joined #perl6
00:19 kst` joined #perl6
00:20 kaare__ joined #perl6
00:21 pierrot joined #perl6
00:22 bjz joined #perl6
00:22 Celelibi joined #perl6
00:27 pierre_ joined #perl6
00:33 baest joined #perl6
00:40 pierre_ joined #perl6
00:47 japhb .ask masak What's up with the IR clog spelunking?  Is there a project afoot?
00:47 yoleaux japhb: I'll pass your message to masak.
00:49 pierre_ joined #perl6
00:50 japhb .tell lizmat We once had OpenGL, because back when Parrot was the only backend, I wrote those bindings.  Sadly it's been a while since I've messed around with those; maybe after I finish https://github.com/japhb/Terminal-Print/blob/ui_test/examples/rpg-ui.p6 ... which, uh, may be a while.
00:50 yoleaux japhb: I'll pass your message to lizmat.
00:54 pierre_ joined #perl6
00:55 Shin_ joined #perl6
01:00 Shin_ Hi all...
01:00 Shin_ m: my @a = <a a b c>; my @b = (20,1,5,4); say sort({$^a cmp $^b},  @a); say sort({$^b cmp $^a}, @b);
01:00 camelia rakudo-moar 839e52: OUTPUT«(a a b c)␤(20 5 4 1)␤»
01:01 Shin_ so, is there a perl6 way to code a sorting for both columns at the same time,thag could take advantage of auto threading?
01:03 Shin_ Like an Sql saying 'order by @a asc, @b desc'
01:04 grondilu .values given sort *.key, (@a >>[=>]<< @b);
01:08 Shin_ Wow, that looks cryptic :)
01:09 Shin_ And for 3 or more columns, what strategy is suggested. I just want to tale davantage of perl6 lazyness and autothreading if possible.
01:12 bjz joined #perl6
01:13 grondilu your sort can not do parallelism by definition, so the only parallelism is in computing the sorting criteria.  So you may just create a data structure with all sorting criteria in it, and to do so you can use parallelism.
01:15 baest joined #perl6
01:15 grondilu something like race @a.map( { $_ => [&criterium1($_), &criterium2($_)] } );
01:22 vendethiel joined #perl6
01:22 itaipu joined #perl6
01:28 Hotkeys m: say (1..3 Z 1..3), (3..1 Z 1..3)
01:28 camelia rakudo-moar 839e52: OUTPUT«((1 1) (2 2) (3 3))()␤»
01:28 Hotkeys What's going on here ^
01:28 Hotkeys Why does an ascending range work fine with zip
01:28 Hotkeys But a descending range doesn't
01:28 Juerd m: say 3..1
01:28 camelia rakudo-moar 839e52: OUTPUT«3..1␤»
01:28 Juerd Heh.
01:29 Actualeyes joined #perl6
01:29 Hotkeys m: list 3..1
01:29 camelia rakudo-moar 839e52: ( no output )
01:29 Hotkeys m: say list 3..1
01:29 camelia rakudo-moar 839e52: OUTPUT«()␤»
01:29 Hotkeys So are descending ranges not a thing
01:29 Juerd Descending ranges don't really exist.
01:29 Hotkeys Whoops
01:29 Juerd You can use a generated list: 3 ... 1
01:29 Hotkeys Right
01:31 Hotkeys Thanks
01:37 Khisanth joined #perl6
01:40 Shin_ Thanks grondilu
01:47 MasterDuke is there a way for a grammar to get/know where in the overall thing it's parsing it is, i.e., the line number of the file?
01:47 cibs joined #perl6
01:48 gfldex MasterDuke: you have to count line numbers by hand
01:49 MasterDuke ugh. not sure how i would do that in a grammar?
01:49 gfldex MasterDuke: i got some code for that somewhere, will take a minute or two
01:50 MasterDuke sure, np
01:51 gfldex MasterDuke: https://gist.github.com/gfldex/fcd52d39ae9bf4288f3a5952d13717c0
01:51 gfldex make sure to count the line before doing any matching
01:52 MasterDuke cool, thanks
01:53 pierre_ joined #perl6
01:56 pierre_ joined #perl6
01:58 aborazmeh joined #perl6
01:58 aborazmeh joined #perl6
02:02 R_I_D joined #perl6
02:04 R_I_D question: how am i supposed to be productive in another language now that i know about perl6?
02:05 timotimo we are very sorry
02:05 timotimo you can use Inline::Python and Inline::Perl5 (and Inline::Perl6) to share code between languages
02:05 timotimo so you can keep a few things in perl6
02:06 R_I_D Inline Python? youre kidding
02:06 R_I_D thats awesome
02:07 timotimo it's a thing :)
02:11 seatek i have gone from a day-long, seething loathing of grammars into excited happiness in a matter of 5 minutes.
02:14 seatek i was thinking, what wholly inadequate documentation there is on them... if i ever figure it out, i'll write up some better. but now i realize how hard that would be. seems like it's one of those things that just has to "click" eventually.
02:15 seatek now to start creating chaos with actions
02:31 bjz joined #perl6
02:33 pierre_ joined #perl6
02:46 pierre_ joined #perl6
02:47 ilbot3 joined #perl6
02: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!
03:03 SmokeMachine____ Is there a way to get the $=pod from another code?
03:20 AlexDaniel seatek: I've always thought that https://docs.perl6.org/language/grammars is quite decent
03:22 seatek AlexDaniel: it is if you already know about them. It jumps straight into Protoregexes without even talking about what Grammars even are, except to say they're a "data structure" made by grouping regexes
03:23 AlexDaniel seatek: haha
03:24 seatek yeah ;)
03:27 Lucas_One joined #perl6
03:28 seatek i'm still not clear in actions why the heck and when you'd use "make" even.
03:29 seatek and i've read just about everything there is
03:30 AlexDaniel it's if you want to build AST
03:30 seatek i know it's supposed to create an "AST", but trying to find what that is I have no idea
03:30 seatek yes, exactly what the docs said
03:30 AlexDaniel okay, well. Once you parsed something, you have a parse tree, right?
03:31 seatek sure -- that's all very new to me though
03:31 AlexDaniel now, if the data you are parsing is complex enough, it means that your grammar is probably a bit complex too.
03:31 seatek you have component parts stored in methods
03:31 AlexDaniel so chances are you'll get a lot of crap in your parse tree
03:32 seatek it looks like make is used on things that need to map array and such
03:32 AlexDaniel (to the point that it is not very convenient to work with it)
03:32 seatek yeah
03:33 AlexDaniel so you build an AST! Which does not contain as much information about the original text and how exactly it was parsed
03:33 seatek ah ok... strips it down a bit
03:34 AlexDaniel yea, and you can do some extra stuff there too, depending on your needs
03:35 seatek so basically with actions, you're taking the return value that comes out of TOP, yes?
03:36 AlexDaniel well, it will call a corresponding method for every rule/token/regex it matches, not just TOP. But the value you get from $match.made is from TOP, yes
03:37 seatek right :)
03:37 seatek that took FOREVER to figure out.
03:38 seatek i could just be dull :)
03:39 AlexDaniel no, it is indeed not that obvious
03:39 seatek i'm basically looking at grammars as a means to create data structures i can have predictable and consistent things to work with
03:39 AlexDaniel but if you try to write some basic parser you'll probably figure it all out
03:39 AlexDaniel … or maybe some basic programming language, not just parser…
03:39 seatek yeah that's what i've been doing -- a basic REST construct as my plaything
03:41 seatek with "made"... do you need to call that on things you've have "make"'d? i haven't really dug into those guys much yet
03:42 seatek if make is just stripping things down, i don't see why you would
03:42 seatek yet so many of the examples use it without saying why
03:43 seatek you look up make -- and it says Sets the AST to $ast, and returns it.
03:43 seatek ah! i understand! ;)
03:44 seatek and made.... Returns the payload that was set with method make.
03:44 seatek oh silly me ;)
03:45 seatek and an ast is An AST or Abstract Syntax Tree is a partially processed representation of a program.
03:47 seatek why would i want my action to become a partially processed representation of a program? I mean, I can imagine... but how do I work with that?
03:48 seatek i'm not complaining -- i'm just sharing my journey... ;)
03:48 AlexDaniel m: grammar Foo { rule TOP { <int> ‘+’ <int> }; token int { \d+ } }; class Addition { has $.a; has $.b }; class BarAct { method TOP($/) { make Addition.new(a => $<int>[0].made, b => $<int>[1].made) }; method int($/) { make +~$/ } }; my $match = Foo.parse(‘42 + 60’, actions => BarAct.new); say $match; say $match.made
03:48 camelia rakudo-moar 839e52: OUTPUT«「42 + 60」␤ int => 「42」␤ int => 「60」␤Addition.new(a => 42, b => 60)␤»
03:49 AlexDaniel seatek: you might want to split that into a few lines :)
03:49 seatek AlexDaniel: exactly what I started doing :)
03:51 AlexDaniel I'm not sure if it explains anything, but that's the idea
03:53 seatek i'm still trying to format it to read. emacs can't even help! :)
03:56 seatek no, that's no help at all
03:56 seatek :)
03:56 seatek thanks though
03:56 seatek :)
03:57 seatek i need to be let by the hand with a lollipop and all i get is punk rock ;)
03:57 seatek when this will be a help, i'll have come to understand what i need to ;)
03:59 seatek oh wait
03:59 AlexDaniel seatek: well, you can always work with your parse tree if you want to
03:59 noganex joined #perl6
03:59 seatek maybe if i stare at it for a while
04:00 AlexDaniel m: https://gist.github.com/AlexDaniel/15ac3d529aec605999eca7ffa3272cef
04:00 camelia rakudo-moar 839e52: OUTPUT«「42 + 60」␤ int => 「42」␤ int => 「60」␤Addition.new(a => SuperInteger.new(value => 42), b => SuperInteger.new(value => 60))␤»
04:00 seatek why are the 2 $<int>[*] things getting .made called on them at that point ... they were never 'make'ed
04:00 AlexDaniel seatek: they were
04:01 seatek they get maked if they come from the grammar automatically?
04:01 AlexDaniel no, there's a method BarAct.int
04:03 seatek it knows to call that method?
04:04 AlexDaniel yes, by its name
04:04 seatek oh i see, because int gets pulled in from the grammar, then it's already been changed for the TOP method
04:10 seatek so duplicate token names get put into an array automatically too eh? had no idea about that one.
04:11 AlexDaniel yes
04:12 seatek i don't understand how 'value' could come out
04:12 seatek i mean, how it's added, yes... but how it's outputted i can't see that
04:13 AlexDaniel seatek: that's .gist of our object that we created
04:13 seatek just as an element of the data structure i suppose.
04:14 seatek and then we just pick out the juicy bits we want
04:15 AlexDaniel committable6: https://gist.githubusercontent.com/AlexDaniel/15ac3d529aec605999eca7ffa3272cef/raw/ac8fee2173b290ed184c788e3dc8affa0cf32dc4/file.p6
04:15 AlexDaniel committable6: help
04:15 committable6 AlexDaniel, Like this: committable6: f583f22,HEAD say ‘hello’; say ‘world’
04:15 AlexDaniel committable6: HEAD https://gist.githubusercontent.com/AlexDaniel/15ac3d529aec605999eca7ffa3272cef/raw/ac8fee2173b290ed184c788e3dc8affa0cf32dc4/file.p6
04:15 committable6 AlexDaniel, Successfully fetched the code from the provided URL.
04:15 committable6 AlexDaniel, https://gist.github.com/8bf643f794c8f3d1b076c8bc0eb131dc
04:16 AlexDaniel I should have started doing it in reverse polish notation… :)
04:17 seatek no! :)
04:17 AlexDaniel yes, because to make it work properly with infix notation you'd have to basically build your predence table… :)
04:18 AlexDaniel which is doable, but uhh!
04:18 seatek yes i've noticed how some simple things are complicated an some complicated get simple
04:18 AlexDaniel seatek: anyway, what I wanted to show here is that there is no “operation” in our AST
04:19 kent\n joined #perl6
04:19 seatek so really, it's a bit of a discovery to find out what you've created in your AST then
04:19 AlexDaniel not sure what you mean by that :)
04:20 seatek i think i'll have to ;) to that
04:20 AlexDaniel seatek: but anyway, if you don't feel any need in AST then perhaps you don't need one in this particular task
04:21 seatek AlexDaniel++ this has been so incredibly helpful.. thank you so much
04:21 AlexDaniel just go over your parse tree and get what you need, that works too
04:21 seatek i think i probably don't at this point... but i'm going to anyway. i want to get this all feeling second nature
04:23 seatek i can see how useful this could be in lots of stuff. i could have been done a couple days ago with this last task but keeping to regexes... but when i see a rabbit hole... ;)
04:24 seatek and this seems so core to everythign in the language, so it seems worth the effort
04:25 AlexDaniel well, it is core, it parses the whole damn thing :)
04:26 seatek i would throw myself into the creek first, than trying to write that.
04:27 seatek can't even imagine at this point
04:27 seatek though i have briefly peeked ;)
04:28 AlexDaniel interestingly, one of the example in our docs abuses the whole AST to pass calculated values around… not sure if that's a great example
04:28 AlexDaniel ast thing*
04:28 pierre_ joined #perl6
04:29 seatek there is all manner of voodoo going on in those docs related to grammars
04:30 seatek i did at first imagine using grammars to do class factories directly in the actions, but have since second-thought that
04:30 Actualeyes joined #perl6
04:32 AlexDaniel anyway, I have to sleep :)
04:32 AlexDaniel see you 🙋
04:32 AlexDaniel seatek: and feel free to open a couple of tickets in doc repo
04:33 AlexDaniel seatek: your complaints are correct
04:33 AlexDaniel it should not jump straight into protos, that's true
04:33 AlexDaniel and yes, it should have a bit more text explaining why somebody would need an AST
04:39 seatek i'll help write some up gladly. least i can do for your kind help AlexDaniel. thank you again
04:45 wamba joined #perl6
05:07 canopus joined #perl6
05:13 brillenfux joined #perl6
05:21 labster joined #perl6
05:29 pierre_ joined #perl6
05:39 Cabanossi joined #perl6
05:53 Sgeo joined #perl6
06:11 pierre_ joined #perl6
06:46 brillenfux_ joined #perl6
06:48 RabidGravy joined #perl6
06:48 darutoko joined #perl6
06:55 pierre_ joined #perl6
07:00 pierre_ joined #perl6
07:16 samcv what do you guys use for terminal emulators on linux? i sorta use st and konsole, but st is way too minimal and konsole has problems displaying unicode text properly (cuts characters off and makes the line placement off sometimes for a larger character)
07:16 samcv curious what you guys use
07:18 CIAvash joined #perl6
07:18 neuraload joined #perl6
07:22 moritz I use xfce4-terminal, mostly because it's the default on xubuntu
07:23 moritz so far I didn't have any Unicode trouble with it
07:23 samcv hmm
07:23 samcv i will try that then
07:26 samcv hmm tried it and at least it doesn't glitch the spacing of the lines for tall characters like 「this」 but they still get cut off vertically
07:26 samcv but i use a really tiny font
07:26 arnsholt I've mostly used gnome-terminal
07:27 arnsholt But not with a tiny font
07:27 samcv https://a.uguu.se/fNSHlsqDwQHv_Screenshot_20161023_202455.png
07:27 arnsholt Modern screens are big, so I can afford the luxury of a big font too =)
07:27 samcv hah
07:27 samcv i only have 1366 x 768 on my laptop and it's what i use 95% of the time
07:28 arnsholt Hah! Apparently the corporate firewall doesn't like your site
07:28 samcv heh
07:28 samcv arnsholt, try this https://i.imgur.com/Tx2CaUq.png
07:29 samcv it's a bitmap font so only one size. but i love it so much. can fit tons on my screen and it's pretty readable
07:36 firstdayonthejob joined #perl6
07:37 domidumont joined #perl6
07:39 wamba joined #perl6
07:40 samcv i find it annoying as hell that st, which is only has 10k lines of code is the only one that actually renders text right :(
07:40 samcv idk why it's so hard to resize too big characters to fit inside the box given that terminals are supposed to do monospaced fonts
07:53 grondilu joined #perl6
07:55 CIAvash joined #perl6
08:02 labster joined #perl6
08:06 samcv tried terminator, termite, konsole, xfce4-terminal, yakuake, terminology, xterm, urxvt-unicode, roxterm. ugh
08:07 bonsaikitten mrxvt seems pretty ok
08:07 bonsaikitten tabbed rxvt, mostly sane
08:10 samcv well i've gotten urxvt working except only basically specifying the fallback fonts be like 1/2 the size they should be
08:11 samcv if they're too big urxvt will just not show them at all :\
08:11 samcv other ones either cut them off or they go into the other lines
08:13 cdg joined #perl6
08:14 samcv st is the only one that actually shows properly, and it even works for full width symbols too, but always makes sure the height fits. but fullwidth ones show wider than normal ones. i wish i could use the normal clipboard to paste into it though, and not do middle click
08:14 pierre_ joined #perl6
08:15 bonsaikitten haven't seen that issue yet
08:19 zakharyas joined #perl6
08:20 wamba joined #perl6
08:23 pierre_ joined #perl6
08:27 samcv bonsaikitten, maybe your font isn't small enough ;)
08:31 nine samcv: what version of konsole have you tried?
08:31 samcv hmm even with a bigger font xfce terminal will glitch if i type 🐧 as the first thing, and pad it with like 3 spaces of width and then backspacing over it won't remove the last thing..
08:31 samcv i'm running the latest
08:31 nadim joined #perl6
08:32 samcv i have konsole 16.08.2 running KDE 5.8
08:34 samcv gonna try something brb
08:37 dakkar joined #perl6
08:38 samcv not sure why this isn't working, but konsole isn't doing my custom compose things in ~/.XCompose
08:42 samcv QT_IM_MODULE is set to xim too other programs work, though in kate things like emojis insert but shows a ? box. but works in non qt programs.
08:44 cdg_ joined #perl6
08:47 tokomer joined #perl6
08:50 * lizmat clickbaits https://p6weekly.wordpress.com/2016/10/31/2016-44-увод-в-perl-6/
08:50 yoleaux 00:50Z <japhb> lizmat: We once had OpenGL, because back when Parrot was the only backend, I wrote those bindings.  Sadly it's been a while since I've messed around with those; maybe after I finish https://github.com/japhb/Terminal-Print/blob/ui_test/examples/rpg-ui.p6 ... which, uh, may be a while.
08:55 tokomer joined #perl6
09:01 jonas1 joined #perl6
09:04 pierrot joined #perl6
09:04 [ptc] lizmat++
09:07 pierre_ joined #perl6
09:15 pierre_ joined #perl6
09:24 masak m: sub is-odd($n) { $n % 2 }; .say if 5 ff is-odd($_) for 1..10
09:24 camelia rakudo-moar 839e52: OUTPUT«5␤6␤7␤8␤9␤10␤»
09:24 yoleaux 00:47Z <japhb> masak: What's up with the IR clog spelunking?  Is there a project afoot?
09:25 masak japhb: no, just ended up searching for stuff :)
09:25 masak er, I mean "officially, there's no project afoot" :P
09:25 masak what'm I doing wrong with the `is-odd` thing above?
09:25 masak I'm trying to highlight the difference between ff and fff
09:38 * masak checks the test suite
09:40 masak m: say join "", (/B/ ff /B/ ?? $_ !! "x" for <A B A B A>)
09:40 camelia rakudo-moar 839e52: OUTPUT«Use of uninitialized value <element> of type Any in string context.␤Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.␤  in block <unit> at <tmp> line 1␤Use of uninitialized value <element> of type Any in strin…»
09:42 masak oh. precedence.
09:42 masak m: say join "", ((/B/ ff /B/) ?? $_ !! "x" for <A B A B A>)
09:42 camelia rakudo-moar 839e52: OUTPUT«xBxBx␤»
09:42 masak for some reason I expected infix:<ff> to be tighter than infix:<?? !!>
09:43 masak but they're on the same prec level -- hm
09:43 masak and right-associative
09:43 masak so... I don't understand why the parens make a difference there...
09:43 masak m: say join "", ((/B/ fff /B/) ?? $_ !! "x" for <A B A B A>)
09:43 camelia rakudo-moar 839e52: OUTPUT«xBABx␤»
09:44 masak anyway, the spectests deliver. the above is a difference between ff and fff
09:50 dalek doc: acd772d | gfldex++ | doc/Type/Regex.pod6:
09:50 dalek doc: show how to declare named Regex
09:50 dalek doc: review: https://github.com/perl6/doc/commit/acd772d2d7
09:50 dalek doc: 9246bf3 | gfldex++ | doc/Language/functions.pod6:
09:50 dalek doc: index prefix &
09:50 dalek doc: review: https://github.com/perl6/doc/commit/9246bf356f
09:56 dalek doc: b1e96ff | gfldex++ | doc/ (2 files):
09:56 dalek doc: name a sigil a sigil
09:56 dalek doc: review: https://github.com/perl6/doc/commit/b1e96ff343
10:08 pierre_ joined #perl6
10:08 masak m: class A::B {}; class C { has A::B $.ab .= new } # RT #126975
10:08 camelia rakudo-moar 839e52: OUTPUT«===SORRY!===␤Could not locate compile-time value for symbol A::B␤»
10:09 masak one of these days curiosity is going to get the better of me, and I will have to check why that one doesn't find the "compile-time value for symbol A::B" :)
10:09 masak this works:
10:09 masak m: class A::B {}; class C { has A::B $.ab = A::B.new }; say "alive"
10:09 camelia rakudo-moar 839e52: OUTPUT«alive␤»
10:09 masak so it's gotta have something to do with the `.=` somehow
10:13 auerland joined #perl6
10:13 auerland left #perl6
10:14 wamba joined #perl6
10:27 silug joined #perl6
10:31 brillenfux joined #perl6
10:31 jferrero m: say 4 == (1E12.log10 / 3).Round
10:31 camelia rakudo-moar 839e52: OUTPUT«No such method 'Round' for invocant of type 'Num'␤  in block <unit> at <tmp> line 1␤␤»
10:32 jferrero m: say 4 == (1E12.log10 / 3).round
10:32 camelia rakudo-moar 839e52: OUTPUT«True␤»
10:33 kent\n joined #perl6
10:41 itaipu joined #perl6
10:50 ilmari[m] joined #perl6
10:56 tadzik joined #perl6
10:56 enick_127 joined #perl6
10:56 M-Illandan joined #perl6
10:56 Matthew[m] joined #perl6
10:59 tokomer_ joined #perl6
11:01 dakkar joined #perl6
11:02 andrzejku joined #perl6
11:02 DarthGandalf joined #perl6
11:02 BuildTheRobots joined #perl6
11:03 masak m: say 1E12.log10 / 3
11:03 camelia rakudo-moar b5780f: OUTPUT«4␤»
11:03 masak m: say 4 == 1E12.log10 / 3
11:03 camelia rakudo-moar b5780f: OUTPUT«False␤»
11:03 itaipu joined #perl6
11:03 masak m: say 4 ≅ 1E12.log10 / 3
11:03 camelia rakudo-moar b5780f: OUTPUT«True␤»
11:04 gregf_ joined #perl6
11:07 mohae joined #perl6
11:10 Actualeyes joined #perl6
11:10 rindolf joined #perl6
11:17 Rawriful joined #perl6
11:19 ilmari[m] joined #perl6
11:22 kent\n joined #perl6
11:26 M-Illandan joined #perl6
11:26 Matthew[m] joined #perl6
11:26 tadzik joined #perl6
11:26 Guest99321 joined #perl6
11:26 Matias[m] joined #perl6
11:39 CIAvash joined #perl6
11:42 pierre___ joined #perl6
11:52 domidumont joined #perl6
12:06 pierre_ joined #perl6
12:11 AlexDaniel joined #perl6
12:25 nicq20 joined #perl6
12:28 nicq20 Hello o/
12:29 masak m: say "ohayo nicq20!"
12:29 camelia rakudo-moar b62321: OUTPUT«ohayo nicq20!␤»
12:44 dalek doc: 0acb8ea | coke++ | doc/Type/Regex.pod6:
12:44 dalek doc: use our standard phrasing here
12:44 dalek doc: review: https://github.com/perl6/doc/commit/0acb8eaaa1
12:49 gensym joined #perl6
12:52 vendethiel joined #perl6
13:10 ab6tract joined #perl6
13:26 rurban joined #perl6
13:32 vendethiel- joined #perl6
13:33 skids joined #perl6
13:34 cdg joined #perl6
13:34 ab6tract long ago i started working on making (^) work with bags
13:35 kurahaupo__ joined #perl6
13:36 ab6tract anyone feel strongly about it?
13:36 pierre_ joined #perl6
13:38 LeCamarade joined #perl6
13:39 LeCamarade Hello, Perl 6; I have Raspbian on a Pi. The Rakudo is from 2014. Will I succeed in compiling one there, or is there a .deb somewhere?
13:40 LeCamarade The Rakudo from the repositories is pre-Christmas. I had trouble compiling before on thin machines like this one. Need I bother? Anybody done done it before?
13:41 timotimo compiling on a raspberry pi will definitely require a bunch of swap space
13:41 timotimo and multiple days of waiting :)
13:41 timotimo debian's got debs for multiple architectures of moarvm as least, i think?
13:42 LeCamarade Right. So I will settle for a pre-compiled ... if I should be able to locate one.
13:42 lizmat https://github.com/nxadm/rakudo-pkg/releases
13:42 lizmat El_Che++
13:42 sufrostico joined #perl6
13:43 khw joined #perl6
13:43 sufrostico left #perl6
13:43 sufrostico joined #perl6
13:46 sufrostico left #perl6
13:46 sufrostico joined #perl6
13:46 ponzii joined #perl6
13:47 sufrostico left #perl6
13:47 sufrostico joined #perl6
13:48 ponzii Is there a more efficient way to do this:  for 'logs.txt'.IO.lines -> $_ { .say if $_ ~~ /<<\w ** 15>>/; }
13:49 masak mebbe: for 'logs.txt'.IO.lines { .say if any(.words>>.chars) == 15 }
13:49 sufrostico joined #perl6
13:50 masak or .say if .words.first(*.chars == 15)
13:50 timotimo really depends on what you need the << and >> for
13:51 * masak 's mental colomon wakes up and tells masak to use .grep there, not .first
13:51 ponzii That's a regex not a char count
13:51 timotimo because words splits on space, doesn't it?
13:51 masak oh, right
13:51 masak yes, those are not identical
13:51 masak more similar would be to do .comb(/\w+/), not .words
13:52 sufrostico left #perl6
13:53 ponzii The Python3 and Ruby 2.4 equivalents are still 5 times faster. That's with October Rakudo.
13:53 timotimo yeah, our regexes aren't really very fast
13:53 masak I'm happily surprised to hear the others are only 5 times as fast ;)
13:54 ponzii timotimo: That's weird as in a lot of math examples Perl6 can be 25 time faster than Python.
13:54 timotimo of course
13:54 timotimo except if you compare perl6 vs pypy. then it's pretty much impossible to beat python :)
13:54 ponzii timotimo: ... and strings/regex has traditionally been Perl's forte
13:55 arnsholt It's pretty easily explained
13:55 arnsholt Perl 5 regexes are souped-up automata
13:55 arnsholt Perl 6 regexes are top-down parsers
13:55 sufrostico joined #perl6
13:55 timotimo still, a whole bunch of perl6 regexes can become completely automata-based
13:56 timotimo ... in theory
13:56 grondilu joined #perl6
13:56 ponzii arnsholt: Does that mean they'll never be as efficient as Perl5 then?
13:56 sufrostico left #perl6
13:56 arnsholt Not necessarily
13:56 arnsholt Lots of it can be optimized to a more efficient form
13:56 masak they could probably be a bunch faster still
13:56 arnsholt Yeah, definitely
13:56 sufrostico joined #perl6
13:56 masak we're just pressed for time doing all the obvious optimizations ;)
13:57 arnsholt Yeah, lots of things to do, not so many people to do it
13:57 timotimo i'm pretty sure there hasn't been a bit of work done on the regex optimizer in the last year
13:58 ponzii masak: On my machine that log file parse took Perl6 11.03 secs while PHP71 took 0.43 secs.
13:58 ponzii masak: Still perplexed how PHP7 is significantly faster than Node and Perl5
14:00 Actualeyes joined #perl6
14:00 pmurias joined #perl6
14:00 pmurias ponzii: significantly faster in general or on one particular benchmark?
14:01 ponzii pmurias: Well, file i/o + parsing but yes, Perl6 math is pretty impressive
14:02 timotimo if you think perl6 math is impressive, wait until we're able to remove all those NativeRef allocations ...
14:02 timotimo and the boxing/unboxing
14:02 timotimo and jit small-bigint-math
14:04 timotimo for math stuff, there's definitely room for improvement still
14:04 ponzii timotimo: Well, that's certainly great but maybe Perl6 adoption is going to be affected more by how well it does what Perl5 did well, ie. strings/regex?
14:04 ponzii timotimo: Perception counts for adoption.
14:04 timotimo you're certainly free to invest time in that
14:05 timotimo did you see the recent commits, btw?
14:05 timotimo lizmat made almost everything related to invoking regexes a whole bunch faster
14:05 timotimo you were saying you're using an "october rakudo"?
14:05 timotimo i think the majority of these improvement commits have been made after that release, but i could be mistaken
14:05 ponzii timotimo: Yes, just tested the latest version.
14:06 ponzii timotimo: Sorry, latest public .dmg, not recent commits.
14:10 pmurias ponzii: speed is the biggest thing holding Perl 6 back
14:11 LeCamarade And that is just a matter of time. Goodness is the main thing holding every other alternative back. And that cannot be fixed for them.
14:12 LeCamarade Sorry, fundamentalist Perlist here. Tried to resist. Couldn't.
14:12 viki Yes, the .match improvements were after the 2016.10 release.
14:13 timotimo i bet we can make a scan for a << much faster
14:13 Bname joined #perl6
14:13 timotimo currently it'll be trying to match a LWB every character by looking one back and one in front
14:13 timotimo we should be able to jump 2 chars each time instead of just 1
14:15 viki ponzii: to me, it feels strange to measure up Perl 6 to Perl 5. It's a very different language. I'd expect people to use Perl 6 more for large OO projects, due to its rich and expressive object model. The "string and regex" sounds more like the perl -pi -e '' one liner you run at your command line.
14:16 viki ponzii: a crude comparison of equivalent Perl 6 and Rust code, for my point: https://twitter.com/zoffix/status/792398913521192960
14:17 viki I don't even notice Perl 6's performance issues that much any more. I think comparing to language XYZ is a bit meaingless. Real world code is what matters.
14:17 viki buggable: eco
14:17 buggable viki, Out of 739 Ecosystem dists, 165 have warnings and 0 have errors. See https://modules.perl6.org/update.log for details
14:17 ponzii viki: I think from an insider's viewpoint you're probably right but I suspect that in the job market Perl6 will be judged according to how well it does what Perl5 does well. Unfortunate but probably the case.
14:18 viki ^ if Perl 5 code does that .3s faster, I couldn't care less.
14:18 viki ponzii: how did you arrive to that conclusion? My impression is "the job market" doesn't want much to do with Perl 5. Why would they be comparing other langs to it?
14:20 ponzii viki: Because it's still called Perl :(
14:20 viki :)
14:20 viki Fair enough.
14:20 AlexDaniel heh
14:21 ponzii viki: Perl5, Perl6 invites the comparison in publications such as InformIT etc. Yes, I know they're crap but they still have influence with CTOs.
14:21 viki Well, I think our optimizations are progressing nicely. I'm putting my chips behind TimToady's remarks that we want nice organic growth; not too slow, not to fast and so far it's working.
14:21 ponzii viki: Sure, I get that.
14:23 timotimo anybody up for trying an experiment with the left-word-boundary regex thing?
14:23 timotimo i'm willing to give someone step-by-step help
14:24 * viki is burnt out and is taking a ~2-3 week break.
14:24 timotimo that's fine :)
14:25 AlexDaniel I'm not quite sure why people care about optimizations so much… Like you know, we have some really basic stuff not working properly…
14:26 timotimo AlexDaniel, performance is holding me back from doing stuff i consider fun. that's why i'm interested in things getting faster
14:27 AlexDaniel timotimo: well, if you actually start doing that stuff (ignoring performance problems), you'll probably stumble upon a couple of nasty random segfaults…
14:27 AlexDaniel so what's more important…
14:28 kaare__ joined #perl6
14:28 timotimo it's not like an optimization is as hard as fixing a nasty segfault
14:28 canopus_ joined #perl6
14:29 jnthn AlexDaniel: As I've noted before, the things that people most want optimized are generally not the same set of things that have reliability issues.
14:30 lizmat joined #perl6
14:30 AlexDaniel which is weird, because once you stumble upon performance issues you very often start to parallelize things
14:31 AlexDaniel jnthn: by the way, any news on #129781 ?
14:31 timotimo when i last had a performance issue and wanted to parallelize it got many times slower :)
14:32 ab6tract lizmat: i think it would be much nicer for (^) to return a bag
14:32 ab6tract if any of the args were bags
14:33 lizmat well volunteered  :-)
14:33 timotimo i seem to recall a big patch series to fix all manner of bag-related things
14:33 timotimo that was probably yours?
14:33 ab6tract i have a feeling i had already patched it and it got optimized away :)
14:33 ab6tract timotimo: indeed :)
14:34 lizmat ab6tract: I generally don't optimize away functionality
14:34 ab6tract then i never implemented it properly :D
14:34 timotimo must have missed spec tests :<
14:34 ab6tract right now the implementation is quite nice because it gets to be an only
14:34 ab6tract whereas i (think i) would need to create different candidates
14:35 jnthn AlexDaniel: https://github.com/perl6/nqp/commit/5224878b2869ab033dbe4fc78e8e3cf3efff9e89 and https://github.com/perl6/nqp/commit/c0e80f8933649c97b3273ad081b6f353eae12a2f may well have helped with the original problem
14:35 jnthn AlexDaniel: But the ticket got mis-golfed
14:36 jnthn AlexDaniel: Valgrind uses --full-cleanup, and all the issues in the further golfed versions are nothing to do with the bug that was initially considered.
14:36 jnthn But rather, a --full-cleanup issue
14:37 pierre_ joined #perl6
14:39 ab6tract i don't suppose we use subsets/where clauses in CORE very often?
14:40 timotimo well, hopefully not :)
14:40 timotimo they're slow ;)
14:43 ab6tract slower than doing the same check inside the sub anyway?
14:44 timotimo good question
14:47 AlexDaniel jnthn: not sure if it helped, the issue is still there
14:48 AlexDaniel not sure if it is the same one though, but the snippet does not run reliably
14:50 sufrostico joined #perl6
14:54 synopsebot6 joined #perl6
14:54 timotimo #129781
14:54 synopsebot6 Link:  https://rt.perl.org/rt3//Public/Bug/Display.html?id=129781
14:56 ab6tract luckily there is a smarter way to deal with it
14:56 ab6tract the tricky thing about "symmetric difference" of a list of bags/mixes
14:56 ab6tract is that order matters
14:56 ab6tract which means you kind of lose the symmetry bit
14:57 ab6tract so maybe it is fine that they get converted to Set if there is a list of them
14:57 timotimo here i have an explosion where MVM_string_gi_init falls over a b0rked "first" when called via MVM_repr_at_key_o
14:57 lizmat ab6tract: if the order matters, how can Set/Bag/Mix work, as they don't preserve order ?
14:57 timotimo from find_method, interestingly
14:58 timotimo that's funny. tried to MVM_dump_backtrace and it segfaulted here:
14:58 timotimo MVM_exception_backtrace_line (tc=tc@entry=0x7fffe8061cb0, cur_frame=0x45, not_top=0) at src/core/exceptions.c:317
14:58 timotimo 317     MVMString *filename = cur_frame->static_info->body.cu->body.filename;
14:59 ab6tract lizmat: order of the list of Bags
14:59 ab6tract [(^)] ($b1, $b2, $b3)
14:59 ab6tract vs
14:59 ab6tract [(^)] ($b3, $b1, $b2)
15:00 ab6tract whereas $b1 (^) $b2 and $b2 (^) $b1 are symmetric
15:02 timotimo also, it looks like one commit i merged in is a bit ... explosive :)
15:02 ab6tract note that i belive you current implementation of [(^)] is valid for bags and mixes because it coerces them to sets
15:03 ab6tract but it could be arguably confusing to have (^) return a bag when it is purely infix and a set when it is applied via reduce
15:04 ab6tract i think this is where i got stuck before
15:07 ab6tract then again, i would vastly prefer ( 'x' => 6 ).Bag (^) ( 'x' => 4).Bag to return bag(:x(2) than set()
15:11 ab6tract https://gist.github.com/anonymous/c4c847ca058ce1595bcce349bab4a727#file-gistfile1-txt
15:11 ab6tract naive, but appears to work
15:13 timotimo AlexDaniel: it's memory-corrupty-explodey, but i can't get it to die earlier than the whole explosion from the --full-cleanup thing
15:19 ocbtec joined #perl6
15:19 ocbtec joined #perl6
15:19 timotimo AlexDaniel: please know that i'm only not fixing that problem because it's really god damn not easy
15:20 CIAvash joined #perl6
15:20 AlexDaniel I understand that
15:20 timotimo that's why i prefer fiddling with optimizations instead
15:21 * jnthn is currently investigating RT #129834, fwiw
15:21 timotimo synopsebot6: #129834
15:21 synopsebot6 Link:  https://rt.perl.org/rt3//Public/Bug/Display.html?id=129834
15:21 obfusk joined #perl6
15:21 timotimo synopsebot6: #129834,
15:21 synopsebot6 Link:  https://rt.perl.org/rt3//Public/Bug/Display.html?id=129834
15:21 timotimo did it not trigger because of the /me in front?
15:21 * timotimo tests #129834
15:21 timotimo seems to be it
15:21 jnthn heh :)
15:22 * jnthn is quite sure that's an eaiser bug to hunt down than this one :)
15:22 AlexDaniel timotimo: what do you mean by you can't get it to die before --full-cleanup?
15:22 timotimo well, every traceback that valgrind shows me includes MVM_gc_global_destruction in it
15:23 jnthn timotimo: I gave it a quick run and observed the same fwiw
15:26 AlexDaniel how to disable --ful-cleanup?
15:26 nicq20 joined #perl6
15:26 AlexDaniel l*
15:27 jnthn the perl6-valgrind-m script is what passes it
15:31 AlexDaniel can't see it
15:32 timotimo should be in the last line
15:37 [Coke] are you using rakudobrew?
15:38 [Coke] (in which case you want something like ~/.rakudobrew/moar-200364a/perl6-valgrind-m) rather than the one in your path
15:39 seatek joined #perl6
15:41 AlexDaniel [Coke]: yeah, was trying to reverse-engineer that to figure it out… thank you very much!
15:43 AlexDaniel ah, alright, got that going
15:50 kyclark joined #perl6
15:51 kyclark I’ve a little script where I’d like to “prompt” for a single character input (http://pastie.org/10953897).  Is there any way to have “prompt” immediately return as soon as the user types any one thing (without hitting “Enter”)?
15:52 [Coke] prompt is meant for reading lines; if you just want the first thing, that's a different call. one sec.
15:52 timotimo you have to .read a single byte from STDIN
15:53 timotimo make sure you're reading bytes, not graphemes, because that'd cause it to wait for stuff like composing characters to come in later
15:54 [Coke] ah, that would explain why getc hangs
15:55 timotimo quite
15:55 AlexDaniel ouch
15:55 timotimo a sad consequence of doing things right
15:55 [Coke] ah, no, getc seems to require an enter?
15:55 timotimo probably also accepts a space
15:55 timotimo or a second letter
15:56 [Coke] timotimo: abcd didn't cause it to come back.
15:56 timotimo oh? interesting
15:56 timotimo "The operation is blocking and the stream may be buffered."
15:56 [Coke] um, even perl6 -e 'say $*IN.read(1)' requires an enter?
15:56 timotimo huh.
15:57 timotimo oh
15:57 timotimo you have to set the terminal to unbuffered first, of course
15:57 jnthn iirc it's about terminals
15:57 jnthn http://stackoverflow.com/questions/1798511/how-to-avoid-press-enter-with-any-getchar is a C program with the same issue
15:57 timotimo and be sure to reset the state later, otherwise people are going to get mad at your program when it crashes :)
15:57 ilmari suffering with buffering
15:57 ab6tract joined #perl6
15:59 [Coke] that seems like an excellent thing to mention in the docs. :)
15:59 timotimo we should probably point that out a bit more clearly on the doc page for it
16:01 rindolf joined #perl6
16:01 wamba joined #perl6
16:02 seatek is dd known to get easily confused with Match's ?
16:03 AlexDaniel seatek: by confused you mean what?
16:03 AlexDaniel the way it prints stuff is confusing, yes
16:03 seatek it's hanging on me using 100% CPU whenever I use it on a match that includes an action
16:03 seatek wheras say works fine
16:03 vendethiel joined #perl6
16:04 seatek m: grammar G { token TOP {.*}}; class GC { method TOP ($/) { make $/ }}; my $m = G.parse('test here', actions => GC.new); dd $m;
16:04 timotimo hehe.
16:04 timotimo infinite mutual recursion, i bet
16:04 AlexDaniel ooops
16:04 camelia rakudo-moar a6eeaa: OUTPUT«(timeout)»
16:04 timotimo well, maybe not
16:04 timotimo but it could be
16:04 seatek m: grammar G { token TOP {.*}}; class GC { method TOP ($/) { make $/ }}; my $m = G.parse('test here', actions => GC.new); say $m;
16:04 camelia rakudo-moar a6eeaa: OUTPUT«「test here」␤»
16:04 seatek hehe
16:05 AlexDaniel committable6: 6c grammar G { token TOP {.*}}; class GC { method TOP ($/) { make $/ }}; my $m = G.parse('test here', actions => GC.new); dd $m;
16:05 AlexDaniel that was a bad idea :)
16:05 seatek :)
16:05 AlexDaniel committable6: 2015.12 grammar G { token TOP {.*}}; class GC { method TOP ($/) { make $/ }}; my $m = G.parse('test here', actions => GC.new); dd $m;
16:07 AlexDaniel seatek: actually, it makes sense
16:07 committable6 AlexDaniel, ¦«2015.12,2016.02,2016.03,2016.04,2016.05,2016.06,2016.07.1,2016.08.1,2016.09,2016.10,HEAD»: «timed out after 10 seconds, output»:  «exit signal = SIGHUP (1)»
16:07 committable6 AlexDaniel, ¦«2015.12»: «timed out after 10 seconds, output»:  «exit signal = SIGHUP (1)»
16:07 AlexDaniel seatek: and I'm not sure if it's dd's fault
16:08 AlexDaniel yea, it's not…
16:08 setty1 joined #perl6
16:08 seatek yeah i don't know how dd processes objects differently than say
16:08 AlexDaniel I mean, you could argue that dd should not recurse that deep
16:08 AlexDaniel seatek: well, look:
16:08 AlexDaniel m: grammar G { token TOP {.*}}; class GC { method TOP ($/) { make ‘hello’ }}; my $m = G.parse(‘test here’, actions => GC.new); dd $m
16:08 camelia rakudo-moar a6eeaa: OUTPUT«Match $m = Match.new(ast => "hello", list => (), hash => Map.new(()), orig => "test here", to => 9, from => 0)␤»
16:09 AlexDaniel seatek: the problem is that in your case ast is the same match object
16:09 AlexDaniel it's like if you did $m.ast = $m
16:09 seatek oo interesting
16:10 timotimo haha, $/ make $/, that's clever!
16:10 kshannon joined #perl6
16:10 edenc joined #perl6
16:10 adrusi joined #perl6
16:10 AlexDaniel so in an attempt to print $m it has to print it's ast… which is $m. And so it goes on and on
16:10 timotimo hm. but we have perlseen and gistseen
16:11 timotimo we should be using that for this, too
16:11 BuildTheRobots joined #perl6
16:11 timotimo m: my @foo = 1, 2, 3; @foo.push(@foo); say @foo.perl
16:11 camelia rakudo-moar ed2631: OUTPUT«(my \Array_58637040 = [1, 2, 3, Array_58637040])␤»
16:11 damnlie joined #perl6
16:15 LeCamarade joined #perl6
16:26 jsimonet Hello, I'm trying to write a grammar, and I would like to use an attribute to keep a state during parsing. Attributes are not allowed in rule/token/regexes, so I have to use a contextual variable but I don't know how to do this insided a token/rule.
16:31 viki jsimonet: why are they not allowed?
16:33 viki m: grammar Foo { has $!meow; token TOP { <foo> { say $!meow } }; token foo { .+ { $!meow = 42 } } }; Foo.new.parse: '42'
16:33 camelia rakudo-moar ed2631: OUTPUT«5===SORRY!5===␤Attribute $!meow not available inside of a regex, since regexes are methods on Cursor.␤Consider storing the attribute in a lexical, and using that in the regex.␤at <tmp>:1␤------> 3!meow; token TOP { <foo> { say $!meow } 7⏏5…»
16:33 viki I see.
16:33 jnthn :my $*FOO = 42;
16:33 jsimonet yes, this is this error.
16:33 jnthn (Just like a normal contextual decl, but with a : before it)
16:34 viki m: grammar Foo { has $!meow; token TOP { :my $*meow; <foo> { say $*meow } }; token foo { .+ { $*meow = 42 } } }; Foo.new.parse: '42'
16:34 camelia rakudo-moar ed2631: OUTPUT«42␤»
16:34 timotimo the $!meow obviously wants to go away
16:34 timotimo it serves no purpose there
16:35 timotimo except to confuse
16:35 viki right
16:35 jsimonet Is it the attribute wich is used, or $*meow is another variable ?
16:35 viki jsimonet: $*moew is just a dynamic variable
16:35 jsimonet ok
16:35 jsimonet So I can use it in <?{ * }>?
16:36 viki Yeah
16:36 jsimonet Ok, is there a documentation page about this ?
16:36 viki jsimonet: https://docs.perl6.org/language/variables#The_*_Twigil
16:37 viki jsimonet: they're not grammar-specific, FWIW. They're just like normal variables, except they're dynamically scoped and not lexically scoped, like $foo is
16:37 viki jsimonet: you know about make/made, right?
16:37 viki (another way you can pass data around between tokens)
16:38 sjoshi joined #perl6
16:38 jsimonet viki: yes, it's for constructing an AST. I wanted to keep separated the two (parsing and creating the AST).
16:39 FROGGS joined #perl6
16:39 viki m: grammar Foo { token TOP { <foo> { say $/<foo>.made } }; token foo { .+ { make 42 } } }; Foo.new.parse: "42"
16:39 camelia rakudo-moar ed2631: OUTPUT«42␤»
16:39 viki OK
16:40 viki m: grammar Foo { token TOP { <foo> { say $/<foo>.made } }; token foo { .+ { make {:ast("meow"), :other-stuff(42)} } } }; Foo.new.parse: "42"
16:40 camelia rakudo-moar ed2631: OUTPUT«{ast => meow, other-stuff => 42}␤»
16:41 jsimonet I see :)
16:41 jsimonet It seems my grammar now parses correctly, thank you!
16:42 viki Any time.
16:44 FROGGS o/
16:44 viki m: grammar Foo { has $.meow is rw; token TOP { <foo> { say $¢.meow } }; token foo { .+ { $¢.meow = 42 } } }; Foo.new.parse: "42"
16:44 camelia rakudo-moar ed2631: OUTPUT«(Any)␤»
16:44 jsimonet The :my is for defining in the current scope right ?
16:45 viki Yeah
16:45 viki You can't use { ... } since that would just limit the scope to that block
16:45 jsimonet I tried :)
16:50 dalek doc: bebe42e | (Tom Browder)++ | doc/Language/functions.pod6:
16:50 dalek doc: use possessive
16:50 dalek doc: review: https://github.com/perl6/doc/commit/bebe42e15c
16:50 rindolf joined #perl6
16:57 tbrowder hi, #perl6
16:58 viki \o\
16:58 tbrowder hi, viki, is there anything like a c++ stream in p6?
16:59 viki Never used C++
16:59 tbrowder i would like use use some common code to write to either a file or a string
17:01 liztormato joined #perl6
17:02 [Coke] here's a simple example of how you override IO style methods to write to a string.
17:02 [Coke] https://github.com/perl6/roast/blob/master/rosettacode/sierpinski_triangle.t#L28
17:03 tbrowder thanks, [Coke]
17:03 [Coke] this looks like a more fleshed out version that goes to a blob:
17:03 [Coke] https://github.com/moznion/p6-IO-Blob
17:04 viki ISAGN for IO::FakeFile :)
17:05 viki Something that inherits IO::Handle and overrides all relevant methods to work with a string/Blob buffer
17:07 viki IO::Blob seems to be it
17:10 tbrowder roger, thank!
17:10 eliasr joined #perl6
17:11 wamba joined #perl6
17:14 tbrowder looks like IO::String is in the ecosystem and IO::Blob is not
17:15 viki Wow, the "free" certs with letsencrypt sure have a hefty pricetag: https://letsencrypt.org/2016/11/01/launching-our-crowdfunding-campaign.html Hard to imagine them raising $2,500,000/year considering a giant like Wikipedia pulls $75m
17:16 viki tbrowder: it's in it: http://modules.perl6.org/#q=Blob
17:17 AlexDaniel letsencrypt is quite big too
17:19 viki Is it? So far, the only people recommending it to me are nerds who give it as an excuse when I say certs are expensive.
17:19 viki Hard to imagine the same group being donors who consistently pull 2.5mil
17:19 tbrowder viki, thanks, i searched on IO:: and missed it
17:30 tbrowder ref let's encrypt: i intend to contribute. had my Scottish side hanging hat on StartSSL which was great deal at approx $30/yr (unlimited certs)--but it's gone kaput now. i know there are other cheapies, out there but, but i like the automation aspects (but haven't tried them yet);
17:32 itaipu joined #perl6
17:33 moritz fwiw the *.perl6.org sites all use let's encrypt
17:33 moritz as well as my personal sites
17:33 kurahaupo__ joined #perl6
17:33 moritz and the automation is awesome
17:34 moritz investigating alternative clients is also worth it; I use simp_le for some of my pages
17:35 tbrowder moritz: have you found. p6 client for it?
17:35 moritz tbrowder: no; I tend to be pretty pragmatic when it comes to the infrastructure
17:37 zakharyas joined #perl6
17:38 viki moritz: and how much do you plan to donate to letsencrypt? >:)
17:38 tbrowder well it's good to get yr rec, moritz
17:39 viki I'm reading their responses on HN thread and the person says this would be just a small part of their budget, so even if it fails, it's no biggie.
17:39 cdg joined #perl6
17:39 moritz viki: not sure yet. Maybe O(50USD)
17:40 viki ( https://news.ycombinator.com/item?id=12847882 )
17:40 moritz maybe more after I've held the P6 training, and got paid for it :-)
17:41 viki Did you just use the big-O notation with money?
17:41 viki :)
17:42 moritz I did, knowing it's not mathematically correct
17:42 viki :D
17:43 moritz I also use O(scary) for some algorithms
17:48 geekosaur O(whoops) for algorithms with a good-looking big-O but terrible constants >.>
17:50 rindolf joined #perl6
18:09 nicq20 joined #perl6
18:09 nicq20 Hey-o
18:16 wamba joined #perl6
18:18 Tonik joined #perl6
18:22 hankache joined #perl6
18:27 seatek oh my gosh. i finally understand how actions tie into grammars, and what make and made does, as a user.. and it's not at all what the docs lead me to believe. i'm going to just wander around in circles now for a while waving my hands in the air and shaking my head and mumbling about stuff
18:27 seatek then i'll write up a proper intro them
18:29 AlexDaniel seatek++ :)
18:29 AlexDaniel seatek: so what are actions for? :)
18:29 seatek going to those docs to learn grammar is like going to someone to learn how to play the piano, and the drop a grand piano on your head and say here you go!
18:30 seatek actions are for futzing with the grammar results... that's the easy bit.. the hard bit is figuring out what make and made is for
18:30 seatek and how that ties into the whole picture of what you're trying to accomplish
18:31 hankache seatek++
18:31 zakharyas joined #perl6
18:35 tbrowder ref IO::Blob: i can write to a string (at least i got no pushback) but can't sa
18:35 tbrowder y the string
18:36 viki seatek: there's a doc Issue for it, FWIW: https://github.com/perl6/doc/issues/897#issuecomment-248087306
18:37 viki tbrowder: $io-blob-obj.data.encode.say
18:38 seatek i don't think anyone should be allowed to write anything about grammars that had anything to do with making them, or who has become completely fluent in them
18:38 viki Doesn't that apply to all docs? :)
18:39 seatek prolly ;)
18:39 nicq20_ joined #perl6
18:39 tbrowder m: use IO::Blob; my $str = ''; my $io = IO::Blob.open($str); $io.print("blah\n"); $io.data.say
18:39 camelia rakudo-moar ed2631: OUTPUT«===SORRY!===␤Could not find IO::Blob at line 1 in:␤    /home/camelia/.perl6␤    /home/camelia/rakudo-m-inst-2/share/perl6/site␤    /home/camelia/rakudo-m-inst-2/share/perl6/vendor␤    /home/camelia/rakudo-m-inst-2/share/perl6␤    CompUnit::Repo…»
18:39 tbrowder ok, back to the 'puter
18:40 AlexDaniel seatek: well, then you'd have no docs on grammars at all :P
18:40 AlexDaniel I wonder if that would've been better
18:40 viki tbrowder: you're missing .encode. .data is a Blob
18:40 viki tbrowder: another method: https://github.com/moznion/p6-IO-Blob/blob/master/lib/IO/Blob.pm6#L256-L258
18:40 AlexDaniel seatek: but yes, I really think that you can make it better, so hoping to see a PR :)
18:42 nicq20 joined #perl6
18:43 lizmat joined #perl6
18:46 seatek AlexDaniel: no the docs were great - I couldn't have learned without them, and without our conversation last night here. it took experimenting on my part though with say and dd to finally understand
18:46 nicq20 joined #perl6
18:47 seatek (and unit tests with varying inputs ;) )
18:48 viki m: https://gist.github.com/zoffixznet/3598d276e2cfdcae3b3761e142797093
18:48 camelia rakudo-moar ed2631: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤The following packages were stubbed but not defined:␤    IO::Blob␤at <tmp>:243␤------> 3<BOL>7⏏5<EOL>␤    expecting any of:␤        statement end␤»
18:48 viki How come it says that?
18:50 seatek AlexDaniel: i plan on writing something up tonight, after a shower.
18:50 moritz viki: looks like a bug
18:50 AlexDaniel committable6: 6c https://gist.githubusercontent.com/zoffixznet/3598d276e2cfdcae3b3761e142797093/raw/1850b2d3cd2ecdc50aa89e47eb74aaf17d6851a0/p6.p6
18:50 committable6 AlexDaniel, Successfully fetched the code from the provided URL.
18:50 committable6 AlexDaniel, https://gist.github.com/bbfc1840a530f78d73e00569ebf6a1d1
18:51 viki tbrowder: sorry, .decode, not .encode
18:52 AlexDaniel m: class IO::Blob { … }
18:52 camelia rakudo-moar ed2631: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤The following packages were stubbed but not defined:␤    IO::Blob␤at <tmp>:1␤------> 3class IO::Blob { … }7⏏5<EOL>␤    expecting any of:␤        postfix␤        statement end␤»
18:52 viki m: class IO::Blob { … }; class IO::Blob {}
18:52 camelia rakudo-moar ed2631: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤The following packages were stubbed but not defined:␤    IO::Blob␤at <tmp>:1␤------> 3class IO::Blob { … }; class IO::Blob {}7⏏5<EOL>␤    expecting any of:␤        postfix␤        stateme…»
18:52 viki m: class IO::Blob { ... }; class IO::Blob {}
18:52 camelia rakudo-moar ed2631: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤The following packages were stubbed but not defined:␤    IO::Blob␤at <tmp>:1␤------> 3lass IO::Blob { ... }; class IO::Blob {}7⏏5<EOL>␤    expecting any of:␤        postfix␤        statemen…»
18:52 viki star: class IO::Blob { ... }; class IO::Blob {}
18:52 camelia star-m 2016.04: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤The following packages were stubbed but not defined:␤    IO::Blob␤at <tmp>:1␤------> 3lass IO::Blob { ... }; class IO::Blob {}7⏏5<EOL>␤    expecting any of:␤        postfix␤        statement en…»
18:53 viki weird...
18:53 viki Oh
18:53 viki m: class Meow::Blob { ... }; class Meow::Blob {}
18:53 camelia rakudo-moar ed2631: ( no output )
18:53 moritz is it because IO is a role?
18:53 viki Prolly. I think there's a ticket for this sort of package clashes
18:53 moritz m: role Meow { }; class Meow::Blob { ... }; class Meow::Blob {}
18:53 camelia rakudo-moar ed2631: ( no output )
18:54 moritz m: role Meow { ... }; role Meow { }; class Meow::Blob { ... }; class Meow::Blob {}
18:54 camelia rakudo-moar ed2631: ( no output )
18:54 tbrowder ok, that works, but, so far, i don't see that i can use the io handle like a file handle, so it does no good for my use case
18:54 viki It's that IO:: is provided by core.
18:54 viki tbrowder: IO::Blob *is* a IO::Handle.
18:54 moritz m: class Str::Foo { ... }; class Str::Foo { }
18:54 camelia rakudo-moar ed2631: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤The following packages were stubbed but not defined:␤    Str::Foo␤at <tmp>:1␤------> 3ass Str::Foo { ... }; class Str::Foo { }7⏏5<EOL>␤    expecting any of:␤        postfix␤        statemen…»
18:54 viki tbrowder: so I'm unsure what sort of use you're not achieving
18:55 tbrowder yes, but i want to write the resulting string to a file
18:55 viki tbrowder: which file?
18:56 viki And this should be the ticket, though seems like RT is down: https://rt.perl.org/Public/Bug/Display.html?id=129856#ticket-history
18:56 viki oh, works now.
18:58 tbrowder any file i want to open for writing.  the whole point is to be able to use lots of the same code for either (1) writing to a real string or (2) an open file handle just by selecting the proper IO::Handle
18:59 viki tbrowder: right, so one IO::Handle is the proper file and another IO::handle is the IO::Blob. Your IO::Handle handling code will work equally the same with a basic IO::Handle as it does with IO::Blob.
19:00 viki And the "just by selecting" bit will select between those
19:01 espadrine joined #perl6
19:02 hankache_ joined #perl6
19:04 silug joined #perl6
19:07 tbrowder ok, i'll see if i can get it to work.  since the writable string is a blob, is there a foolproof way, in a script, to convert it to a real string?
19:08 viki Not really.
19:08 viki You need to know what encoding that data is in.
19:09 viki But same applies to a file.
19:10 tbrowder but since i create the blob, i should know the encoding.
19:11 viki Sure.
19:12 viki s: open("/tmp/foo", :w), 'seek'
19:12 SourceBaby viki, Sauce is at https://github.com/rakudo/rakudo/blob/ed2631c/src/core/IO/Handle.pm#L627
19:12 tbrowder here's what i want to be able to do: write to a blob, convert it to a real string, then choose to write it to a file or just return to as a string to the caller
19:14 viki I thought you said you knew the encoding? So why is the blob envolved at all?
19:15 viki m: my $f = open("/tmp/foo", :rw); sub handling-code { $^file.write: "meows".encode; }; handling-code $f; $f.seek: 0, SeekFromBeginning; $f.slurp-rest.say
19:15 camelia rakudo-moar ed2631: OUTPUT«open is disallowed in restricted setting␤  in sub restricted at src/RESTRICTED.setting line 1␤  in sub open at src/RESTRICTED.setting line 9␤  in block <unit> at <tmp> line 1␤␤»
19:16 viki baahh
19:16 viki m: class IO::Blob { has $!data; method write ($v) { $!data = $v }; method seek ($,$) {}; method slurp-rest { $!data.decode } }; my $f = IO::Blob.new; sub handling-code { $^file.write: "meows".encode; }; handling-code $f; $f.seek: 0, SeekFromBeginning; $f.slurp-rest.say
19:16 camelia rakudo-moar ed2631: OUTPUT«meows␤»
19:16 viki ^ that's what I imagined you were talking about when you said you wanted to use same code for file and string writing.
19:16 viki But now what you're saying sounds like you just want a conditional that spurts into a file :|
19:19 viki multi method result ($file) { $file.IO.spurt: $!data }; multi method result { $!data } # and I don't see why blobs need to be involved unless you're dealing with bytes
19:19 tbrowder yes, but i wanted to write to the handle if possible, but i see that still has to be converted from blob to string, so just writing normally to a string first and then writing it to a file would work much easier.
19:19 ab6tract joined #perl6
19:19 ab6tract RT #124529
19:19 synopsebot6 Link:  https://rt.perl.org/rt3//Public/Bug/Display.html?id=124529
19:21 viki That's a terrible skip description :/
19:24 viki m: sub showkv($x) { $x.keys.sort.map({ $^k ~ ':' ~ $x{$k} }).join(' ') }; sub symmetric-difference($a, $b) { ($a (|) $b) (-) ($b (&) $a) }; my $s = set <blood love>; my $b = bag <blood blood rhetoric love love>; is showkv($s (^) $b), showkv(symmetric-difference($s, $b)), "Bag symmetric difference with Set is correct";
19:24 camelia rakudo-moar ed2631: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤    is used at line 1␤␤»
19:24 viki m: use Test; sub showkv($x) { $x.keys.sort.map({ $^k ~ ':' ~ $x{$k} }).join(' ') }; sub symmetric-difference($a, $b) { ($a (|) $b) (-) ($b (&) $a) }; my $s = set <blood love>; my $b = bag <blood blood rhetoric love love>; is showkv($s (^) $b), showkv(symmetric-difference($s, $b)), "Bag symmetric difference with Set is correct";
19:24 camelia rakudo-moar ed2631: OUTPUT«not ok 1 - Bag symmetric difference with Set is correct␤␤# Failed test 'Bag symmetric difference with Set is correct'␤# at <tmp> line 1␤# expected: 'blood:1 love:1 rhetoric:1'␤#      got: 'rhetoric:True'␤»
19:24 viki Is that the only difference?
19:24 viki committable6: HEAD use Test; sub showkv($x) { $x.keys.sort.map({ $^k ~ ':' ~ $x{$k} }).join(' ') }; sub symmetric-difference($a, $b) { ($a (|) $b) (-) ($b (&) $a) }; my $s = set <blood love>; my $b = bag <blood blood rhetoric love love>; is showkv($s (^) $b), showkv(symmetric-difference($s, $b)), "Bag symmetric difference with Set is correct";
19:24 committable6 viki, ¦«HEAD»: not ok 1 - Bag symmetric difference with Set is correct␤␤# Failed test 'Bag symmetric difference with Set is correct'␤# at /tmp/VQ4MbhbPTO line 1␤# expected: 'blood:1 love:1 rhetoric:1'␤#      got: 'rhetoric:True' «exit code = 1»
19:24 cdg joined #perl6
19:26 moritz fwiw the p5 advent calendar had submission deadline yesterday
19:26 moritz should we start thinking about our own?
19:26 viki Sure, why not.
19:27 viki Get people to commit to write early.
19:27 moritz who wants to contribute? I'd write one article
19:27 tbrowder viki: this is example-sig sub(..., IO::Handle :$fh, Str :$str is rw, ...) {}
19:28 * TimToady waves from the PVR aeropuerto
19:28 viki Does it have to be a strictly technical article?
19:28 [ptc] o/
19:28 moritz viki: no
19:28 moritz viki: what do you have in mind?
19:29 viki I can write one then.
19:30 tbrowder then gen the internal string, if fh is defined, spurt to it, elsif str is defined assign to it (test in some desired order)
19:30 kyclark joined #perl6
19:31 dalek mu: 1969834 | moritz++ | misc/perl6advent-2016/schedule:
19:31 dalek mu: Empty schedule for Perl 6 advent calendar 2016
19:31 dalek mu: review: https://github.com/perl6/mu/commit/19698342a3
19:31 moritz ok, slots are up for taking
19:31 viki moritz: haven't decided yet, but something about how people worry about speed, bugs, or marketing. I recall even last Christmas jberger was freaking out about not enough "publicity". So I kinda want to write some inspirational type of thing, rather than some technical post.
19:31 tbrowder shouldn't that work, and be reasonably efficient (except for space)?
19:32 moritz viki: sounds awesome
19:32 viki tbrowder: the way I'd do it is:  method !do-stuff {...}; multi method (IO::Handle $fh) { $fh.spurt: self!do-stuff; }; multi method (Str $s is rw) { $s = self!do-stuff }
19:33 viki and do-stuff does your "write to string" thing
19:33 * moritz wants to write about his book project
19:33 tbrowder that's why i wanted to have choice of handle be transparent to avoid genning big str if not needed
19:33 tbrowder btw, this is not a class method
19:34 viki Well, same with subs, just have one that's private
19:34 nadim joined #perl6
19:36 tbrowder gotcha, but it still will have the space overhead if writing to a file, guess there is currently no way around it currently. something for 6.c?
19:36 tbrowder uh, 6.d?
19:37 RabidGravy joined #perl6
19:37 viki Then the first version is what you'd use
19:38 viki s: open("/tmp/foo", :w), 'write'
19:38 SourceBaby viki, Sauce is at https://github.com/rakudo/rakudo/blob/94d19e9/src/core/IO/Handle.pm#L636
19:40 viki tbrowder: so something like: sub do-stuff ($fh) { $fh.write: "meow".decode; }; multi sub stuff (IO::Handle $fh) { do-stuff $fh }; multi sub stuff (Str $s is rw) { my IO::Blob $b = .new; do-stuff $b; $s = $b.data.encode }
19:40 viki m: "x".encode
19:40 camelia rakudo-moar 94d19e: ( no output )
19:41 viki s/encode/decode/ and vice-versa
19:43 dalek mu: 793d377 | (Zoffix Znet)++ | misc/perl6advent-2016/schedule:
19:43 dalek mu: Book Dec. 2 advent
19:43 dalek mu: review: https://github.com/perl6/mu/commit/793d377a53
19:43 viki Zoffix can switch dates if anyone wanted the 2nd :)
19:43 FROGGS does he? :o)
19:45 labster joined #perl6
19:45 erdic joined #perl6
19:46 atweiden joined #perl6
19:46 viki Yup :)
19:46 viki I've checked ;)
19:47 viki tbrowder: I guess there's no need for the do-stuff sub at all, just let it be the IO::Handle candidate and use it in the Str candidate
19:48 wamba joined #perl6
19:51 moritz https://perlgeek.de/blog-en/perl-6/2016-advent-cfp.html (lizmat, would be nice if you could mention that in the next p6weekly)
19:55 masak moritz: to clarify, "midnight (UTC)" or some other midnight?
19:55 * masak considers contributing this year
19:56 * masak .oO( oh, the 'mu' repository -- sure, that's where we do perl6advent scheduling! ) :P
19:57 * masak .oO( why's it called 'mu'? uuuurhm, because it's the "Perl 6 Muadvent"...? alright, alright, I don't know! )
20:00 DrForr Reference to the appropriate k\"oan, I suppose.
20:01 masak m: say Mu
20:01 camelia rakudo-moar 94d19e: OUTPUT«(Mu)␤»
20:01 moritz masak: should we start a new repo?
20:01 masak no no no, I'm just being facetious
20:01 masak as usual :>
20:01 [ptc] as musual?
20:01 masak *groan*
20:01 masak it's... an excellent repo to do planning in. I wouldn't want it any other way.
20:02 masak m: say (Mu)
20:02 camelia rakudo-moar 94d19e: OUTPUT«(Mu)␤»
20:02 itaipu joined #perl6
20:02 masak m: say (((((Mu)))))
20:02 camelia rakudo-moar 94d19e: OUTPUT«(Mu)␤»
20:02 masak (now with extra bass)
20:03 moritz masak: well, we could have a separate repo just for the p6advent planning, so that nobody needs to clone that huge repo just for a one-line patch
20:03 moritz but so far, I haven't cared enough to migrate
20:03 masak me neither
20:03 masak I kinda hope we keep doing it in mu :)
20:04 * geekosaur just misread Muadvent as Mudvent >.>
20:04 masak people who find cloning burdensome can do it all in the github web interface, I guess
20:04 masak geekosaur: ooh, that sounds like a blog post in itself! :D
20:04 masak "implementing Perl 6 Mudvent"
20:07 dalek mu: 2637c13 | moritz++ | misc/perl6advent-2016/schedule:
20:07 dalek mu: Claim an advent spot
20:07 dalek mu: review: https://github.com/perl6/mu/commit/2637c13454
20:07 tbrowder viki: thank you!
20:07 moritz I used to hate git's " ! [rejected]        master -> master (fetch first)"
20:08 moritz now I love it, because it means somebody else contributed
20:08 masak moritz: "curse those other people getting in the way of my push!" :P
20:09 lizmat moritz: will do
20:09 masak moritz: I find when teaching and explaining Git (or Mercurial), it really helps to explain the difference between "you have a conflict" and "someone else pushed"
20:09 [ptc] I once took masak's advice and now use `git pull --rebase` liberally; it's now in my muscle memory
20:09 masak [ptc]: I said that? good :)
20:09 [ptc] masak: yup!  And it's been really handy!
20:09 masak [ptc]: mostly I think merges-due-to-pulling are arbitrary and annoying
20:10 [ptc] I do too.  I worked on one of Ovid's projects and it came in very handy there as he was quite strict about a linear git history
20:11 masak they're the Git log equivalent of "this week on Twitter, I gained 3 followers and lost 2 followers!" :)
20:11 [ptc] I find the extra branches one gets from e.g. GitHub pull request merges distracting when looking at the history
20:11 TEttinger joined #perl6
20:12 tbrowder now for another sub question: given a sub that operates on an input string, should a module author provide two versions, one that modifies the input string (is rw) or one that returns the new string, or both?
20:12 viki [ptc] FWIW, this happened precisely due to rebase being in muscle memory :) http://perl6.party/post/I-Botched-A-Perl-6-Release-And-Now-A-Robot-Is-Taking-My-Job
20:12 masak [ptc]: sometimes I rebase and merge locally even with PRs, so that I don't get the merge commit.
20:12 viki tbrowder, one that returns
20:13 masak tbrowder: returns
20:13 masak tbrowder: because the other one can be had with $str.=themethod
20:13 DrForr cusr time for Template::Toolkit  fell drastically over the last release; I was at 64.02, down to 48.96 avg.
20:13 [ptc] viki: I read that, and thought it was due to the edit on GH while the release spectests were running and then the commits for the release being out of kilter
20:13 tbrowder but this is a sub, not a class method
20:14 [ptc] viki: I *really* like the idea of a bot to build perl 6; that was awesome stuff.
20:14 * [ptc] wonders if it could ever work for perl 5...
20:16 masak tbrowder: $str.=&thesub
20:16 viki [ptc] no, it was due to rebase. The github edit was a technically post-release commit.
20:16 [ptc] viki: ah, ok
20:17 masak m: sub flip-uc($str) { $str.flip.uc }; my $str = "hiiii"; $str .= &flip-uc; say $str
20:17 camelia rakudo-moar 94d19e: OUTPUT«IIIIH␤»
20:17 tbrowder masak, thanks, p6 is great!
20:17 masak ...it's OK, I guess... :P
20:19 tbrowder i'll take that as an humble reply...
20:20 zakharyas joined #perl6
20:21 masak humility would imply that I had a bigger part in bringing it about than I actually do :)
20:21 masak ergo, I'm just being silly
20:22 viki .oO( or you're humbly downplaying your part... )
20:23 masak *meta*-humility!? why, I'd never...
20:24 lizmat .oO( macro-humility? :-)
20:25 masak macros are many things, but they are hardly humble.
20:25 * masak .oO( wait, you mean before or after they melt your brain? )
20:28 kyclark joined #perl6
20:34 dalek doc: 98a7489 | (Jan-Olof Hendig)++ | doc/Type/Blob.pod6:
20:34 dalek doc: Wrote docs for Blob.bytes
20:34 dalek doc: review: https://github.com/perl6/doc/commit/98a74891b6
20:34 RabidGravy joined #perl6
20:43 harmil_wk Been asking myself: what would P6CRE look like... Last night I started writing up a rough spec: https://gist.github.com/ajs/72fecbbe8e714ce209ec8da171e74186
20:47 masak harmil_wk: interesting!
20:52 samcv so i'm working with channels, and i'm trying to get this to go multi threaded http://vpaste.net/1XuaC
20:52 samcv atm it works fine, but i would like it to spawn extra workers when thre are things in the channel
20:53 samcv i tried, do for $chan.receive -> $file { start { code here } } but that didn't work
20:55 samcv maybe if i put a start block inside the loop? hm
20:55 samcv let me try that. any tips you guys have would be great
20:57 samcv oh nice. actually that did work :), now just need to make it not exit the loop until all the promises are kept.
20:59 tbrowder masak: i'm looking at that sub again. it is a bit more complex. one version returns two strings (the input one as modified), and the other just returns just the new string and modifies the input string inplace. the sub's purpose is to split an input line into 2 parts
21:01 samcv domy $all-done = Promise.allof(@promises); ## doing this, the promise returned by allof will be static or dependent on the contents of @promises?
21:01 samcv s/domy/doing
21:04 kyclark joined #perl6
21:04 nowan joined #perl6
21:09 ugexe m: await Promise.allof(start { sleep 1; say time; }, start { sleep 5; say time() }); say "done";
21:09 camelia rakudo-moar 94d19e: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤    time used at line 1␤␤»
21:10 ugexe m: await Promise.allof(start { sleep 1; say time; }, start { sleep 5; say time; }); say "done";
21:10 camelia rakudo-moar 94d19e: OUTPUT«1478034618␤1478034622␤done␤»
21:10 ugexe it will depend on the result of 'allof' the promises
21:12 tbrowder masak: so i'm not sure how to do the .= trick. (($str.=&sub($str, args...)), $str2); # ??
21:13 ugjka joined #perl6
21:14 masak tbrowder: I'm not sure either.
21:16 tbrowder i don't think a subs return type works for multi sub selection...
21:16 tbrowder nor the trait on an arg
21:18 tbrowder the way i'm doing it now is the way p6 has two names for some routines like X and X-rw
21:18 ugexe m: sub foo($, $x) { $x }; my @a = 1..10; @a .= &foo(1); say @a;
21:18 camelia rakudo-moar a1347c: OUTPUT«[1]␤»
21:19 ugexe m: sub foo($x) { $x.grep(* > 5) }; my @a = 1..10; @a .= &foo; say @a;
21:19 camelia rakudo-moar a1347c: OUTPUT«[6 7 8 9 10]␤»
21:20 samcv ugexe, i've almost got it. http://vpaste.net/A55b9
21:20 samcv it misses two files though, comparing the number of files to what it outputs at the end
21:20 samcv but it's close
21:21 samcv i'm thinking maybe it checks "last if $chan.closed and $group" before it pushes the promises above it? hm
21:23 ugexe i think you want react/whatever block construct
21:23 ugexe whenever^
21:24 samcv i will look at that, thanks ugexe
21:29 Sgeo_ joined #perl6
21:34 ggoebel joined #perl6
21:49 samcv oo i got it working. didn't use react, but got the times it loops down from 3500 times to 1400 times and now processes all 508 files
21:52 grondilu ls
21:54 samcv ls = lets see? http://vpaste.net/9vJny
21:54 nicq20 joined #perl6
21:54 samcv for some reason if i do: while ! $chan.closed or ! Promise.allof(@promises)    i get a segfault
21:54 samcv at the end of the program
21:55 samcv but like in the link works awesome
21:55 bjz joined #perl6
22:04 bjz joined #perl6
22:06 samcv weird actually... i removed the print messages in the loop and now it's not doing all of them.. i guess i will have to figure out what's happening
22:07 samcv seems milliseconds matter
22:09 devmikey joined #perl6
22:12 firstdayonthejob joined #perl6
22:16 nowan joined #perl6
22:20 samcv All promises done It's closed! pre: 508 mid: 496 post: 508 loop times: 999 Total promises: 508
22:20 samcv http://vpaste.net/oXU5r changed the code, at least i see what's going on more
22:21 samcv so it is creating all 508 promises properly (that's the # of files there are) but i think it never re-evaluates whether all promises are complete to be updated to the latest number of promises
22:44 tbrowder ref sub sigs: is there a way to constrain a param to one of two types?
22:48 tbrowder i mean in the same sig, not using multi dispatch
22:52 sufrostico joined #perl6
22:54 * ilmari was expecting sub foo (Int|Str $x) to work, but no
22:54 ilmari m: sub foo (Int|Str $x) { say $x }; foo(42); foo("bar"); foo(4.2)
22:54 camelia rakudo-moar a1347c: OUTPUT«===SORRY!===␤No compile-time value for Str␤»
22:55 jnthn $x where Int|Str
22:55 jnthn |c is the argument capture syntax, so we can't have Int|Str there
22:55 ilmari ah
23:00 tbrowder hm maybe something foo($f where { $f ~~ io.handle or $f ~~ Str}, ...)
23:01 tbrowder using the precise correct syntax of course
23:02 tbrowder that is described in the docs, types => signature
23:03 mohae joined #perl6
23:04 tbrowder i'll experiment with that in a script...nite p6 people
23:04 tbrowder left #perl6
23:08 AlexDaniel ilmari: the error message is LTA and it would be nice to at least have a ticket for that
23:09 perlawhirl joined #perl6
23:14 samcv it turns out it is actually working correctly... but. somehow it's not iterating the variable properly... WTF
23:15 samcv http://vpaste.net/ANiHQ i get Start of start: 502 End start: 506 Looped: 919 Total prom: 508   but program.p6 | wc -l gives me 508, the right number
23:15 samcv but the variables aren't being iterated properly. this makes no sense
23:15 samcv is this a bug?
23:16 jnthn ++ is not atomic
23:16 jnthn So $start_prom++; is a data race
23:17 samcv ah
23:17 samcv and here i was tearing my hair out for nothing :P
23:20 samcv jnthn, what should i use instead?
23:20 samcv what should i search for to read more about this in perl 6, so i can fully understand it
23:23 jnthn I'd probably have set off some workers that each had a react block, and did whenever on the channel
23:23 jnthn Or at least used that as my main loop
23:23 AlexDaniel another way is to use Lock, but that's probably not the best solution
23:24 jnthn A react block enforces mutual exclusion, which would deal with your data race
23:24 samcv ah got it jnthn. so the issue is they're trying to iterate the same variable at the same time and so messes it up. i will look at that
23:24 jnthn Yeah, you can use an old fashioned lock too, but `if $chan.poll -> $file {` in a while loop means it'll busy-wait
23:24 jnthn Whereas a react/whenever woudln't
23:25 jnthn *wouldn't
23:26 AlexDaniel why do you even need $start_prom and $end_start?
23:26 * jnthn guessed they were for debugging
23:29 AlexDaniel the idea of firing up a bunch of start {} blocks at the same time is also weird
23:31 AlexDaniel you probably want a fixed number of worker threads, in which case hyper/race may be more suitable… if only they worked
23:32 AlexDaniel I usually do something like for ^4 { start { … } }
23:32 AlexDaniel and in each start block I pull required data from a channel (which you already have)
23:33 jnthn Firing off a bunch of start blocks is fine really
23:34 jnthn They aren't a thread each; you're just giving them to the scheduler
23:35 jnthn Sleep time for me; 'night
23:36 jameslenz joined #perl6
23:39 AlexDaniel yeah, exactly, you are polluting the scheduler.
23:40 samcv good idea AlexDaniel.
23:41 dataangel joined #perl6
23:43 samcv yeah those things were just for debugging jnthn. does anybody know how i can make stdout.tap feed only full lines? $proc.stdout.tap( -> $v { for $v.lines { $chan.send($_) } });  this will send on partial lines
23:48 samcv it says tap outputs a supply object, and supply has a lines method. maybe i'm not calling it right
23:51 samcv ah i got it :D. sorry for all the questions
23:55 lizmat joined #perl6

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

Perl 6 | Reference Documentation | Rakudo