»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend! Set by moritz on 22 December 2015. |
|||
00:03
pierre_ joined
00:18
pierre_ left,
dalek left,
AlexDani` joined
00:19
nebuchad` joined,
dalek joined,
ChanServ sets mode: +v dalek,
kst` joined
00:20
kaare__ joined,
kaare_ left,
AlexDaniel left,
Celelibi left
00:21
pierrot left,
pierrot joined,
bjz left,
baest_ left
00:22
bjz joined,
Celelibi joined
00:25
AlexDani` is now known as AlexDaniel
00:27
pierre_ joined
00:31
pierre_ left
00:33
baest joined
00:39
cdg left
00:40
pierre_ joined,
labster left
00:41
pierre_ left
|
|||
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,
bjz left
|
|||
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 github.com/japhb/Terminal-Print/bl.../rpg-ui.p6 ... which, uh, may be a while. | 00:50 | |
yoleaux | japhb: I'll pass your message to lizmat. | ||
00:53
pierre_ left
00:54
pierre_ joined
00:55
Shin_ joined
00:57
nadim left
|
|||
Shin_ | Hi all... | 01:00 | |
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); | |||
camelia | rakudo-moar 839e52: OUTPUT«(a a b c)(20 5 4 1)» | ||
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:01 | |
Like an Sql saying 'order by @a asc, @b desc' | 01:03 | ||
01:03
baest left
01:04
sufrostico left
|
|||
grondilu | .values given sort *.key, (@a >>[=>]<< @b); | 01:05 | |
Shin_ | Wow, that looks cryptic :) | 01:08 | |
And for 3 or more columns, what strategy is suggested. I just want to tale davantage of perl6 lazyness and autothreading if possible. | 01:09 | ||
01:11
kurahaupo left
01:12
bjz joined
|
|||
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:13 | |
01:15
baest joined
|
|||
grondilu | something like race @a.map( { $_ => [&criterium1($_), &criterium2($_)] } ); | 01:15 | |
01:22
vendethiel joined,
itaipu joined
01:23
Khisanth left,
vendethiel- left
|
|||
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))()» | ||
Hotkeys | What's going on here ^ | ||
Why does an ascending range work fine with zip | |||
But a descending range doesn't | |||
Juerd | m: say 3..1 | ||
camelia | rakudo-moar 839e52: OUTPUT«3..1» | ||
Juerd | Heh. | ||
01:29
Actualeyes joined
|
|||
Hotkeys | m: list 3..1 | 01:29 | |
camelia | ( no output ) | ||
Hotkeys | m: say list 3..1 | ||
camelia | rakudo-moar 839e52: OUTPUT«()» | ||
Hotkeys | So are descending ranges not a thing | ||
Juerd | Descending ranges don't really exist. | ||
Hotkeys | Whoops | ||
Juerd | You can use a generated list: 3 ... 1 | ||
Hotkeys | Right | ||
Thanks | 01:31 | ||
01:34
grondilu left
01:37
Khisanth joined
|
|||
Shin_ | Thanks grondilu | 01:40 | |
01:46
cibs left
|
|||
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 | |
01:48
cibs joined,
pierre_ left
|
|||
gfldex | MasterDuke: you have to count line numbers by hand | 01:48 | |
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 | ||
MasterDuke | sure, np | 01:50 | |
gfldex | MasterDuke: gist.github.com/gfldex/fcd52d39ae9...52d13717c0 | 01:51 | |
make sure to count the line before doing any matching | |||
MasterDuke | cool, thanks | 01:52 | |
01:53
pierre_ joined
01:55
Shin_ left
01:56
pierre_ left,
pierre_ joined
01:58
aborazmeh joined,
aborazmeh left,
aborazmeh joined
02:02
R_I_D joined
02:04
eliasr left
|
|||
R_I_D | question: how am i supposed to be productive in another language now that i know about perl6? | 02:04 | |
timotimo | we are very sorry | 02:05 | |
you can use Inline::Python and Inline::Perl5 (and Inline::Perl6) to share code between languages | |||
so you can keep a few things in perl6 | |||
R_I_D | Inline Python? youre kidding | 02:06 | |
thats awesome | |||
timotimo | it's a thing :) | 02:07 | |
02:08
R_I_D left
|
|||
seatek | i have gone from a day-long, seething loathing of grammars into excited happiness in a matter of 5 minutes. | 02:11 | |
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:14 | ||
now to start creating chaos with actions | 02:15 | ||
02:17
Rawriful left
02:23
itaipu left
02:25
bjz left
02:27
pierre_ left
02:31
bjz joined
02:33
pierre_ joined
02:37
pierre_ left
02:44
pierre_ joined
02:45
ilbot3 left
02:47
ilbot3 joined
|
|||
SmokeMachine____ | Is there a way to get the $=pod from another code? | 03:03 | |
AlexDaniel | seatek: I've always thought that docs.perl6.org/language/grammars is quite decent | 03:20 | |
03:22
Actualeyes left
|
|||
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:22 | |
AlexDaniel | seatek: haha | 03:23 | |
seatek | yeah ;) | 03:24 | |
03:27
Lucas_One joined
|
|||
seatek | i'm still not clear in actions why the heck and when you'd use "make" even. | 03:28 | |
and i've read just about everything there is | 03:29 | ||
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 | ||
yes, exactly what the docs said | |||
AlexDaniel | okay, well. Once you parsed something, you have a parse tree, right? | ||
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. | ||
seatek | you have component parts stored in methods | ||
AlexDaniel | so chances are you'll get a lot of crap in your parse tree | ||
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) | ||
seatek | yeah | ||
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 | ||
AlexDaniel | yea, and you can do some extra stuff there too, depending on your needs | 03:34 | |
seatek | so basically with actions, you're taking the return value that comes out of TOP, yes? | 03:35 | |
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 :) | ||
that took FOREVER to figure out. | |||
i could just be dull :) | 03:38 | ||
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 | ||
AlexDaniel | but if you try to write some basic parser you'll probably figure it all out | ||
03:39
skids left
|
|||
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 | ||
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:41 | ||
if make is just stripping things down, i don't see why you would | 03:42 | ||
yet so many of the examples use it without saying why | |||
you look up make -- and it says Sets the AST to $ast, and returns it. | 03:43 | ||
ah! i understand! ;) | |||
and made.... Returns the payload that was set with method make. | 03:44 | ||
oh silly me ;) | |||
and an ast is An AST or Abstract Syntax Tree is a partially processed representation of a program. | 03:45 | ||
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:47 | ||
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 | ||
camelia | rakudo-moar 839e52: OUTPUT«「42 + 60」 int => 「42」 int => 「60」Addition.new(a => 42, b => 60)» | ||
AlexDaniel | seatek: you might want to split that into a few lines :) | 03:49 | |
seatek | AlexDaniel: exactly what I started doing :) | ||
AlexDaniel | I'm not sure if it explains anything, but that's the idea | 03:51 | |
03:52
khw left
|
|||
seatek | i'm still trying to format it to read. emacs can't even help! :) | 03:53 | |
no, that's no help at all | 03:56 | ||
:) | |||
thanks though | |||
:) | |||
i need to be let by the hand with a lollipop and all i get is punk rock ;) | 03:57 | ||
when this will be a help, i'll have come to understand what i need to ;) | |||
oh wait | 03:59 | ||
AlexDaniel | seatek: well, you can always work with your parse tree if you want to | ||
03:59
noganex joined
|
|||
seatek | maybe if i stare at it for a while | 03:59 | |
AlexDaniel | m: gist.github.com/AlexDaniel/15ac3d5...ffa3272cef | 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))» | ||
seatek | why are the 2 $<int>[*] things getting .made called on them at that point ... they were never 'make'ed | ||
AlexDaniel | seatek: they were | ||
seatek | they get maked if they come from the grammar automatically? | 04:01 | |
AlexDaniel | no, there's a method BarAct.int | ||
04:02
noganex_ left
|
|||
seatek | it knows to call that method? | 04:03 | |
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 | ||
so duplicate token names get put into an array automatically too eh? had no idea about that one. | 04:10 | ||
AlexDaniel | yes | 04:11 | |
seatek | i don't understand how 'value' could come out | 04:12 | |
i mean, how it's added, yes... but how it's outputted i can't see that | |||
AlexDaniel | seatek: that's .gist of our object that we created | 04:13 | |
seatek | just as an element of the data structure i suppose. | ||
and then we just pick out the juicy bits we want | 04:14 | ||
AlexDaniel | committable6: gist.githubusercontent.com/AlexDan...c4/file.p6 | 04:15 | |
committable6: help | |||
committable6 | AlexDaniel, Like this: committable6: f583f22,HEAD say ‘hello’; say ‘world’ | ||
AlexDaniel | committable6: HEAD gist.githubusercontent.com/AlexDan...c4/file.p6 | ||
committable6 | AlexDaniel, Successfully fetched the code from the provided URL. | ||
AlexDaniel, gist.github.com/8bf643f794c8f3d1b0...bc0eb131dc | |||
AlexDaniel | I should have started doing it in reverse polish notation… :) | 04:16 | |
seatek | no! :) | 04:17 | |
AlexDaniel | yes, because to make it work properly with infix notation you'd have to basically build your predence table… :) | ||
which is doable, but uhh! | 04:18 | ||
seatek | yes i've noticed how some simple things are complicated an some complicated get simple | ||
AlexDaniel | seatek: anyway, what I wanted to show here is that there is no “operation” in our AST | ||
04:19
kent\n joined
|
|||
seatek | so really, it's a bit of a discovery to find out what you've created in your AST then | 04:19 | |
04:19
pierre_ left
|
|||
AlexDaniel | not sure what you mean by that :) | 04:19 | |
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 | ||
AlexDaniel | just go over your parse tree and get what you need, that works too | ||
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 | ||
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:23 | ||
and this seems so core to everythign in the language, so it seems worth the effort | 04:24 | ||
AlexDaniel | well, it is core, it parses the whole damn thing :) | 04:25 | |
seatek | i would throw myself into the creek first, than trying to write that. | 04:26 | |
can't even imagine at this point | 04:27 | ||
though i have briefly peeked ;) | |||
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 | |
04:28
pierre_ joined
|
|||
AlexDaniel | ast thing* | 04:28 | |
seatek | there is all manner of voodoo going on in those docs related to grammars | 04:29 | |
i did at first imagine using grammars to do class factories directly in the actions, but have since second-thought that | 04:30 | ||
04:30
Actualeyes joined
|
|||
AlexDaniel | anyway, I have to sleep :) | 04:32 | |
see you 🙋 | |||
seatek: and feel free to open a couple of tickets in doc repo | |||
seatek: your complaints are correct | 04:33 | ||
04:33
pierre_ left
|
|||
AlexDaniel | it should not jump straight into protos, that's true | 04:33 | |
and yes, it should have a bit more text explaining why somebody would need an AST | |||
seatek | i'll help write some up gladly. least i can do for your kind help AlexDaniel. thank you again | 04:39 | |
04:39
AlexDaniel left
04:45
wamba joined
05:02
canopus left
05:07
canopus joined
05:09
kent\n left
05:13
brillenfux joined
05:16
Sgeo left
05:21
labster joined
05:29
pierre_ joined
05:34
pierre_ left
05:35
Cabanossi left
05:39
Cabanossi joined
05:44
dwarring left
05:49
wamba left
05:52
aborazmeh left
05:53
Sgeo joined
06:02
bjz left
06:11
pierre_ joined
06:46
brillenfux_ joined,
brillenfux left
06:47
pierre_ left
06:48
RabidGravy joined,
darutoko joined
06:55
pierre_ joined
06:59
pierre_ left
07:00
pierre_ joined
07:06
labster left
|
|||
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 | |
curious what you guys use | |||
07:18
CIAvash joined,
CIAvash left,
neuraload joined
|
|||
moritz | I use xfce4-terminal, mostly because it's the default on xubuntu | 07:22 | |
so far I didn't have any Unicode trouble with it | 07:23 | ||
samcv | hmm | ||
i will try that then | |||
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 | ||
but i use a really tiny font | |||
arnsholt | I've mostly used gnome-terminal | ||
But not with a tiny font | 07:27 | ||
samcv | a.uguu.se/fNSHlsqDwQHv_Screenshot_...202455.png | ||
arnsholt | Modern screens are big, so I can afford the luxury of a big font too =) | ||
samcv | hah | ||
i only have 1366 x 768 on my laptop and it's what i use 95% of the time | |||
arnsholt | Hah! Apparently the corporate firewall doesn't like your site | 07:28 | |
07:28
RabidGravy left
|
|||
samcv | heh | 07:28 | |
arnsholt, try this i.imgur.com/Tx2CaUq.png | |||
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:29 | ||
07:36
firstdayonthejob joined,
firstdayonthejob left
07:37
domidumont joined
07:39
wamba joined
|
|||
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 | |
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:52
wamba left
07:53
grondilu joined
07:55
CIAvash joined
08:02
labster joined
|
|||
samcv | tried terminator, termite, konsole, xfce4-terminal, yakuake, terminology, xterm, urxvt-unicode, roxterm. ugh | 08:06 | |
bonsaikitten | mrxvt seems pretty ok | 08:07 | |
tabbed rxvt, mostly sane | |||
08:09
pierre_ left,
seatek left
|
|||
samcv | well i've gotten urxvt working except only basically specifying the fallback fonts be like 1/2 the size they should be | 08:10 | |
if they're too big urxvt will just not show them at all :\ | 08:11 | ||
other ones either cut them off or they go into the other lines | |||
08:13
cdg joined
|
|||
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 | |
08:14
pierre_ joined
|
|||
bonsaikitten | haven't seen that issue yet | 08:15 | |
08:19
pierre_ left,
zakharyas joined
08:20
wamba joined
08:22
nebuchad` is now known as nebuchadnezzar
08:23
pierre_ joined
08:27
Actualeyes left
|
|||
samcv | bonsaikitten, maybe your font isn't small enough ;) | 08:27 | |
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.. | ||
i'm running the latest | |||
08:31
nadim joined
|
|||
samcv | i have konsole 16.08.2 running KDE 5.8 | 08:32 | |
08:33
brillenfux_ left
|
|||
samcv | gonna try something brb | 08:34 | |
08:37
dakkar joined
|
|||
samcv | not sure why this isn't working, but konsole isn't doing my custom compose things in ~/.XCompose | 08:38 | |
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:42 | ||
08:42
wamba left
08:44
cdg_ joined
08:46
cdg left
08:47
tokomer joined
|
|||
lizmat clickbaits p6weekly.wordpress.com/2016/10/31/...-в-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 github.com/japhb/Terminal-Print/bl.../rpg-ui.p6 ... which, uh, may be a while. | ||
08:55
tokomer left,
tokomer joined
08:56
cooper_ left
09:01
jonas1 joined,
pierre_ left
09:04
pierrot left,
pierrot joined
|
|||
[ptc] | lizmat++ | 09:04 | |
09:06
domidumont left
09:07
pierre_ joined
09:11
TEttinger left,
pierre_ left
09:15
pierre_ joined
|
|||
masak | m: sub is-odd($n) { $n % 2 }; .say if 5 ff is-odd($_) for 1..10 | 09:25 | |
camelia | rakudo-moar 839e52: OUTPUT«5678910» | ||
yoleaux | 00:47Z <japhb> masak: What's up with the IR clog spelunking? Is there a project afoot? | ||
masak | japhb: no, just ended up searching for stuff :) | ||
er, I mean "officially, there's no project afoot" :P | |||
what'm I doing wrong with the `is-odd` thing above? | |||
I'm trying to highlight the difference between ff and fff | |||
masak checks the test suite | 09:38 | ||
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 1Use of uninitialized value <element> of type Any in strin…» | ||
masak | oh. precedence. | 09:42 | |
m: say join "", ((/B/ ff /B/) ?? $_ !! "x" for <A B A B A>) | |||
camelia | rakudo-moar 839e52: OUTPUT«xBxBx» | ||
masak | for some reason I expected infix:<ff> to be tighter than infix:<?? !!> | ||
but they're on the same prec level -- hm | 09:43 | ||
and right-associative | |||
so... I don't understand why the parens make a difference there... | |||
m: say join "", ((/B/ fff /B/) ?? $_ !! "x" for <A B A B A>) | |||
camelia | rakudo-moar 839e52: OUTPUT«xBABx» | ||
masak | anyway, the spectests deliver. the above is a difference between ff and fff | 09:44 | |
dalek | c: acd772d | gfldex++ | doc/Type/Regex.pod6: show how to declare named Regex |
09:50 | |
c: 9246bf3 | gfldex++ | doc/Language/functions.pod6: index prefix & |
|||
09:53
cdg_ left
|
|||
dalek | c: b1e96ff | gfldex++ | doc/ (2 files): name a sigil a sigil |
09:56 | |
10:05
pierre_ left
10:08
pierre_ joined
|
|||
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» | ||
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 | |
this works: | |||
m: class A::B {}; class C { has A::B $.ab = A::B.new }; say "alive" | |||
camelia | rakudo-moar 839e52: OUTPUT«alive» | ||
masak | so it's gotta have something to do with the `.=` somehow | ||
10:12
silug left
10:13
auerland joined,
auerland left
10:14
wamba joined
10:23
labster left,
Matthew[m] left,
M-Illandan left,
tadzik left,
ilmari[m] left,
Guest95971 left,
Matias[m] left
10:27
silug joined
10:31
brillenfux joined
|
|||
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» | ||
jferrero | m: say 4 == (1E12.log10 / 3).round | 10:32 | |
camelia | rakudo-moar 839e52: OUTPUT«True» | ||
10:33
kent\n joined
10:41
itaipu joined
10:50
ilmari[m] joined
10:56
tadzik joined,
enick_127 joined,
M-Illandan joined,
Matthew[m] joined
10:59
dakkar left,
tokomer_ joined,
pierre_ left
11:00
itaipu left
11:01
tokomer left,
BuildTheRobots left,
dakkar joined
11:02
DarthGandalf left,
andrzejku joined,
DarthGandalf joined,
BuildTheRobots joined
|
|||
masak | m: say 1E12.log10 / 3 | 11:03 | |
camelia | rakudo-moar b5780f: OUTPUT«4» | ||
masak | m: say 4 == 1E12.log10 / 3 | ||
camelia | rakudo-moar b5780f: OUTPUT«False» | ||
11:03
itaipu joined
|
|||
masak | m: say 4 ≅ 1E12.log10 / 3 | 11:03 | |
camelia | rakudo-moar b5780f: OUTPUT«True» | ||
11:03
CIAvash left
11:04
gregf_ joined
11:06
mohae_ left
11:07
mohae joined
11:08
Matthew[m] left,
tadzik left,
ilmari[m] left,
enick_127 left,
M-Illandan left
11:10
Actualeyes joined,
rindolf joined
11:17
Rawriful joined
11:19
ilmari[m] joined
11:22
kent\n left,
kent\n joined
11:23
tokomer_ left
11:26
M-Illandan joined,
Matthew[m] joined,
tadzik joined,
Guest99321 joined,
Matias[m] joined
11:39
CIAvash joined
11:42
pierre___ joined
11:52
domidumont joined
12:06
pierre___ left,
pierre_ joined
12:11
AlexDaniel joined
12:25
nicq20 joined
|
|||
nicq20 | Hello o/ | 12:28 | |
masak | m: say "ohayo nicq20!" | 12:29 | |
camelia | rakudo-moar b62321: OUTPUT«ohayo nicq20!» | ||
12:32
rurban left,
kaare__ left
|
|||
dalek | c: 0acb8ea | coke++ | doc/Type/Regex.pod6: use our standard phrasing here |
12:44 | |
12:48
gensym left
12:49
gensym joined
12:52
vendethiel left,
vendethiel joined
13:10
ab6tract joined
13:26
rurban joined
13:32
vendethiel- joined
13:33
skids joined,
vendethiel left
13:34
cdg joined
|
|||
ab6tract | long ago i started working on making (^) work with bags | 13:34 | |
13:35
pierre_ left,
kurahaupo__ joined
|
|||
ab6tract | anyone feel strongly about it? | 13:36 | |
13:36
pierre_ joined
13:38
LeCamarade joined
|
|||
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:39 | |
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:40 | ||
13:40
pierre_ left
|
|||
timotimo | compiling on a raspberry pi will definitely require a bunch of swap space | 13:41 | |
and multiple days of waiting :) | |||
debian's got debs for multiple architectures of moarvm as least, i think? | |||
LeCamarade | Right. So I will settle for a pre-compiled ... if I should be able to locate one. | 13:42 | |
lizmat | github.com/nxadm/rakudo-pkg/releases | ||
El_Che++ | |||
13:42
sufrostico joined
13:43
khw joined,
sufrostico left,
sufrostico joined
13:46
sufrostico left,
sufrostico joined
13:47
ponzii joined,
sufrostico left,
sufrostico joined
|
|||
ponzii | Is there a more efficient way to do this: for 'logs.txt'.IO.lines -> $_ { .say if $_ ~~ /<<\w ** 15>>/; } | 13:48 | |
13:48
sufrostico left
|
|||
masak | mebbe: for 'logs.txt'.IO.lines { .say if any(.words>>.chars) == 15 } | 13:49 | |
13:49
sufrostico joined
|
|||
masak | or .say if .words.first(*.chars == 15) | 13:50 | |
timotimo | really depends on what you need the << and >> for | ||
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 | ||
timotimo | because words splits on space, doesn't it? | ||
masak | oh, right | ||
yes, those are not identical | |||
more similar would be to do .comb(/\w+/), not .words | |||
13:52
sufrostico left
|
|||
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 | ||
masak | I'm happily surprised to hear the others are only 5 times as fast ;) | ||
ponzii | timotimo: That's weird as in a lot of math examples Perl6 can be 25 time faster than Python. | 13:54 | |
13:54
grondilu left
|
|||
timotimo | of course | 13:54 | |
except if you compare perl6 vs pypy. then it's pretty much impossible to beat python :) | |||
ponzii | timotimo: ... and strings/regex has traditionally been Perl's forte | ||
arnsholt | It's pretty easily explained | 13:55 | |
Perl 5 regexes are souped-up automata | |||
Perl 6 regexes are top-down parsers | |||
13:55
sufrostico joined
|
|||
timotimo | still, a whole bunch of perl6 regexes can become completely automata-based | 13:55 | |
... in theory | 13:56 | ||
13:56
grondilu joined
|
|||
ponzii | arnsholt: Does that mean they'll never be as efficient as Perl5 then? | 13:56 | |
13:56
sufrostico left
|
|||
arnsholt | Not necessarily | 13:56 | |
Lots of it can be optimized to a more efficient form | |||
masak | they could probably be a bunch faster still | ||
arnsholt | Yeah, definitely | ||
13:56
sufrostico joined,
Actualeyes left,
lizmat left
|
|||
masak | we're just pressed for time doing all the obvious optimizations ;) | 13:56 | |
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 | ||
ponzii | masak: On my machine that log file parse took Perl6 11.03 secs while PHP71 took 0.43 secs. | 13:58 | |
masak: Still perplexed how PHP7 is significantly faster than Node and Perl5 | |||
14:00
Actualeyes joined,
pmurias joined
|
|||
pmurias | ponzii: significantly faster in general or on one particular benchmark? | 14:00 | |
ponzii | pmurias: Well, file i/o + parsing but yes, Perl6 math is pretty impressive | 14:01 | |
timotimo | if you think perl6 math is impressive, wait until we're able to remove all those NativeRef allocations ... | 14:02 | |
and the boxing/unboxing | |||
and jit small-bigint-math | |||
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? | ||
timotimo: Perception counts for adoption. | |||
timotimo | you're certainly free to invest time in that | ||
did you see the recent commits, btw? | 14:05 | ||
lizmat made almost everything related to invoking regexes a whole bunch faster | |||
you were saying you're using an "october rakudo"? | |||
i think the majority of these improvement commits have been made after that release, but i could be mistaken | |||
ponzii | timotimo: Yes, just tested the latest version. | ||
timotimo: Sorry, latest public .dmg, not recent commits. | 14:06 | ||
pmurias | ponzii: speed is the biggest thing holding Perl 6 back | 14:10 | |
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:11 | |
Sorry, fundamentalist Perlist here. Tried to resist. Couldn't. | 14:12 | ||
viki | Yes, the .match improvements were after the 2016.10 release. | ||
timotimo | i bet we can make a scan for a << much faster | 14:13 | |
14:13
Bname joined
|
|||
timotimo | currently it'll be trying to match a LWB every character by looking one back and one in front | 14:13 | |
we should be able to jump 2 chars each time instead of just 1 | |||
14:14
CIAvash left
|
|||
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:15 | |
ponzii: a crude comparison of equivalent Perl 6 and Rust code, for my point: twitter.com/zoffix/status/792398913521192960 | 14:16 | ||
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 | ||
buggable: eco | |||
14:17
LeCamarade left
|
|||
buggable | viki, Out of 739 Ecosystem dists, 165 have warnings and 0 have errors. See 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. | ||
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? | |||
ponzii | viki: Because it's still called Perl :( | 14:20 | |
viki | :) | ||
Fair enough. | |||
AlexDaniel | heh | ||
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. | ||
ponzii | viki: Sure, I get that. | 14:22 | |
timotimo | anybody up for trying an experiment with the left-word-boundary regex thing? | 14:23 | |
i'm willing to give someone step-by-step help | 14:24 | ||
viki is burnt out and is taking a ~2-3 week break. | |||
timotimo | that's fine :) | ||
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:25 | |
timotimo | AlexDaniel, performance is holding me back from doing stuff i consider fun. that's why i'm interested in things getting faster | 14:26 | |
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 | |
so what's more important… | |||
14:28
kaare__ joined
|
|||
timotimo | it's not like an optimization is as hard as fixing a nasty segfault | 14:28 | |
14:28
canopus_ joined
14:29
canopus left
|
|||
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:29 | |
14:30
lizmat joined
|
|||
AlexDaniel | which is weird, because once you stumble upon performance issues you very often start to parallelize things | 14:30 | |
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 :) | ||
ab6tract | lizmat: i think it would be much nicer for (^) to return a bag | 14:32 | |
if any of the args were bags | |||
lizmat | well volunteered :-) | 14:33 | |
timotimo | i seem to recall a big patch series to fix all manner of bag-related things | ||
that was probably yours? | |||
ab6tract | i have a feeling i had already patched it and it got optimized away :) | ||
timotimo: indeed :) | |||
lizmat | ab6tract: I generally don't optimize away functionality | 14:34 | |
ab6tract | then i never implemented it properly :D | ||
timotimo | must have missed spec tests :< | ||
ab6tract | right now the implementation is quite nice because it gets to be an only | ||
whereas i (think i) would need to create different candidates | |||
jnthn | AlexDaniel: github.com/perl6/nqp/commit/522487...f3efff9e89 and github.com/perl6/nqp/commit/c0e80f...53eae12a2f may well have helped with the original problem | 14:35 | |
AlexDaniel: But the ticket got mis-golfed | |||
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 | ||
But rather, a --full-cleanup issue | |||
14:37
pierre_ joined
|
|||
ab6tract | i don't suppose we use subsets/where clauses in CORE very often? | 14:39 | |
timotimo | well, hopefully not :) | 14:40 | |
they're slow ;) | |||
14:41
pierre_ left
|
|||
ab6tract | slower than doing the same check inside the sub anyway? | 14:43 | |
timotimo | good question | 14:44 | |
14:44
sufrostico left
|
|||
AlexDaniel | jnthn: not sure if it helped, the issue is still there | 14:47 | |
not sure if it is the same one though, but the snippet does not run reliably | 14:48 | ||
14:49
brillenfux left
14:51
sufrostico joined
14:54
synopsebot6 joined
|
|||
timotimo | #129781 | 14:54 | |
synopsebot6 | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=129781 | ||
ab6tract | luckily there is a smarter way to deal with it | 14:56 | |
the tricky thing about "symmetric difference" of a list of bags/mixes | |||
is that order matters | |||
which means you kind of lose the symmetry bit | |||
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 | ||
lizmat | ab6tract: if the order matters, how can Set/Bag/Mix work, as they don't preserve order ? | ||
timotimo | from find_method, interestingly | ||
that's funny. tried to MVM_dump_backtrace and it segfaulted here: | 14:58 | ||
MVM_exception_backtrace_line (tc=tc@entry=0x7fffe8061cb0, cur_frame=0x45, not_top=0) at src/core/exceptions.c:317 | |||
317 MVMString *filename = cur_frame->static_info->body.cu->body.filename; | |||
ab6tract | lizmat: order of the list of Bags | 14:59 | |
[(^)] ($b1, $b2, $b3) | |||
vs | |||
[(^)] ($b3, $b1, $b2) | |||
whereas $b1 (^) $b2 and $b2 (^) $b1 are symmetric | 15:00 | ||
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
nicq20 left
|
|||
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:03 | |
i think this is where i got stuck before | 15:04 | ||
then again, i would vastly prefer ( 'x' => 6 ).Bag (^) ( 'x' => 4).Bag to return bag(:x(2) than set() | 15:07 | ||
gist.github.com/anonymous/c4c847ca...tfile1-txt | 15:11 | ||
naive, but appears to work | |||
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:13 | |
15:19
ocbtec joined,
itaipu left,
ocbtec left,
ocbtec joined
|
|||
timotimo | AlexDaniel: please know that i'm only not fixing that problem because it's really god damn not easy | 15:20 | |
15:20
CIAvash joined
|
|||
AlexDaniel | I understand that | 15:20 | |
15:20
CIAvash left
|
|||
timotimo | that's why i prefer fiddling with optimizations instead | 15:20 | |
jnthn is currently investigating RT #129834, fwiw | 15:21 | ||
timotimo | synopsebot6: #129834 | ||
synopsebot6 | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=129834 | ||
15:21
obfusk joined
|
|||
timotimo | synopsebot6: #129834, | 15:21 | |
synopsebot6 | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=129834 | ||
timotimo | did it not trigger because of the /me in front? | ||
timotimo tests #129834 | |||
seems to be it | |||
jnthn | heh :) | ||
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? | ||
timotimo | well, every traceback that valgrind shows me includes MVM_gc_global_destruction in it | ||
jnthn | timotimo: I gave it a quick run and observed the same fwiw | 15:23 | |
15:24
ponzii left
|
|||
AlexDaniel | how to disable --ful-cleanup? | 15:26 | |
15:26
nicq20 joined
|
|||
AlexDaniel | l* | 15:26 | |
jnthn | the perl6-valgrind-m script is what passes it | 15:27 | |
AlexDaniel | can't see it | 15:31 | |
timotimo | should be in the last line | 15:32 | |
15:33
rurban left
|
|||
[Coke] | are you using rakudobrew? | 15:37 | |
15:37
wamba left
|
|||
[Coke] | (in which case you want something like ~/.rakudobrew/moar-200364a/perl6-valgrind-m) rather than the one in your path | 15:38 | |
15:39
seatek joined
|
|||
AlexDaniel | [Coke]: yeah, was trying to reverse-engineer that to figure it out… thank you very much! | 15:41 | |
ah, alright, got that going | 15:43 | ||
15:43
ab6tract left
15:44
canopus_ is now known as canopus
15:49
setty1 left
15:50
kyclark joined
|
|||
kyclark | I’ve a little script where I’d like to “prompt” for a single character input (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:51 | |
[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
lizmat left
|
|||
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:53 | |
15:53
rindolf left
|
|||
[Coke] | ah, that would explain why getc hangs | 15:54 | |
timotimo | quite | 15:55 | |
AlexDaniel | ouch | ||
timotimo | a sad consequence of doing things right | ||
[Coke] | ah, no, getc seems to require an enter? | ||
timotimo | probably also accepts a space | ||
or a second letter | |||
[Coke] | timotimo: abcd didn't cause it to come back. | 15:56 | |
timotimo | oh? interesting | ||
"The operation is blocking and the stream may be buffered." | |||
huh. | |||
[Coke] | um, even perl6 -e 'say $*IN.read(1)' requires an enter? | ||
timotimo | oh | 15:57 | |
you have to set the terminal to unbuffered first, of course | |||
jnthn | iirc it's about terminals | ||
stackoverflow.com/questions/1798511...ny-getchar is a C program with the same issue | |||
15:57
neuraload left
|
|||
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
|
|||
[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,
wamba joined,
vendethiel- left
16:02
jonas1 left
|
|||
seatek | is dd known to get easily confused with Match's ? | 16:03 | |
AlexDaniel | seatek: by confused you mean what? | ||
the way it prints stuff is confusing, yes | |||
seatek | it's hanging on me using 100% CPU whenever I use it on a match that includes an action | ||
16:03
nicq20 left
|
|||
seatek | wheras say works fine | 16:03 | |
16:03
darutoko left,
vendethiel joined
|
|||
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. | ||
infinite mutual recursion, i bet | |||
AlexDaniel | ooops | ||
camelia | rakudo-moar a6eeaa: OUTPUT«(timeout)» | ||
timotimo | well, maybe not | ||
but it could be | |||
seatek | m: grammar G { token TOP {.*}}; class GC { method TOP ($/) { make $/ }}; my $m = G.parse('test here', actions => GC.new); say $m; | ||
camelia | rakudo-moar a6eeaa: OUTPUT«「test here」» | ||
seatek | hehe | ||
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 | |
that was a bad idea :) | |||
seatek | :) | ||
AlexDaniel | committable6: 2015.12 grammar G { token TOP {.*}}; class GC { method TOP ($/) { make $/ }}; my $m = G.parse('test here', actions => GC.new); dd $m; | ||
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)» | ||
AlexDaniel, ¦«2015.12»: «timed out after 10 seconds, output»: «exit signal = SIGHUP (1)» | |||
AlexDaniel | seatek: and I'm not sure if it's dd's fault | ||
yea, it's not… | 16:08 | ||
16:08
setty1 joined
|
|||
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
BuildTheRobots left,
adrusi left
|
|||
AlexDaniel | seatek: well, look: | 16:08 | |
m: grammar G { token TOP {.*}}; class GC { method TOP ($/) { make ‘hello’ }}; my $m = G.parse(‘test here’, actions => GC.new); dd $m | |||
camelia | rakudo-moar a6eeaa: OUTPUT«Match $m = Match.new(ast => "hello", list => (), hash => Map.new(()), orig => "test here", to => 9, from => 0)» | ||
16:09
damnlie left
|
|||
AlexDaniel | seatek: the problem is that in your case ast is the same match object | 16:09 | |
it's like if you did $m.ast = $m | |||
16:09
kshannon left
|
|||
seatek | oo interesting | 16:09 | |
timotimo | haha, $/ make $/, that's clever! | 16:10 | |
16:10
kshannon joined,
edenc joined,
adrusi joined
|
|||
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 | ||
we should be using that for this, too | 16:11 | ||
16:11
BuildTheRobots joined
|
|||
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
16:15
LeCamarade joined
16:21
wamba left
16:23
araujo left
16:25
ab6tract left
|
|||
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:26 | |
viki | jsimonet: why are they not allowed? | 16:31 | |
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…» | ||
viki | I see. | ||
jnthn | :my $*FOO = 42; | ||
jsimonet | yes, this is this error. | ||
jnthn | (Just like a normal contextual decl, but with a : before it) | ||
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» | ||
timotimo | the $!meow obviously wants to go away | ||
it serves no purpose there | |||
except to confuse | 16:35 | ||
viki | right | ||
jsimonet | Is it the attribute wich is used, or $*meow is another variable ? | ||
viki | jsimonet: $*moew is just a dynamic variable | ||
jsimonet | ok | ||
So I can use it in <?{ * }>? | |||
viki | Yeah | 16:36 | |
jsimonet | Ok, is there a documentation page about this ? | ||
viki | jsimonet: docs.perl6.org/language/variables#The_*_Twigil | ||
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 | ||
jsimonet: you know about make/made, right? | |||
(another way you can pass data around between tokens) | |||
16:38
sjoshi joined
|
|||
jsimonet | viki: yes, it's for constructing an AST. I wanted to keep separated the two (parsing and creating the AST). | 16:38 | |
16:39
FROGGS joined
|
|||
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» | ||
viki | OK | ||
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}» | ||
jsimonet | I see :) | 16:41 | |
It seems my grammar now parses correctly, thank you! | |||
16:41
rindolf left
|
|||
viki | Any time. | 16:42 | |
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" | ||
camelia | rakudo-moar ed2631: OUTPUT«(Any)» | ||
jsimonet | The :my is for defining in the current scope right ? | ||
16:45
sjoshi left
|
|||
viki | Yeah | 16:45 | |
You can't use { ... } since that would just limit the scope to that block | |||
jsimonet | I tried :) | ||
dalek | c: bebe42e | (Tom Browder)++ | doc/Language/functions.pod6: use possessive |
16:50 | |
16:50
rindolf joined
16:57
nadim left
|
|||
tbrowder | hi, #perl6 | 16:57 | |
16:58
dakkar left
|
|||
viki | \o\ | 16:58 | |
tbrowder | hi, viki, is there anything like a c++ stream in p6? | ||
viki | Never used C++ | 16:59 | |
16:59
Bname left
|
|||
tbrowder | i would like use use some common code to write to either a file or a string | 16:59 | |
17:00
cdg left
17:01
liztormato joined
|
|||
[Coke] | here's a simple example of how you override IO style methods to write to a string. | 17:02 | |
github.com/perl6/roast/blob/master...ngle.t#L28 | |||
tbrowder | thanks, [Coke] | 17:03 | |
[Coke] | this looks like a more fleshed out version that goes to a blob: | ||
github.com/moznion/p6-IO-Blob | |||
viki | ISAGN for IO::FakeFile :) | 17:04 | |
Something that inherits IO::Handle and overrides all relevant methods to work with a string/Blob buffer | 17:05 | ||
17:05
kyclark left
|
|||
viki | IO::Blob seems to be it | 17:07 | |
tbrowder | roger, thank! | 17:10 | |
17:10
eliasr joined
17:11
wamba joined
|
|||
tbrowder | looks like IO::String is in the ecosystem and IO::Blob is not | 17:14 | |
viki | Wow, the "free" certs with letsencrypt sure have a hefty pricetag: letsencrypt.org/2016/11/01/launchi...paign.html Hard to imagine them raising $2,500,000/year considering a giant like Wikipedia pulls $75m | 17:15 | |
tbrowder: it's in it: modules.perl6.org/#q=Blob | 17:16 | ||
AlexDaniel | letsencrypt is quite big too | 17:17 | |
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 | |
Hard to imagine the same group being donors who consistently pull 2.5mil | |||
tbrowder | viki, thanks, i searched on IO:: and missed it | ||
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:30 | ||
17:32
kurahaupo__ left,
itaipu joined
|
|||
moritz | fwiw the *.perl6.org sites all use let's encrypt | 17:33 | |
17:33
zakharyas left
|
|||
moritz | as well as my personal sites | 17:33 | |
17:33
kurahaupo__ joined
|
|||
moritz | and the automation is awesome | 17:33 | |
investigating alternative clients is also worth it; I use simp_le for some of my pages | 17:34 | ||
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
|
|||
viki | moritz: and how much do you plan to donate to letsencrypt? >:) | 17:38 | |
tbrowder | well it's good to get yr rec, moritz | ||
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 | |
17:39
cdg joined
|
|||
moritz | viki: not sure yet. Maybe O(50USD) | 17:39 | |
viki | ( news.ycombinator.com/item?id=12847882 ) | 17:40 | |
moritz | maybe more after I've held the P6 training, and got paid for it :-) | ||
viki | Did you just use the big-O notation with money? | 17:41 | |
:) | |||
moritz | I did, knowing it's not mathematically correct | 17:42 | |
viki | :D | ||
moritz | I also use O(scary) for some algorithms | 17:43 | |
17:47
rindolf left
|
|||
geekosaur | O(whoops) for algorithms with a good-looking big-O but terrible constants >.> | 17:48 | |
17:50
zakharyas left,
rindolf joined
17:58
mniip left
17:59
wamba left
18:09
nicq20 joined
|
|||
nicq20 | Hey-o | 18:09 | |
18:16
wamba joined
18:18
Tonik joined
18:19
liztormato left
18:22
hankache joined
|
|||
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 | |
then i'll write up a proper intro them | 18:28 | ||
AlexDaniel | seatek++ :) | 18:29 | |
seatek: so what are actions for? :) | |||
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! | ||
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 | ||
and how that ties into the whole picture of what you're trying to accomplish | |||
hankache | seatek++ | 18:31 | |
18:31
zakharyas joined
|
|||
tbrowder | ref IO::Blob: i can write to a string (at least i got no pushback) but can't sa | 18:35 | |
y the string | |||
viki | seatek: there's a doc Issue for it, FWIW: github.com/perl6/doc/issues/897#is...-248087306 | 18:36 | |
tbrowder: $io-blob-obj.data.encode.say | 18:37 | ||
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? :) | ||
seatek | prolly ;) | 18:39 | |
18:39
nicq20_ joined
|
|||
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
nicq20 left
|
|||
tbrowder | ok, back to the 'puter | 18:39 | |
AlexDaniel | seatek: well, then you'd have no docs on grammars at all :P | 18:40 | |
I wonder if that would've been better | |||
viki | tbrowder: you're missing .encode. .data is a Blob | ||
tbrowder: another method: github.com/moznion/p6-IO-Blob/blob...#L256-L258 | |||
AlexDaniel | seatek: but yes, I really think that you can make it better, so hoping to see a PR :) | ||
18:42
nicq20 joined
18:43
lizmat joined,
nicq20_ left
18:46
nicq20 left
|
|||
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 | |
18:46
nicq20 joined
|
|||
seatek | (and unit tests with varying inputs ;) ) | 18:47 | |
viki | m: gist.github.com/zoffixznet/3598d27...e142797093 | 18:48 | |
camelia | rakudo-moar ed2631: OUTPUT«5===SORRY!5=== Error while compiling <tmp>The following packages were stubbed but not defined: IO::Blobat <tmp>:243------> 3<BOL>7⏏5<EOL> expecting any of: statement end» | ||
viki | How come it says that? | ||
seatek | AlexDaniel: i plan on writing something up tonight, after a shower. | 18:50 | |
moritz | viki: looks like a bug | ||
AlexDaniel | committable6: 6c gist.githubusercontent.com/zoffixz...51a0/p6.p6 | ||
committable6 | AlexDaniel, Successfully fetched the code from the provided URL. | ||
AlexDaniel, gist.github.com/bbfc1840a530f78d73...69ebf6a1d1 | |||
viki | tbrowder: sorry, .decode, not .encode | 18:51 | |
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::Blobat <tmp>:1------> 3class IO::Blob { … }7⏏5<EOL> expecting any of: postfix statement end» | ||
viki | m: class IO::Blob { … }; class IO::Blob {} | ||
camelia | rakudo-moar ed2631: OUTPUT«5===SORRY!5=== Error while compiling <tmp>The following packages were stubbed but not defined: IO::Blobat <tmp>:1------> 3class IO::Blob { … }; class IO::Blob {}7⏏5<EOL> expecting any of: postfix stateme…» | ||
viki | m: class IO::Blob { ... }; class IO::Blob {} | ||
camelia | rakudo-moar ed2631: OUTPUT«5===SORRY!5=== Error while compiling <tmp>The following packages were stubbed but not defined: IO::Blobat <tmp>:1------> 3lass IO::Blob { ... }; class IO::Blob {}7⏏5<EOL> expecting any of: postfix statemen…» | ||
viki | star: class IO::Blob { ... }; class IO::Blob {} | 18:53 | |
camelia | star-m 2016.04: OUTPUT«5===SORRY!5=== Error while compiling <tmp>The following packages were stubbed but not defined: IO::Blobat <tmp>:1------> 3lass IO::Blob { ... }; class IO::Blob {}7⏏5<EOL> expecting any of: postfix statement en…» | ||
18:53
silug left
|
|||
viki | weird... | 18:53 | |
Oh | |||
m: class Meow::Blob { ... }; class Meow::Blob {} | |||
camelia | ( no output ) | ||
18:53
nicq20 left
|
|||
moritz | is it because IO is a role? | 18:53 | |
18:53
cdg left
|
|||
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 {} | ||
camelia | ( no output ) | ||
moritz | m: role Meow { ... }; role Meow { }; class Meow::Blob { ... }; class Meow::Blob {} | 18:54 | |
camelia | ( no output ) | ||
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 | ||
viki | It's that IO:: is provided by core. | ||
tbrowder: IO::Blob *is* a IO::Handle. | |||
moritz | m: class Str::Foo { ... }; class Str::Foo { } | ||
camelia | rakudo-moar ed2631: OUTPUT«5===SORRY!5=== Error while compiling <tmp>The following packages were stubbed but not defined: Str::Fooat <tmp>:1------> 3ass Str::Foo { ... }; class Str::Foo { }7⏏5<EOL> expecting any of: postfix statemen…» | ||
viki | tbrowder: so I'm unsure what sort of use you're not achieving | ||
tbrowder | yes, but i want to write the resulting string to a file | 18:55 | |
viki | tbrowder: which file? | ||
18:55
zakharyas left
|
|||
viki | And this should be the ticket, though seems like RT is down: rt.perl.org/Public/Bug/Display.htm...et-history | 18:56 | |
oh, works now. | |||
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:58 | |
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. | 18:59 | |
18:59
sufrostico left
|
|||
viki | And the "just by selecting" bit will select between those | 19:00 | |
19:01
espadrine joined
19:02
hankache_ joined,
Tonik left
19:04
silug joined
19:06
hankache left
|
|||
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:07 | |
viki | Not really. | 19:08 | |
You need to know what encoding that data is in. | |||
But same applies to a file. | 19:09 | ||
tbrowder | but since i create the blob, i should know the encoding. | 19:10 | |
viki | Sure. | 19:11 | |
s: open("/tmp/foo", :w), 'seek' | 19:12 | ||
SourceBaby | viki, Sauce is at github.com/rakudo/rakudo/blob/ed26...le.pm#L627 | ||
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 | ||
viki | I thought you said you knew the encoding? So why is the blob envolved at all? | 19:14 | |
19:14
hankache_ left
|
|||
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» | ||
viki | baahh | 19:16 | |
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 | |||
camelia | rakudo-moar ed2631: OUTPUT«meows» | ||
viki | ^ that's what I imagined you were talking about when you said you wanted to use same code for file and string writing. | ||
But now what you're saying sounds like you just want a conditional that spurts into a file :| | |||
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
|
|||
ab6tract | RT #124529 | 19:19 | |
synopsebot6 | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=124529 | ||
viki | That's a terrible skip description :/ | 19:21 | |
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» | ||
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"; | ||
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'» | ||
viki | Is that the only difference? | ||
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"; | |||
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:25
cdg joined
|
|||
moritz | fwiw the p5 advent calendar had submission deadline yesterday | 19:26 | |
should we start thinking about our own? | |||
viki | Sure, why not. | ||
Get people to commit to write early. | 19:27 | ||
moritz | who wants to contribute? I'd write one article | ||
tbrowder | viki: this is example-sig sub(..., IO::Handle :$fh, Str :$str is rw, ...) {} | 19:28 | |
TimToady waves from the PVR aeropuerto | |||
viki | Does it have to be a strictly technical article? | ||
[ptc] | o/ | ||
moritz | viki: no | ||
viki: what do you have in mind? | 19:29 | ||
viki | I can write one then. | ||
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 | |
19:30
kyclark joined
|
|||
dalek | : 1969834 | moritz++ | misc/perl6advent-2016/schedule: Empty schedule for Perl 6 advent calendar 2016 |
19:31 | |
moritz | ok, slots are up for taking | ||
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. | ||
tbrowder | shouldn't that work, and be reasonably efficient (except for space)? | ||
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 } | ||
and do-stuff does your "write to string" thing | 19:33 | ||
moritz wants to write about his book project | |||
tbrowder | that's why i wanted to have choice of handle be transparent to avoid genning big str if not needed | ||
btw, this is not a class method | |||
viki | Well, same with subs, just have one that's private | 19:34 | |
19:34
nadim joined
|
|||
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 | |
uh, 6.d? | |||
19:37
RabidGravy joined
|
|||
viki | Then the first version is what you'd use | 19:37 | |
s: open("/tmp/foo", :w), 'write' | 19:38 | ||
SourceBaby | viki, Sauce is at github.com/rakudo/rakudo/blob/94d1...le.pm#L636 | ||
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 | |
m: "x".encode | |||
camelia | ( no output ) | ||
viki | s/encode/decode/ and vice-versa | 19:41 | |
dalek | : 793d377 | (Zoffix Znet)++ | misc/perl6advent-2016/schedule: Book Dec. 2 advent |
19:43 | |
viki | Zoffix can switch dates if anyone wanted the 2nd :) | ||
19:43
wamba left
|
|||
FROGGS | does he? :o) | 19:43 | |
19:45
erdic left,
labster joined,
erdic joined
19:46
atweiden joined
|
|||
viki | Yup :) | 19:46 | |
I've checked ;) | |||
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:47 | ||
19:48
wamba joined
19:50
itaipu left
|
|||
moritz | perlgeek.de/blog-en/perl-6/2016-advent-cfp.html (lizmat, would be nice if you could mention that in the next p6weekly) | 19:51 | |
masak | moritz: to clarify, "midnight (UTC)" or some other midnight? | 19:55 | |
masak considers contributing this year | |||
masak .oO( oh, the 'mu' repository -- sure, that's where we do perl6advent scheduling! ) :P | 19:56 | ||
masak .oO( why's it called 'mu'? uuuurhm, because it's the "Perl 6 Muadvent"...? alright, alright, I don't know! ) | 19:57 | ||
DrForr | Reference to the appropriate k\"oan, I suppose. | 20:00 | |
masak | m: say Mu | 20:01 | |
camelia | rakudo-moar 94d19e: OUTPUT«(Mu)» | ||
moritz | masak: should we start a new repo? | ||
masak | no no no, I'm just being facetious | ||
as usual :> | |||
[ptc] | as musual? | ||
masak | *groan* | ||
it's... an excellent repo to do planning in. I wouldn't want it any other way. | |||
m: say (Mu) | 20:02 | ||
camelia | rakudo-moar 94d19e: OUTPUT«(Mu)» | ||
20:02
itaipu joined
|
|||
masak | m: say (((((Mu))))) | 20:02 | |
camelia | rakudo-moar 94d19e: OUTPUT«(Mu)» | ||
masak | (now with extra bass) | ||
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 | |
but so far, I haven't cared enough to migrate | |||
masak | me neither | ||
I kinda hope we keep doing it in mu :) | |||
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 | ||
geekosaur: ooh, that sounds like a blog post in itself! :D | |||
"implementing Perl 6 Mudvent" | |||
dalek | : 2637c13 | moritz++ | misc/perl6advent-2016/schedule: Claim an advent spot |
20:07 | |
tbrowder | viki: thank you! | ||
moritz | I used to hate git's " ! [rejected] master -> master (fetch first)" | ||
20:08
espadrine left
|
|||
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 | ||
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" | ||
[ptc] | I once took masak's advice and now use `git pull --rebase` liberally; it's now in my muscle memory | ||
masak | [ptc]: I said that? good :) | ||
[ptc] | masak: yup! And it's been really handy! | ||
masak | [ptc]: mostly I think merges-due-to-pulling are arbitrary and annoying | ||
20:10
kyclark left
|
|||
[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:10 | |
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
|
|||
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 :) perl6.party/post/I-Botched-A-Perl-6...ing-My-Job | ||
masak | [ptc]: sometimes I rebase and merge locally even with PRs, so that I don't get the merge commit. | ||
viki | tbrowder, one that returns | ||
masak | tbrowder: returns | 20:13 | |
tbrowder: because the other one can be had with $str.=themethod | |||
DrForr | cusr time for Template::Toolkit fell drastically over the last release; I was at 64.02, down to 48.96 avg. | ||
[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 | ||
tbrowder | but this is a sub, not a class method | ||
[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... | |||
masak | tbrowder: $str.=&thesub | 20:16 | |
viki | [ptc] no, it was due to rebase. The github edit was a technically post-release commit. | ||
[ptc] | viki: ah, ok | ||
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» | ||
tbrowder | masak, thanks, p6 is great! | ||
masak | ...it's OK, I guess... :P | ||
tbrowder | i'll take that as an humble reply... | 20:19 | |
20:20
zakharyas joined
|
|||
masak | humility would imply that I had a bigger part in bringing it about than I actually do :) | 20:21 | |
ergo, I'm just being silly | |||
viki | .oO( or you're humbly downplaying your part... ) |
20:22 | |
20:23
domidumont left
|
|||
masak | *meta*-humility!? why, I'd never... | 20:23 | |
20:23
ocbtec left
|
|||
lizmat | .oO( macro-humility? :-) |
20:24 | |
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:27
kurahaupo__ is now known as kurahaupo
20:28
kyclark joined,
itaipu left
20:30
RabidGravy left
|
|||
dalek | c: 98a7489 | (Jan-Olof Hendig)++ | doc/Type/Blob.pod6: Wrote docs for Blob.bytes |
20:34 | |
20:34
RabidGravy joined
|
|||
harmil_wk | Been asking myself: what would P6CRE look like... Last night I started writing up a rough spec: gist.github.com/ajs/72fecbbe8e714c...a171e74186 | 20:43 | |
masak | harmil_wk: interesting! | 20:47 | |
samcv | so i'm working with channels, and i'm trying to get this to go multi threaded vpaste.net/1XuaC | 20:52 | |
20:52
skids left
|
|||
samcv | atm it works fine, but i would like it to spawn extra workers when thre are things in the channel | 20:52 | |
i tried, do for $chan.receive -> $file { start { code here } } but that didn't work | 20:53 | ||
maybe if i put a start block inside the loop? hm | 20:55 | ||
let me try that. any tips you guys have would be great | |||
oh nice. actually that did work :), now just need to make it not exit the loop until all the promises are kept. | 20:57 | ||
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 | 20:59 | |
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 | |
21:01
nowan left
|
|||
samcv | s/domy/doing | 21:01 | |
21:02
kyclark left
21:04
kyclark joined,
nowan joined
21:06
ugjka left
|
|||
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» | ||
ugexe | m: await Promise.allof(start { sleep 1; say time; }, start { sleep 5; say time; }); say "done"; | 21:10 | |
camelia | rakudo-moar 94d19e: OUTPUT«14780346181478034622done» | ||
ugexe | it will depend on the result of 'allof' the promises | ||
tbrowder | masak: so i'm not sure how to do the .= trick. (($str.=&sub($str, args...)), $str2); # ?? | 21:12 | |
21:13
ugjka joined
|
|||
masak | tbrowder: I'm not sure either. | 21:14 | |
21:14
andrzejku left
|
|||
tbrowder | i don't think a subs return type works for multi sub selection... | 21:16 | |
nor the trait on an arg | |||
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; | ||
camelia | rakudo-moar a1347c: OUTPUT«[1]» | ||
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]» | ||
samcv | ugexe, i've almost got it. vpaste.net/A55b9 | 21:20 | |
it misses two files though, comparing the number of files to what it outputs at the end | |||
21:20
ggoebel left
|
|||
samcv | but it's close | 21:20 | |
i'm thinking maybe it checks "last if $chan.closed and $group" before it pushes the promises above it? hm | 21:22 | ||
ugexe | i think you want react/whatever block construct | 21:23 | |
whenever^ | |||
samcv | i will look at that, thanks ugexe | 21:24 | |
21:27
lizmat left
21:29
Sgeo_ joined
21:31
Sgeo left
21:34
ggoebel joined
|
|||
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:49 | |
21:51
zakharyas left
|
|||
grondilu | ls | 21:52 | |
samcv | ls = lets see? vpaste.net/9vJny | 21:54 | |
21:54
nicq20 joined
|
|||
samcv | for some reason if i do: while ! $chan.closed or ! Promise.allof(@promises) i get a segfault | 21:54 | |
at the end of the program | |||
but like in the link works awesome | 21:55 | ||
21:55
bjz joined
21:58
pmurias left
22:03
bjz left
22:04
bjz joined
|
|||
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:06 | |
seems milliseconds matter | 22:07 | ||
22:08
rindolf left
22:09
devmikey joined
22:10
bjz left,
RabidGravy left
22:12
firstdayonthejob joined
22:14
nowan left
22:16
nowan joined
22:18
kurahaupo left
|
|||
samcv | All promises done It's closed! pre: 508 mid: 496 post: 508 loop times: 999 Total promises: 508 | 22:20 | |
vpaste.net/oXU5r changed the code, at least i see what's going on more | |||
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:21 | ||
22:30
setty1 left
|
|||
tbrowder | ref sub sigs: is there a way to constrain a param to one of two types? | 22:44 | |
i mean in the same sig, not using multi dispatch | 22:48 | ||
22:52
sufrostico joined
|
|||
ilmari was expecting sub foo (Int|Str $x) to work, but no | 22:54 | ||
m: sub foo (Int|Str $x) { say $x }; foo(42); foo("bar"); foo(4.2) | |||
camelia | rakudo-moar a1347c: OUTPUT«===SORRY!===No compile-time value for Str» | ||
jnthn | $x where Int|Str | 22:55 | |
|c is the argument capture syntax, so we can't have Int|Str there | |||
ilmari | ah | ||
22:56
nicq20 left
23:00
kyclark left
|
|||
tbrowder | hm maybe something foo($f where { $f ~~ io.handle or $f ~~ Str}, ...) | 23:00 | |
using the precise correct syntax of course | 23:01 | ||
that is described in the docs, types => signature | 23:02 | ||
23:02
mohae left
23:03
mohae joined
|
|||
tbrowder | i'll experiment with that in a script...nite p6 people | 23:04 | |
23:04
tbrowder left
|
|||
AlexDaniel | ilmari: the error message is LTA and it would be nice to at least have a ticket for that | 23:08 | |
23:09
perlawhirl joined
23:13
jameslenz left
|
|||
samcv | it turns out it is actually working correctly... but. somehow it's not iterating the variable properly... WTF | 23:14 | |
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 | ||
but the variables aren't being iterated properly. this makes no sense | |||
is this a bug? | |||
jnthn | ++ is not atomic | 23:16 | |
So $start_prom++; is a data race | |||
samcv | ah | 23:17 | |
and here i was tearing my hair out for nothing :P | |||
23:19
labster left
|
|||
samcv | jnthn, what should i use instead? | 23:20 | |
what should i search for to read more about this in perl 6, so i can fully understand it | |||
jnthn | I'd probably have set off some workers that each had a react block, and did whenever on the channel | 23:23 | |
23:23
devmikey left
|
|||
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 | ||
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 | ||
jnthn | Yeah, you can use an old fashioned lock too, but `if $chan.poll -> $file {` in a while loop means it'll busy-wait | ||
Whereas a react/whenever woudln't | |||
*wouldn't | 23:25 | ||
AlexDaniel | why do you even need $start_prom and $end_start? | 23:26 | |
jnthn guessed they were for debugging | |||
23:27
grondilu left
|
|||
AlexDaniel | the idea of firing up a bunch of start {} blocks at the same time is also weird | 23:29 | |
you probably want a fixed number of worker threads, in which case hyper/race may be more suitable… if only they worked | 23:31 | ||
I usually do something like for ^4 { start { … } } | 23:32 | ||
and in each start block I pull required data from a channel (which you already have) | |||
jnthn | Firing off a bunch of start blocks is fine really | 23:33 | |
They aren't a thread each; you're just giving them to the scheduler | 23:34 | ||
Sleep time for me; 'night | 23:35 | ||
23:36
jameslenz joined
23:37
firstdayonthejob left
|
|||
AlexDaniel | yeah, exactly, you are polluting the scheduler. | 23:39 | |
samcv | good idea AlexDaniel. | 23:40 | |
23:41
dataangel joined
|
|||
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:43 | |
it says tap outputs a supply object, and supply has a lines method. maybe i'm not calling it right | 23:48 | ||
ah i got it :D. sorry for all the questions | 23:51 | ||
23:55
lizmat joined
|