»ö« 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. |
|||
lollercopter | m: use nqp; for ^10000 { my $v = "Hostname=This is a-test"; if $v.starts-with: 'Hostname=' { my $x = nqp::join('_', nqp::split('-', nqp::join('_', nqp::split(' ', nqp::substr($v, 9))))) } }; say now - INIT now | 00:00 | |
camelia | 0.03849455 | ||
lollercopter | m: use nqp; my $v = "Hostname=This is a-test"; for ^10000 { nqp::index($v, 'Hostname=') || nqp::join('_', nqp::split('-', nqp::join('_', nqp::split(' ', nqp::substr($v, 9))))) }; say now - INIT now | 00:01 | |
camelia | 0.0294379 | ||
TEttinger | faster as in speed or faster as in amount of code? | ||
lollercopter | m: use nqp; my $v = "Hostname=This is a-test"; nqp::index($v, 'Hostname=') || nqp::join('_', nqp::split('-', nqp::join('_', nqp::split(' ', nqp::substr($v, 9))))).say | 00:02 | |
camelia | This_is_a_test | ||
TEttinger | I mean, those are definitely better on speed | ||
lollercopter | m: use nqp; my $v = "Hostname=This is a-test"; for ^10000 { }; say now - INIT now | ||
camelia | 0.0029200 | ||
00:02
Cabanossi left
|
|||
lollercopter | m: say 2.114/.159 | 00:02 | |
camelia | 13.295597 | ||
lollercopter | m: say 2.114/.027 | 00:03 | |
camelia | 78.296296 | ||
lollercopter | Voldenet: so there. 13x faster if you want it pure perl 6 and 78x faster if you don't mind using nqp | ||
00:04
Cabanossi joined,
zacts joined
|
|||
lollercopter | Voldenet: getting rid of blocks and regexes are generally a way to speed stuff up | 00:04 | |
Well, I mean a sure-fire way | 00:05 | ||
00:06
mcmillhj joined
|
|||
lollercopter crawls back into the hole | 00:07 | ||
00:07
lollercopter left,
araujo joined
00:10
cdg_ joined
00:11
mcmillhj left
00:14
cdg left,
mcmillhj joined
00:15
cdg_ left
00:19
mcmillhj left
|
|||
Voldenet | Nice! :D | 00:20 | |
00:25
mcmillhj joined
00:31
mcmillhj left
00:40
cdg joined,
mcmillhj joined
00:43
mr-foobar left
00:44
mr-foobar joined
00:45
cdg left,
mcmillhj left
00:51
mcmillhj joined
00:56
zacts left
00:57
mcmillhj left
01:02
Cabanossi left,
mcmillhj joined
01:04
Cabanossi joined
01:05
zacts joined
01:13
mr-foobar left
01:15
mr-foobar joined
01:19
LeCamarade left
01:29
mcmillhj left,
troys is now known as troys_
01:43
mcmillhj joined,
mr-foobar left
01:45
mr-foobar joined
01:48
mcmillhj left
01:56
troys_ is now known as troys
01:58
mcmillhj joined
02:03
mcmillhj left
02:10
mcmillhj joined
02:11
AlexDaniel left
02:13
mr-foobar left
02:15
mcmillhj left,
cyphase left
02:16
mr-foobar joined
02:20
ctilmes left,
cyphase joined
02:22
noganex_ joined
|
|||
awwaiid | It was nice seeing some of you at TPC-2017-DC (aka YAPC::NA)! | 02:23 | |
02:24
noganex left
02:27
mcmillhj joined
02:31
troys is now known as troys_,
mcmillhj left
02:43
mr-foobar left
02:47
mr-foobar joined
02:51
mcmillhj joined
02:56
mcmillhj left
03:00
troys_ is now known as troys
03:02
mcmillhj joined
|
|||
BenGoldberg | So I've got a hard problem, and it doesn't involve cache invalidation or an off by one error ;) | 03:02 | |
03:02
Cabanossi left
03:04
Cabanossi joined
|
|||
BenGoldberg | I'm working on some magic so that you can have class Foo with a repr('CStruct'), with attributes in it which can contain subroutines, which will be properly serialized. | 03:05 | |
I'm leaning towards a syntax of: has $foo is fptr :(int32 $arg --> int32); | 03:06 | ||
But, I'm unhappy with the "fptr" name :P | 03:07 | ||
03:07
mcmillhj left
|
|||
BenGoldberg | Could someone suggest a better name? | 03:08 | |
samcv | can anybody see any problems with this implementation of recursive directory finder? sub get-dirs (IO::Path:D $path) { | 03:12 | |
my @paths = $path.dir.grep(*.d); | |||
if @paths { | |||
@paths.append: @paths».&get-dirs($_); | |||
} | |||
return @paths; | |||
} | |||
crap didn't mean to paste that here... ugh | |||
meant to paste the link... | |||
03:13
Cabanossi left,
Cabanossi joined
|
|||
samcv | here it is: gist.github.com/samcv/7dade9fb0a93...1d864d21c7 | 03:13 | |
i wanted to make it as simple as possible | |||
03:14
mr-foobar left
03:16
mr-foobar joined
03:18
mcmillhj joined
03:23
mcmillhj left
03:29
araraloren joined
03:31
troys is now known as troys_
03:34
mcmillhj joined
03:40
mcmillhj left
|
|||
llfourn | samcv: you passed $_ to it when you've already passed it implicitly with .&get-dirs | 03:42 | |
(I didn't run the code but I'd hope that's a compile time error) | 03:43 | ||
samcv | it's not | ||
llfourn | :( | ||
samcv | i mean you can pass variables into it. i'm actually going to add more arguments so i'm going to need to make it explicit yes? | ||
though i guess this is different @dirs.map({&get-dirs($_, :$d)}) | 03:44 | ||
llfourn | but it only takes one arg and you've passed $_ twice to it | ||
samcv | but with brackets around it | ||
ah | |||
that passes it twice? | |||
llfourn | yeah | ||
BenGoldberg | This isn't perl5, you don't need the & there. | ||
llfourn | .&foo syntax passed the invocant in as the first argument to the sub | ||
samcv | BenGoldberg, even as a method? | ||
BenGoldberg | Well, maybe as a method, but not in {&get-dirs(...)} | 03:45 | |
samcv | well yeah. i just altered it from a method | ||
and didn't delete it. | |||
nobody was harmed :) | |||
llfourn | @dirs.map(*.&get-dirs(:$d)) # should do it | 03:47 | |
03:51
mcmillhj joined
|
|||
samcv | ok turns out it wasn't passing in :$d | 03:55 | |
doing it like that... | |||
or something @dirs.map({ get-dirs($_; :$d) } ) # Unexpected named argument 'd' passed wtf | |||
llfourn | ^ err was that smicolon meant to be there? | 03:56 | |
03:56
mcmillhj left
|
|||
samcv | yes | 03:56 | |
llfourn | why? | ||
samcv | sorry uploading new version | ||
ok check again | |||
because i'm using named arguments | 03:57 | ||
llfourn | hmm | ||
I seem to remember something vaguely about semicolons and named arguments | |||
samcv | oh crap i used a semicolon | 03:58 | |
sorry i misread semicolon as colon | |||
llfourn | lol | ||
samcv | haha | ||
i'm going blind! | |||
llfourn | that is an LTA error though | ||
but there is some kind of semicolon in pararmeter list syntax | |||
samcv | yeah | ||
03:58
mr-foobar left
04:00
mcmillhj joined
|
|||
samcv | well it seems to work | 04:00 | |
04:01
mr-foobar joined
|
|||
samcv | i get 32326 directories with find and 32414 with perl 6 | 04:01 | |
not sure why it's different | 04:02 | ||
at least find returns one '.' but that would make find have one more directory | |||
llfourn | maybe sort and diff the output | 04:03 | |
samcv | this liessss | 04:05 | |
docs.perl6.org/routine/flatmap#(Li...od_flatmap the docs page for flatmap | |||
"invokes uc four times." untrue! | |||
m: say ((1, 2), <a b>).flatmap({ $a++; uc($_)}).perl; say $a | 04:06 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$a' is not declared at <tmp>:1 ------> 3say ((1, 2), <a b>).flatmap({ 7⏏5$a++; uc($_)}).perl; say $a |
||
samcv | m: my $a = 0; say ((1, 2), <a b>).flatmap({ $a++; uc($_)}).perl; say $a | ||
camelia | ("1 2", "A B").Seq 2 |
||
llfourn | yep that's wrong | ||
samcv | map runs 4 times | 04:07 | |
flatmap doesn't | |||
also both have the same output | |||
llfourn | flatmap just does .map then .flat | ||
samcv | so it's the worst example ever | ||
llfourn | yeah .flatmap is considered harmful | ||
samcv | oh wait nvm | ||
i forgot to reset the value of $a. both of them still do it twice | |||
llfourn | samcv: lol, github.com/perl6/doc/issues/851 | ||
samcv | and both have the same output. map or flatmap | 04:08 | |
for the love of god someone do something! | |||
llfourn | haha | ||
samcv panics and runs around screaming | |||
Voldenet | > sub get-dirs (IO::Path:D $path) { flat gather for $path.dir.grep(*.d) { take $_, get-dirs($_) }} | ||
it's ugly, but it works | |||
samcv | smls opened this issue on Aug 21, 2016 | ||
not that ugly | 04:09 | ||
i wonder how it is speedwise | |||
04:09
mcmillhj left
|
|||
llfourn | I've never actually gather take | 04:09 | |
always do map/grep | |||
actually used* | 04:10 | ||
samcv | it is kinda nice if you want a sequence | ||
and not all at once | |||
Voldenet | gather take is supposed to be lighter on memory if I reason correctly | 04:11 | |
04:11
Cabanossi left
|
|||
llfourn | doesn't map grep produce a lazy seq anyway? | 04:11 | |
or do I have to put lazy in front | 04:12 | ||
04:12
kyan joined
04:13
Cabanossi joined
04:19
khw left
|
|||
Voldenet | Hm, I believe map grep do produce lazy seq when you give them lazy seq | 04:23 | |
04:27
wamba joined
|
|||
BenGoldberg | m: dd map *, grep {1}, ^10; | 04:28 | |
camelia | Cannot resolve caller map(Whatever, Seq); none of these signatures match: (&code, + is raw) in block <unit> at <tmp> line 1 |
||
llfourn | m: my $a = (^10).map: { .say }; # only runs if it's sunk | ||
camelia | ( no output ) | ||
BenGoldberg | m: dd map {$_}, grep {1}, ^10; | ||
camelia | (0, 1, 2, 3, 4, 5, 6, 7, 8, 9).Seq | ||
BenGoldberg | m: dd map {say}, grep {1}, ^10; | 04:29 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Unsupported use of bare "say"; in Perl 6 please use .say if you meant to call it as a method on $_, or use an explicit invocant or argument, or use &say to refer to the function as a noun at <tmp>:1 --… |
||
BenGoldberg | m: dd map {.say}, grep {1}, ^10; | ||
camelia | 0 1 2 3 4 5 6 7 8 9 (Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True).Seq |
||
llfourn | m: my @a = (^10).map: { .say }; # if it's assigned it probably runs too | ||
camelia | 0 1 2 3 4 5 6 7 8 9 |
||
BenGoldberg | m: my $nosink := map {.say}, grep {1}, ^10; say 'hmm'; | ||
camelia | hmm | ||
BenGoldberg | m: my $nosink := map {.say}, grep {1}, ^10; say 'hmm'; say $nosink.perl | ||
camelia | hmm 0 1 2 3 4 5 6 7 8 9 (Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True, Bool::True).Seq |
||
llfourn | m: my @a = lazy (^10).map: { .say }; # but if you put lazy it shouldn't | ||
camelia | ( no output ) | ||
Voldenet | my $nosink = map {.say}, grep {1}, ^10; say $nosink.take(5) | 04:32 | |
m: my $nosink = map {.say}, grep {1}, ^10; say $nosink.take(5) | |||
camelia | Too many positionals passed; expected 1 argument but got 2 in block <unit> at <tmp> line 1 |
||
Voldenet | erm | 04:33 | |
m: my $nosink = map {.say}, grep {1}, ^10; say $nosink.head(5); | |||
camelia | 0 1 2 3 4 (True True True True True) |
||
04:36
mcmillhj joined
|
|||
Voldenet | in fact | 04:38 | |
sub get-dirs (IO::Path:D $path) { $path.dir.grep(*.d).deepmap: { $_, get-dirs($_) } } | |||
that would be even better way to do this :D | |||
llfourn | isn't deepmap pointless because dir is only going to give you a an array of paths? | 04:44 | |
04:44
mcmillhj left
04:47
mcmillhj joined
04:48
raiph joined
|
|||
Voldenet | hm, get-dirs gives you a lazy sequence of a dir, so deepmap would give you a sequence representing a directories tree | 04:48 | |
m: sub get-dirs (IO::Path:D $path) { $path.dir.grep(*.d).deepmap({$_, get-dirs($_)}).flat }; say get-dirs(".".IO).elems | 04:50 | ||
camelia | Type check failed in binding to parameter '$path'; expected IO::Path but got IO::Path.new(".", :SP... in sub get-dirs at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
04:51
mcmillhj left
|
|||
Voldenet | It works on my box, I guess "no fun allowed" anymore :P | 04:53 | |
04:53
troys_ is now known as troys
04:57
Cabanossi left
04:58
Cabanossi joined
|
|||
samcv | ok i'm fi xing flatmap docs right now | 05:00 | |
Geth | doc: b90d2f82c6 | (Samantha McVey)++ | doc/Type/List.pod6 Provide correct documentation for .flatmap The previous example's explanation was wrong, and the example had the same result on both .map and .flatmap, making it an even more confusing function. The documentation now strongly recommends use of .map.flat and recommends to instead using the confusing .flatmap Fixes issue #851. |
05:02 | |
samcv | that bug was so old :( | ||
05:03
mcmillhj joined
|
|||
samcv | sad! | 05:03 | |
05:03
troys left
|
|||
llfourn | samcv++ | 05:05 | |
samcv | i just solved world hunger | ||
ok maybe nothing that important | |||
but i feel happy about it | |||
ugexe | m: my $files = -> $p = $*CWD { $p.f ?? $p !! dir($p)>>.&?BLOCK.Slip }; say $files().map(*.parent).unique; | ||
camelia | Failed to get the directory contents of '/home/camelia/.local/share/systemd/user': Failed to open dir: 2 in block <unit> at <tmp> line 1 |
||
05:06
wamba left
05:07
mcmillhj left
|
|||
Voldenet | uh, getting a list of files and then doing .map(*parent).unique is a very unique way of doing this :) | 05:13 | |
05:17
pilne left
05:18
roguelazer joined,
mcmillhj joined
|
|||
Geth | doc: 286e135bac | (Samantha McVey)++ | doc/Type/Hash.pod6 Be more clear about %() being preferred to { } for hash creation Work on fixing #1380 In addition to more highly recommending %(), we also use less text and make the examples of the pitfalls more clear. |
05:19 | |
samcv | this also makes me happier too | ||
BenGoldberg | I would have, instead of 'To assign to a variable without the C<%> sigil', 'To assign a hash to a variable which does not have the C<%> sigil' | 05:23 | |
05:23
mcmillhj left
|
|||
samcv | isn't that the same thing? | 05:24 | |
BenGoldberg | Also, s/Instead, you should use/This would have been avoided if you had used/. | ||
samcv | which does not vs without | ||
does not have vs without | |||
BenGoldberg | Well, it's almost the same thing, except we're still using a %, just on the right side of the = instead of the left. | 05:25 | |
Voldenet | ugexe: apparently calling unique on IO doesn't work all that well on my system, but calling it on *.parent.Str works | ||
samcv | Voldenet, did you sort them with eqv? | 05:26 | |
.sort(&[eqv]).unique | 05:27 | ||
05:29
mr-foobar left
05:31
mr-foobar joined
|
|||
Voldenet | .unique(:with(&[eqv])) kind of works, but it's slow | 05:31 | |
samcv | kind of works? or works but slowly | ||
samcv wonders if we have an eqv candidate for IO::Path | 05:32 | ||
Voldenet | It works, but it's incredibly slow | ||
this takes a blink of an eye > .map(*.parent.Str).unique; | 05:33 | ||
this takes longer than 10s > .map(*.parent).unique(:with(&[eqv])) | |||
samcv | yeah i know it is slow :P | ||
Voldenet | Ah, /eqv/ might not be the operator I was wanting to use | 05:34 | |
samcv | and does .sort not work? | ||
Voldenet | Nope, see for yourself: my $files = -> $p = $*CWD { $p.f ?? $p !! dir($p)>>.&?BLOCK.Slip }; .say for $files().map(*.parent).sort.unique; | ||
05:34
mcmillhj joined
|
|||
samcv | oh you're running unique without sort? does th't work? | 05:34 | |
Voldenet | The set is pretty much sorted anyway, so there's no need to sort it again :) | 05:35 | |
samcv | that doesn't work for me | ||
well i don't think unique even works if thigs are not sorted.. | 05:36 | ||
ah maybe i'm wrong | |||
that doesn't even run that is | 05:37 | ||
Voldenet | It seems that .unique works right on Str | ||
samcv | Failed to get the directory contents of '/home/samantha/git/rakudo/.nav-marker-rules': Failed to open dir: 2 | 05:38 | |
timotimo | i'd expect unique to work with .WHICH | ||
samcv | why? | ||
well it does call WHICH | 05:39 | ||
ah yeah cause it literally is checking if they're the same object period | |||
but it doesn't work if you have two thinsg which are different objects but have the same contents | 05:40 | ||
unless it's a Str | |||
and prolly an Int | |||
or Rat | |||
other things no | |||
05:40
mcmillhj left
|
|||
samcv | m: say dir[0].WHICH | 05:40 | |
camelia | IO::Path|60080000 | ||
timotimo | you could of course implement "unique" based on eqv | 05:41 | |
samcv | m: say dir[0].WHICH; say dir[0].WHICH | ||
camelia | IO::Path|43442208 IO::Path|43442288 |
||
timotimo | but that'll blow up run time quadratically | ||
samcv | er maybe you want unique with cmp? | 05:42 | |
or uh. would eqv work? since uh. it only gives True or False | |||
usually you implement unique by sorting and then removing duplicates next to each other | |||
timotimo | you'd have to eqv the new element with every existing element | ||
samcv | yeah | ||
Voldenet | with IO::Path .unique(:as(*.Str)) would work reasonably well | ||
timotimo | that'd be faster, yeah | 05:43 | |
though not everything you can eqv you can cmp | |||
samcv | yep | ||
Voldenet, that won't work if the CWD is different i would guess right? | |||
Voldenet | Yeah. | ||
timotimo | yeah, it'd have to be :as(*.absolute) | ||
05:44
xtreak joined
|
|||
Voldenet | well, I'd still rather use: sub get-dirs (IO::Path:D $path) { $path.dir.grep(*.d).deepmap({$_, get-dirs($_)}).flat } | 05:44 | |
samcv | well that won't find unique paths on/ly ones that refer to the same thing | ||
since paths store more info than that | |||
that cuold cause weird bugs? depending? | |||
not sure | |||
maybe if you use .Str ever | 05:45 | ||
i've never used deepmap hm | |||
how does it differ from map | |||
Voldenet | it's invoked on subsequences as well | 05:46 | |
and since get-dirs returns a sequence, the map would invoke it recursively | 05:47 | ||
samcv | map works for sub arrays but not subsequences or what? i've never tried to go very deep | 05:48 | |
Voldenet | m: (1, (2, 3), 4).map({ .say; *+1 }) | 05:50 | |
camelia | 1 (2 3) 4 |
||
Voldenet | m: (1, (2, 3), 4).map({ .say; $_ + 1 }).say | ||
camelia | 1 (2 3) 4 (2 3 5) |
||
Voldenet | not what I'd expect | ||
m: (1, (2, 3), 4).deepmap({ .say; $_ + 1 }).say | |||
camelia | 1 2 3 4 (2 (3 4) 5) |
||
Voldenet | better :) | ||
m: (1, ^5, (2, 3), 4).deepmap({ $_ + 1 }).say | 05:51 | ||
camelia | (2 (1 2 3 4 5) (3 4) 5) | ||
05:53
travis-ci joined
|
|||
travis-ci | Doc build errored. Samantha McVey 'Provide correct documentation for .flatmap | 05:53 | |
travis-ci.org/perl6/doc/builds/246458765 github.com/perl6/doc/compare/7d9e8...0d2f82c6ff | |||
05:53
travis-ci left
05:56
mr-fooba_ joined,
Cabanossi left
05:57
mr-foobar left
05:59
Cabanossi joined,
xtreak_ joined
06:02
xtreak left
|
|||
ugexe | m: (1, (^5), ((4,5),), 6).tree(*.self, *.reverse, *.sum).say | 06:04 | |
camelia | (1 (4 3 2 1 0) (9) 6) | ||
Voldenet | what does .tree do? | 06:05 | |
ugexe | m: (1,(2,3),4).tree(*.self, *.reverse).say; (1,(2,3),4).tree(*.reverse, *.self).say | 06:06 | |
camelia | (1 (3 2) 4) (4 (2 3) 1) |
||
ugexe | m: (1,(2,3),(4,(5,6))).tree(*.self, *.self, *.reverse).say; | 06:07 | |
camelia | (1 (2 3) (4 (6 5))) | ||
06:09
travis-ci joined
|
|||
travis-ci | Doc build errored. Samantha McVey 'Be more clear about %() being preferred to { } for hash creation | 06:09 | |
travis-ci.org/perl6/doc/builds/246461571 github.com/perl6/doc/compare/b90d2...6e135bac9d | |||
06:09
travis-ci left,
nbrown joined
|
|||
samcv | ahh go away travis | 06:09 | |
travis is a big meanie. won't even finish building | 06:11 | ||
though! the cache did work | |||
we need one build that does highlighting and one that doesn't i think | 06:13 | ||
but i don't have time for that today | |||
06:15
domidumont joined
06:19
tony-o joined
06:21
domidumont left,
domidumont joined
06:24
mr-fooba_ left
06:25
parv joined
06:28
MasterDuke left
06:32
domidumont left
06:33
domidumont joined
06:38
mr-foobar joined
06:42
jamesaxl joined
|
|||
jamesaxl | hi | 06:42 | |
mst: do you use perl 6? | |||
TEttinger | from what I understand, mst uses some of every language ever comprised. ever heard of Kernel? | 06:43 | |
jamesaxl | TEttinger: I think that he does not use anything | 06:45 | |
TEttinger: how about you? | 06:46 | ||
TEttinger | I do not use perl 6. | 06:47 | |
jamesaxl | TEttinger: only perl5? | ||
TEttinger | I can write a teensy bit of very simple perl6. my perl5 is limited to regexes. | 06:48 | |
I'm interested in how perl6's grammars work | |||
I think they are an elegant way of constructing DSLs | |||
jamesaxl | TEttinger: do you think that perl6 can be good in the future? | 06:50 | |
TEttinger | yes. | ||
I think there are speed issues holding it back currently, but that's addressable by MOAR VM improvements | 06:51 | ||
I think the language itself is phenomenally complex and this makes it hard to attract users | 06:52 | ||
that said, C++ has tons of users and is a very complex language, probably just as much or more so than perl6 | |||
things like junctions are brilliant for describing what you mean rather than building complex if-else statements | 06:53 | ||
jamesaxl | TEttinger: and how about modules, I see that perl6 lacks to very important modules. | ||
TEttinger | yeah it lacks tons, but Inline::Perl5 makes it apparently very easy to call perl5 code | 06:54 | |
06:55
domidumont left
|
|||
jamesaxl | TEttinger: And how can I share modules of perl6 (I meant my modules)? | 06:57 | |
TEttinger | I do not use perl 6. but I think CPAN is in the process of changing to accept perl6 as well as perl5 | 06:58 | |
nine | TEttinger: it already does | ||
TEttinger | I yield the floor to nine | 06:59 | |
jamesaxl | nine: can I upload it use pause? | 07:00 | |
nine | jamesaxl: indeed, you can :) | ||
You can use mi6 (App::Mi6) for added convenience | 07:01 | ||
jamesaxl | that is nice | 07:03 | |
nine | zef will find the distro about half an hour or an hour later. The only bit that's missing to my knowledge is listing the module on modules.perl6.org | ||
BenGoldberg | m: package Foo { our proto bar(|) {*}; our multi bar(Int) { 'int' } }; dd Foo::bar(42); | 07:08 | |
camelia | "int" | ||
BenGoldberg wonders if that's considered a bug. | |||
nine | Why would it? | 07:09 | |
BenGoldberg | m: package Foo { our proto bar(|) {*}; my multi bar(Int) { 'int' } }; dd Foo::bar(42); | ||
camelia | "int" | ||
BenGoldberg pasted the wrong version. | |||
The 'my' is basically ignored. | 07:10 | ||
nine | BenGoldberg: it's not: | 07:13 | |
m: package Foo { our proto bar(|) {*}; { my multi bar(Int) { 'int' } } }; dd Foo::bar(42); | |||
camelia | Cannot resolve caller bar(Int); Routine does not have any candidates. Is only the proto defined? in block <unit> at <tmp> line 1 |
||
nine | Foo::bar(42) conceptually calls the proto bar(|) which then calls the appropriate candidate which it does find in it's lexical scope | 07:14 | |
07:16
mr-foobar left
07:23
bwisti left,
mr-foobar joined
07:24
llfourn_ joined,
llfourn left
07:26
BenGoldberg left,
unclechu left,
xui_nya[m] left
07:29
xui_nya[m] joined,
unclechu joined
07:32
domidumont joined
07:34
zapwai left
07:39
skids left
07:44
domidumont left
07:45
setty1 joined
07:56
xtreak joined
07:57
xtreak__ joined
07:59
xtreak_ left
08:01
xtreak left
08:08
rindolf joined
08:17
parv left
08:26
darutoko joined
08:27
setty1 left
|
|||
Geth | ecosystem: d5e94b9211 | (Martin Barth)++ (committed using GitHub Web editor) | META.list Added HTTP-Server-Orgre Added HTTP-Server-Ogre - just another p6w http server |
08:30 | |
08:30
ufobat joined
08:36
parv joined
08:42
LeCamarade joined
09:06
xtreak joined
09:10
xtreak__ left
09:11
xtreak_ joined
09:14
parv left,
xtreak left
09:16
ufobat left
09:25
ufobat joined
09:30
lizmat left
09:33
seatek joined
09:37
xtreak_ left,
lizmat joined
09:38
ufobat left
09:41
xtreak joined
09:49
parv joined
09:55
TEttinger left,
parv left
09:56
xtreak left
10:12
MARTIMM joined
10:30
jamesaxl left
10:32
jamesaxl joined
10:36
MARTIMM left
10:45
Sense8 joined
10:47
Sense8 left
11:00
lizmat left
11:05
nhywyll joined,
nhywyll left
11:06
lizmat joined
11:13
setty1 joined
11:17
nhywyll joined,
nhywyll left
11:28
nhywyll joined,
nhywyll left
11:41
nhywyll joined,
nhywyll left
11:46
MasterDuke joined
11:48
AlexDaniel joined
11:49
grondilu left
12:24
robertle joined
12:28
domidumont joined
12:29
kaare_ left
12:40
cpage_ left
12:42
Cabanossi left
12:45
ufobat joined
12:46
Cabanossi joined
12:48
ufobat left
12:57
domidumont left,
nbrown left
13:00
lucasb joined
13:12
domidumont joined,
Cabanossi left
13:16
Cabanossi joined
13:24
user3 joined
|
|||
user3 | why do I have to put a 'my' here 'my Str sub f() {}' while it's not needed in this one 'sub f() of Str {}' | 13:24 | |
13:27
pilne joined,
wamba joined
|
|||
masak | user3: that question does not seem to make sense out of the context you're in but have not stated | 13:31 | |
oh wait, maybe it does | |||
user3: I think the simple answer is "because if you want to specify a type like 'Str', you have to front with a declarator keyword" | 13:32 | ||
whether you make that keyword `my`, or `our`, or `has` or something else, is up to you | |||
masak loses today's Oxford Comma nomination | 13:33 | ||
user3 | k | ||
masak | user3: the same answer, but phrased differently, would be "a type like `Str` cannot front a declaration statement like `sub`" | 13:34 | |
user3 | yes, i understand the logic of it | ||
thx | |||
masak | pzh | ||
moritz | or from a different point of view: If it's not part of a declaration, a type name like Str is a term, so the parser expects an operator after it | ||
masak | oh, right | 13:38 | |
which makes for a nice contrast with e.g. Java, where type names and ordinary terms live in different namespaces | 13:39 | ||
so in Perl 6, the "cost" of the tradeoff is that you need to do `my Str` or `our Str` etc. at the start of declarations | |||
user3 | its a good bargain | ||
masak | whereas in Java, it's that you need to do `MyType.class` (to bring a type term from type land to term land) instead of just `MyType` | 13:40 | |
and it also makes `instanceof` a slightly magical operator :) | 13:41 | ||
(because it has to tell the parser, "hey, the rhs is a type, not a term") | |||
13:44
domidumont left
13:53
cpage_ joined
13:55
user3 left
14:02
BenGoldberg joined
14:04
bwisti joined
14:10
itaylor57 left
14:19
mscha joined
|
|||
mscha | m: my $p = start { for 1..5 { .say; sleep 1; } }; sleep 2; $p.break; | 14:19 | |
camelia | 1 2 3 Access denied to keep/break this Promise; already vowed in block <unit> at <tmp> line 1 |
||
mscha | How do I break a promise (from the “outside”)? | ||
mst | POSIX::_exit(255); # all promises are now broken | 14:26 | |
TimToady | mst: you can't break a promise unless the inside grants you access to the "vow" | ||
mscha | But what if I don't want to exit, just kill that promise? | ||
TimToady | that's by design | 14:27 | |
mscha | So in my case, once that promise is running, there's no way to stop it (except by exiting)? | ||
TimToady | I suppose it depends on where the inside put its vow? | ||
if it's in an object attribute you can get at it sneakily... | 14:28 | ||
mscha | I tried $p.vow.break, but it wouldn't let me either. | ||
m: my $p = start { for 1..5 { .say; sleep 1; } }; sleep 2; $p.vow.break; | |||
camelia | 1 2 3 Access denied to keep/break this Promise; already vowed in block <unit> at <tmp> line 1 |
14:29 | |
14:29
khw joined
|
|||
mst | TimToady: how does the inside of the start block gets its vow? | 14:30 | |
TimToady doesn't remember | |||
TimToady doesn't break many vows... | 14:31 | ||
the tests use Promise.new rather than start, so maybe start is doing something weird | 14:35 | ||
MasterDuke | docs.perl6.org/type/Promise#method_break mentions that using e.g., start, means you can't break it, so use Promise.new if you want to | 14:37 | |
mscha | But if you don't use start, how do you (asynchronously) run code? | 14:39 | |
TimToady | apparently start keeps its vow private, but if you can get the code to throw an exception, it'll break | 14:40 | |
you can always Promise.new yourself | |||
look at method start in src/core/Promise.pm | 14:41 | ||
TimToady heads for DCA, LAX, SJC... | 14:43 | ||
mscha | Hmm, okay, so looks like I can't do that - breaking a promise from the “outside” when the code in the promise is already running. | 14:46 | |
14:46
Ven joined
14:47
Ven is now known as Guest80266
14:48
Guest80266 left
14:51
nhywyll joined
14:54
skids joined
14:56
lucasb left
15:04
wamba left
15:10
davido_ joined
15:14
reino4477 joined
|
|||
reino4477 | hey, has anybody created a web app in Perl 6 recently? | 15:15 | |
15:15
kyan left
|
|||
reino4477 | i'm trying to understand if its eco system is ready more or less so I can use it for building web apps for myself | 15:16 | |
15:16
davido_ left
|
|||
AlexDaniel | reino4477: I think it depends | 15:17 | |
15:18
davido_ joined
|
|||
reino4477 | www.reddit.com/r/perl6/comments/6j...ment_what/ | 15:19 | |
MasterDuke | reino4477: Gabor Szabo is working on a book about it www.indiegogo.com/projects/book-we...bsite--2#/ | 15:22 | |
jnthn | fwiw, start and Promise are only related in that start blocks evaluates to a Promise. The start implementation looks something like sub start(&foo) { my $p = Promise.new; my $v = $p.vow; $*SCHEDULER.cue: { $v.keep(foo()); }, :catch({ $v.break($_) }); return $p } | ||
15:23
reino4477 left
|
|||
jnthn | Thus the vow is taken by start and kept with the result or broken if it throws an exception | 15:24 | |
15:24
davido_ left,
domidumont joined
|
|||
jnthn | I don't really get why you'd want to break the Promise from the outside, though. It's not like doing that would cancel the code runing in the Promise, or even prevent it from being schedulered if it wasn't already running. | 15:25 | |
It'd just result in it exploding with a "already kept/broke this Promise" at the end | |||
So I guess "what are you trying to achieve" is the righter question :) | |||
15:27
davido_ joined
15:28
kyan joined
15:44
skids left
15:48
Ven joined
15:49
k-man left,
Ven is now known as Guest44526
15:51
kaare_ joined
15:52
nhywyll left,
abraxxa joined
|
|||
abraxxa | I just built 2017.06 and now use v6c; isn't working any more | 15:53 | |
when I change it to use v6.c; it works again, did I miss a change there? | |||
15:55
lollercopter joined
|
|||
lollercopter | abraxxa: it worked only because of a bug. The right thing is v6.c | 15:56 | |
15:56
k-man joined
|
|||
abraxxa | lollercopter: I guessed so, thanks! | 15:56 | |
lollercopter | c: 2017.05 my str $x = '6c'; my num $y = $x; say $y | ||
committable6 | lollercopter, ¦2017.05: «6» | ||
lollercopter | c: 2017.06 my str $x = '6c'; my num $y = $x; say $y | ||
committable6 | lollercopter, ¦2017.06: «Can't convert '6c' to num: trailing characters in block <unit> at /tmp/inMsBbqJbY line 1 «exit code = 1»» | ||
lollercopter | ^ that's the bug that got fixed | 15:57 | |
abraxxa | do the release notes mention that somewhere? I couldn't find it | ||
15:58
davido_ left
|
|||
lollercopter | hm | 15:58 | |
m: dd v6c | |||
camelia | v6.c | ||
lollercopter | abraxxa: OK, nevermind, it's a new bug :D since v6c works a version literal for v6.c, it should work in `use` too, I think | 15:59 | |
abraxxa: no, release notes don't mention it | |||
16:00
kaare_ left
|
|||
abraxxa | ok | 16:00 | |
lollercopter | I can fix it... | 16:01 | |
16:02
kaare_ joined
|
|||
abraxxa | lollercopter++ | 16:04 | |
ugexe | i couldn't think `use v6c;` should work... | 16:22 | |
wouldnt^ | |||
lollercopter | ugexe: why not? | 16:23 | |
16:24
dotness joined
|
|||
ugexe | m: say v6c cmp v6.c; # i guess it depends on how you feel about .<alpha> being treated different that .<number> | 16:25 | |
camelia | Same | ||
lollercopter | it's not about that, Version splits on <alpha>/<digit> boundary, so it's liek the dot is still there | 16:26 | |
s: Version, 'new', \("6c") | |||
a right, no bot here | |||
16:26
pmurias joined
|
|||
lollercopter | github.com/rakudo/rakudo/blob/2a88...ion.pm#L35 | 16:26 | |
ugexe | well, for one it means that you cant do an extract string match on a version to find an exact matching version. in perl6 land this is trivial to handle, but will tooling outside of perl6? | 16:28 | |
16:28
andrzejku joined
|
|||
ugexe | its like "*" | 16:28 | |
where its easy to handle with perl6 tools, but everything else? | 16:29 | ||
lollercopter | Don' | ||
Don't care really it's a version literal. It's even parsed with the version-literal token. So I'd expect version literals to work | 16:30 | ||
It's up to the mystery-tool to learn to work with Perl 6 version literals. | |||
ugexe | the mystery tools are system package managers - apt-get, yum, etc. | 16:31 | |
lollercopter | Why are system package managers trying to parse a Perl 6 program to figure out version? | 16:32 | |
ugexe | because you declare dependencies as their `use` strings | 16:33 | |
and people will declare their versions with it | |||
lollercopter | So it can handle `v6.c+` but will choke on `v6c`? | 16:35 | |
m: use v6.a+ | 16:38 | ||
camelia | ( no output ) | ||
pmurias | having system package managers parse Perl 6 programs to extract 'use statements' doesn't seem very desirable | ||
ugexe | i dont know how they plan on handling v6.c+ | ||
they dont parse them out, they are declared in the meta data | |||
lollercopter | Well, and we're talking about version literals in source code :/ | 16:39 | |
Feels like an imagined problem a few levels down, whereas specialcasing `use v6` to not accept all version literals is a currently existent issue. | |||
16:40
japhb left
16:41
japhb joined
16:47
iH2O joined
16:48
AlexDaniel left
|
|||
iH2O | how can I list all files recursively in the current directory. 'dir' has no option for that. what else? | 16:48 | |
lollercopter | buggable: eco File::Find | ||
buggable | lollercopter, File::Find 'File::Find for Perl 6': github.com/tadzik/File-Find 3 other matching results: modules.perl6.org/#q=File%3A%3AFind | ||
lollercopter | iH2O: ^ | 16:49 | |
ugexe | m: my $files = -> $p = $*CWD { $p.f ?? $p !! dir($p)>>.&?BLOCK.Slip }; say $files() | 16:53 | |
camelia | Failed to get the directory contents of '/home/camelia/.local/share/systemd/user': Failed to open dir: 2 in block <unit> at <tmp> line 1 |
||
lollercopter | Why reinvent the wheel for a solved problem? Your example has a open file exhaustion bug | 16:54 | |
16:54
mr-fooba_ joined
16:56
itaylor57 joined,
mr-foobar left
|
|||
ugexe | its a solution that demonstrates the power of core perl6 in almost less characters than the link to the module. give a man fish, etc | 16:57 | |
lollercopter | It's not a solution if it has a bug; and a rare to encounter too. You code recurses before exhausing the dir's Seq, and each dir uses a file handle | 16:59 | |
17:00
Cabanossi left
|
|||
lollercopter | abraxxa: fix shipped: github.com/rakudo/rakudo/commit/fe7ea124cd | 17:00 | |
\o | |||
17:00
lollercopter left
|
|||
iH2O | My bash $PATH variable must be lacking something because 'use File::Find;' returns these error messages pastebin.com/kfiqPB4X | 17:00 | |
17:00
Cabanossi joined
|
|||
mscha | jnthn: re breaking promises, what I'm trying to accomplish is: | 17:01 | |
I have a loop that takes long time to finish (about an hour), and I want to show the progress periodically. | |||
My first attempt is something like: my $t = time; loop { ...; if $verbose && time - $t > 60 { say "progress ..."; $t = time; } } | |||
But this slows the loop down, obviously. So I thought: why not in a separate thread? | |||
Something like: start { sleep 60; say "progress ..."; }; loop { ... } | |||
This works, and is faster, but it keeps running even after the loop is done. So, I want to abort the promise. | |||
So I guess I have to do this from the inside, something like: my $done = False; start { while !$done { sleep 60; say "Progress..."; } }; loop { ... }; $done = True; | |||
17:02
setty1 left
|
|||
ugexe | ugexe.com/create-a-perl6-terminal-progress-bar/ | 17:03 | |
mscha | m: my $done = False; my $i = 0; start { while !$done { sleep 1; say "$i..."; } }; for 1..30 -> $j { $i = $j; sleep 0.1; }; $done = True; | 17:04 | |
camelia | 10... 20... 30... |
||
mscha | ugexe, looks nice! | 17:05 | |
iH2O | ok | ||
thx ugexe, i like your solution better | 17:07 | ||
17:07
Guest44526 left
17:18
iH2O left
17:22
cdg joined
|
|||
zengargoyle | .ask samcv in the recent `gitb` image, are the colorful >>> indicators of git repo status or just flair? | 17:28 | |
yoleaux | zengargoyle: I'll pass your message to samcv. | ||
samcv | oh that's just my prompt | ||
yoleaux | 17:28Z <zengargoyle> samcv: in the recent `gitb` image, are the colorful >>> indicators of git repo status or just flair? | ||
17:28
raiph left
|
|||
samcv | i have zsh in vi mode. they flip the opposite direction when entering command mode | 17:29 | |
so that's what they're for | |||
this doesn't show that feature but shows some other cool things i have set cry.nu/files/konsole.webm | 17:30 | ||
mscha | m: sub progress($every, &progress, &done) { start { sleep $every; until done() { progress(); sleep $every; } } }; my $done = False; for 1..30 -> $i { state $p = progress(1, { say $i; }, { $done }); sleep 0.1; }; $done = True; | ||
camelia | 1 1 1 |
||
mscha | Why doesn't that output something close to 10, 20, 30? | 17:31 | |
Isn't { say $i } a closure? | |||
samcv | though it's a little different now, also gives the retrn code of non 0 return processes as well | ||
mscha | m: sub progress($every, &progress, &done) { start { sleep $every; until done() { progress(); sleep $every; } } }; my $done = False; my $i2; for 1..30 -> $i { $i2 = $i; state $p = progress(1, { say $i2; }, { $done }); sleep 0.1; }; $done = True; | 17:32 | |
camelia | 11 20 30 |
||
samcv | also i figrued out how to do that fancy git branch, if you have the latest git, or maybe 1 or so versions ago can do it with only one pretty long git command and no extra processing shell code. which is neat | ||
this was my git branch code gist.github.com/samcv/0bf4dcffc3ac...1f1085c929 which i improved from how it was before, where branch names could be interpreted as regex by sed. | 17:34 | ||
ok just added the most recent iteration to the bottom of that gist. which is only one git command :) and same output | 17:35 | ||
though if you don't wan tthe colors and puting a * by the current branch you can always just do git branch --sort='committerdate' --format=' %(authordate:relative)%09%(refname:short)' | |||
i also made a version that works with git tag as well | |||
gonna add that to the gist | 17:36 | ||
jnthn | m: my $p = start { sleep 5 #`(simulate some hard work) }; start { until $p { await Promise.in(1); say 'working' } }; await $p; | 17:37 | |
camelia | working working working working |
||
jnthn | mscha: I might write it like that, though last time I wanted some progress thing I ended up writing github.com/jnthn/p6-concurrent-progress :) | ||
17:40
Ven joined,
Ven is now known as Guest99479
17:42
zacts left
17:43
setty1 joined
17:44
nhywyll joined
17:46
seatek left,
dotness left
|
|||
Geth | doc: 4650bdcd05 | (Jan-Olof Hendig)++ | doc/Type/Str.pod6 Fixed a few typos |
17:48 | |
mscha | jnthn: thanks, looks nice. I'm still looking for a solution that doesn't involve adding code within the loop, though; but having access to the loop variable i (which seems to be an issue). | 17:49 | |
samcv | my git tag i.imgur.com/24CnCuU.png | ||
setting added to gist as well | |||
17:54
BenGoldberg left,
mr-foobar joined
17:56
mr-fooba_ left,
setty1 left
|
|||
zengargoyle | samcv: cool, not sure my brain can handle zsh (much the same way it can't handle emacs, Mac or Windows). | 17:56 | |
samcv | lol | 17:57 | |
zengargoyle | images did make me wonder if there's an 'at' syntax module for time specifiaction yet. | ||
samcv | well you don't need zsh to get the cool and useful git functions i wrote :) | ||
an 'at' spec? | |||
zengargoyle | huggable: eco at | ||
huggable | zengargoyle, nothing found | ||
samcv | huggable: eco eco | ||
huggable | samcv, nothing found | ||
zengargoyle | there *is* an 'at' syntax somwhere... in some man page or something. a BNF-ish grammar of sorts. | 17:58 | |
samcv | no clue what this is about this 'at' syntax | ||
what is it | 17:59 | ||
zengargoyle | Date::Manip from p5 used to support it, but D::M was really heavy-weight and slowish. | ||
samcv | but what is it | 18:01 | |
i have no clue what it is | |||
zengargoyle | at 'now + 20 minutes' | ||
18:01
kyan left
|
|||
zengargoyle | echo 'reboot' | at 'now + 1h' | 18:01 | |
samcv | oh the at command | ||
18:01
abraxxa left
|
|||
samcv | sorry that was not clear | 18:01 | |
zengargoyle | one-shot scheduler... yah. | 18:02 | |
/usr/share/doc/at/timespec | |||
samcv | anyway i gotta go for a bit. ttyl | ||
18:02
raschipi joined
|
|||
zengargoyle | old co-workers really liked the feature of specifying times like: --from '2 days ago' --until now | 18:03 | |
vs using actual YYYYMMDDHHMMSS type spec. | 18:04 | ||
ugexe | m: my $files = -> *@_ { my @d = @_.grep(*.d); grep *.defined, (&?BLOCK(@d.map(*.&dir)) if @d).Slip, @_.grep(*.f).Slip; }; say $files($*CWD); # Voldenet | ||
that should avoid leaving handles open | |||
camelia | ("/home/camelia/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/x86_64-linux/Moose/Meta/Method/Accessor/Native/Array/Writer.pm".IO "/home/camelia/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/x86_64-linux/Moose/Meta/Method/Accessor/Native/A… | ||
andrzejku | hi people | 18:05 | |
:) | |||
18:05
Guest99479 left
|
|||
ugexe | kinda sucks the @_.grep(*.d) is needed... `&?BLOCK($_.map(*.&dir)) with @d.grep(*.d)` seems to get stuck calling the `with` block | 18:05 | |
18:07
raschipi left
|
|||
zengargoyle | if anybody knows of some module that already does something like the `at` spec for time, lemme know. otherwise, i think it would be a cool Grammar to play around with. | 18:07 | |
ugexe | httpbin has a time api that does it, so i imagine there might be such a spec | 18:08 | |
now.httpbin.org/when/2%20days%20ago | |||
zengargoyle looks, oh, a website.... | 18:09 | ||
ugexe | now.httpbin.org/when/100%20years%2...e%20future # the error shows its using python's maya | 18:11 | |
zengargoyle | i abuse `at` a lot for a one-shot batch like thing. `at now < some.script.sh` does nice almost daemonization and auto-emails results. | ||
geekosaur | system V-style 'at' includes a 'batch' command :) | 18:12 | |
18:13
Cabanossi left,
Ven_ joined
18:14
kyan joined
|
|||
zengargoyle | i often do `echo 'notify-send 'time for favorite TV show' | at 19:29` type of things. :P | 18:14 | |
18:15
Cabanossi joined
|
|||
zengargoyle | and have a `tt` (tea-timer) function that either does forked `sleep` or `at` just to remind me of things. it notify-sends and espeak to grab my attention. | 18:17 | |
18:17
Ven_ left,
zacts joined
|
|||
Geth | doc: 7668614d0e | (Jan-Olof Hendig)++ | doc/Type/Str.pod6 Added a few formatting fixes |
18:18 | |
zengargoyle | huggable: eco yacc | 18:19 | |
huggable | zengargoyle, nothing found | ||
zengargoyle | huggable: eco lex | 18:20 | |
huggable | zengargoyle, nothing found | ||
zengargoyle | huggable: eco bison | ||
huggable | zengargoyle, nothing found | ||
zengargoyle | huggable: eco bnf | ||
huggable | zengargoyle, nothing found | ||
18:26
keylet joined
|
|||
keylet | m: grammar A { rule TOP { <foobar> }; token foobar { <foo> <bar>}; token foo { . +? }; token bar { "\\\\" .* }; }; say A.parse("test \\\\ lorem ipsum"); | 18:30 | |
camelia | Nil | ||
keylet | I want to parse "test " as <foo> and "\\\\ lorem ipsum" as <bar> | ||
how to solve this problem? | 18:31 | ||
MasterDuke | keylet: token foo { 'test' }; token bar { '\\\\ lorem ipsum' } | 18:32 | |
keylet: but for non-snarky answer, what restrictions are there? | 18:33 | ||
keylet | it was an example | ||
so, I want to parse all symbols before " | |||
so, I want to parse all symbols before "\\\\" as <foo> | |||
I could use <?before "\\\\"> | 18:34 | ||
but what if there will be no "\\\\" | |||
? | |||
then I'd like to match the whole string as <foo> | |||
is it possible? | |||
m: grammar A { rule TOP { <foobar> }; token foobar { <foo> <bar>}; token foo { . + <?before "\\\\"> }; token bar { "\\\\" .* }; }; say A.parse("test \\\\ lorem ipsum"); | 18:35 | ||
camelia | Nil | ||
MasterDuke | token foo { <-[/]>+ } | ||
token foo { <-\]>+ } # correct clash | 18:36 | ||
*slash | |||
keylet | but if <foo> will contain some "\\", but will not contain "\\\\" | ||
? | |||
so, "lorem \\ipsum \\dolor \\\\ sit amet" | |||
"lorem \\ipsum \\dolor " should be in <foo> | |||
and "\\\\ sit amet" in <bar> | |||
m: grammar A { rule TOP { <foobar> }; token foobar { <foo> <bar>}; token foo { . + <?before "\\\\"> }; token bar { "\\\\" .* }; }; say A.subparse("test \\\\ lorem ipsum"); | 18:37 | ||
camelia | #<failed match> | ||
keylet | m: grammar A { rule TOP { <foobar> }; token foobar { <foo> <bar>}; token foo { ..... <?before "\\\\"> }; token bar { "\\\\" .* }; }; say A.subparse("test \\\\ lorem ipsum"); | 18:38 | |
camelia | 「test \\ lorem ipsum」 foobar => 「test \\ lorem ipsum」 foo => 「test 」 bar => 「\\ lorem ipsum」 |
||
keylet | hmmm.. why it does not want to execute .+ <?before PATTERN> | ||
18:38
travis-ci joined
|
|||
keylet | ? | 18:38 | |
travis-ci | Doc build errored. Jan-Olof Hendig 'Fixed a few typos' | ||
travis-ci.org/perl6/doc/builds/246599053 github.com/perl6/doc/compare/286e1...50bdcd0559 | |||
18:38
travis-ci left
|
|||
keylet | m: grammar A { rule TOP { <foobar> }; token foobar { <foo> <bar>}; token foo { . <?before "\\\\"> + }; token bar { "\\\\" .* }; }; say A.subparse("test \\\\ lorem ipsum"); | 18:38 | |
camelia | #<failed match> | ||
keylet | m: grammar A { rule TOP { <foobar> }; token foobar { <foo> <bar>}; token foo { [ . + ] <?before "\\\\"> }; token bar { "\\\\" .* }; }; say A.subparse("test \\\\ lorem ipsum"); | 18:39 | |
camelia | #<failed match> | ||
18:40
culb left
|
|||
zengargoyle | m: my grammar A { rule TOP {<foobar>}; token foobar {<foo>}; token foo {.*}; };say A.parse("test"); | 18:45 | |
camelia | 「test」 foobar => 「test」 foo => 「test」 |
||
zengargoyle | m: my grammar A { rule TOP {<foobar>}; token foobar {<foo>}; token foo {.*?}; };say A.parse("test"); | ||
camelia | Nil | ||
18:46
troys joined
|
|||
MasterDuke | m: grammar A { rule TOP { <foobar> }; token foobar { <foo> <bar>}; rule foo { [ . + ] <?before "\\\\"> }; token bar { "\\\\" .* }; }; say A.subparse("test \\\\ lorem ipsum"); | 18:47 | |
camelia | #<failed match> | ||
zengargoyle | tokens don't backtrack and the limit of .*? is nothing, so nothing matches first. (i think) | ||
MasterDuke | m: grammar A { rule TOP { <foobar> }; token foobar { <foo> <bar>}; rule foo { .+ <?before "\\\\"> }; token bar { "\\\\" .* }; }; say A.subparse("test \\\\ lorem ipsum"); | ||
camelia | 「test \\ lorem ipsum」 foobar => 「test \\ lorem ipsum」 foo => 「test 」 bar => 「\\ lorem ipsum」 |
||
18:48
japhb left
|
|||
zengargoyle | m: my grammar A { rule TOP { <foobar> }; regex foobar {<foo><bar>}; regex foo { .+? }; token bar { '\\\\' .* }; };say A.parse("test \\\\ lorem ipsum"); | 18:49 | |
camelia | 「test \\ lorem ipsum」 foobar => 「test \\ lorem ipsum」 foo => 「test 」 bar => 「\\ lorem ipsum」 |
||
18:50
japhb joined
|
|||
zengargoyle | m: my grammar A { rule TOP { <foobar> }; regex foobar {<foo><bar>}; regex foo { .+? }; token bar { '\' ** 4 .* }; };say A.parse("test \\\\ lorem ipsum"); | 18:51 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Unable to parse expression in single quotes; couldn't find final "'" at <tmp>:1 ------> 3 };say A.parse("test \\\\ lorem ipsum");7⏏5<EOL> expecting any of: single quotes |
||
zengargoyle | m: my grammar A { rule TOP { <foobar> }; regex foobar {<foo><bar>}; regex foo { .+? }; regex bar { "\\" ** 4 .* }; };say A.parse("test \\\\ lorem ipsum"); | 18:57 | |
camelia | Nil | ||
zengargoyle grrrr | |||
18:58
kyan left
19:00
keylet left
|
|||
zengargoyle | m: my $b = Q{\\\\}; say $b;say "test \\\\ lorem ipsum" ~~ rx/ (.*?) (<$b> .*)/; | 19:01 | |
camelia | \\\\ 「test \\ lorem ipsum」 0 => 「test 」 1 => 「\\ lorem ipsum」 |
||
zengargoyle | m: my $b = Q{\\\\}; say $b;say Q{test \\\\ lorem ipsum} ~~ rx/ (.*?) (<$b> .*)/; | 19:02 | |
camelia | \\\\ 「test \\\\ lorem ipsum」 0 => 「test 」 1 => 「\\\\ lorem ipsum」 |
||
19:02
iH2O joined
|
|||
zengargoyle | *aha* quoting hell. | 19:02 | |
.ask keylet do you mean \\\\ as in 4 literal \ or "\\\\" as two literal \? | 19:04 | ||
yoleaux | zengargoyle: I'll pass your message to keylet. | ||
zengargoyle may have been chasing after the wrong thing all along. :/ | 19:05 | ||
iH2O | how can I append the listings of dir('mydir1'), dir('mydir2') into an array @a like this: | 19:06 | |
m: my @a =dir('mydir1'),dir('mydir2') | |||
camelia | ( no output ) | ||
iH2O | that doesnt work | 19:07 | |
zengargoyle | m: |dir('.'),|dir('..') | 19:08 | |
camelia | ( no output ) | ||
zengargoyle | m: say |dir('.'),|dir('..') | ||
camelia | ".cpanm".IO".local".IO".npm".IO".perl6".IO".perlbrew".IO".rcc".IO".ssh".IO"Perlito".IO"evalbot".IO"log".IO"nqp-js".IO"p1".IO"p2".IO"perl5".IO"std".IO".bash_history".IO".bashrc".IO"mbox".IO".lesshst".IO"evalbot.log".IO".cpan".IO"dalek-queue".IO"rakudo-m-1… | ||
iH2O | thx | ||
19:08
travis-ci joined
|
|||
travis-ci | Doc build errored. Jan-Olof Hendig 'Added a few formatting fixes' | 19:09 | |
travis-ci.org/perl6/doc/builds/246605639 github.com/perl6/doc/compare/4650b...68614d0ed7 | |||
19:09
travis-ci left
|
|||
zengargoyle | m: dir('.').Slip,dir('..').Slip | 19:10 | |
camelia | ( no output ) | ||
zengargoyle | m: say dir('.').Slip,dir('..').Slip | ||
camelia | ".cpanm".IO".local".IO".npm".IO".perl6".IO".perlbrew".IO".rcc".IO".ssh".IO"Perlito".IO"evalbot".IO"log".IO"nqp-js".IO"p1".IO"p2".IO"perl5".IO"std".IO".bash_history".IO".bashrc".IO"mbox".IO".lesshst".IO"evalbot.log".IO".cpan".IO"dalek-queue".IO"rakudo-m-1… | ||
iH2O | yes, thats better | 19:11 | |
19:11
brrt joined,
TEttinger joined
|
|||
zengargoyle | iH2O: you heed to sorta un-array the arrays to get something other than just 2 arrays.... yeah. | 19:11 | |
m: say (dir('.'),dir('..')).flat | 19:12 | ||
camelia | (".cpanm".IO ".local".IO ".npm".IO ".perl6".IO ".perlbrew".IO ".rcc".IO ".ssh".IO "Perlito".IO "evalbot".IO "log".IO "nqp-js".IO "p1".IO "p2".IO "perl5".IO "std".IO ".bash_history".IO ".bashrc".IO "mbox".IO ".lesshst".IO "evalbot.log".IO ".cpan".IO "dale… | ||
19:12
andrzejku left
|
|||
zengargoyle not sure which way is 'best'. | 19:13 | ||
iH2O | i say the first is better | ||
because it doesnt create a more complicated temporary structure | |||
zengargoyle | m: my @a = dir('.'); @a.append: dir('..'); say @a; | 19:14 | |
camelia | [".cpanm".IO ".local".IO ".npm".IO ".perl6".IO ".perlbrew".IO ".rcc".IO ".ssh".IO "Perlito".IO "evalbot".IO "log".IO "nqp-js".IO "p1".IO "p2".IO "perl5".IO "std".IO ".bash_history".IO ".bashrc".IO "mbox".IO ".lesshst".IO "evalbot.log".IO ".cpan".IO "dale… | ||
19:15
domidumont left
|
|||
zengargoyle | i think the .append vs .push has something to do with flat-ing the argument... | 19:15 | |
... if you're like adding more directories to an array not-in-one-go... | 19:16 | ||
19:17
troys is now known as troys_
19:18
lichtkind left
19:22
BenGoldberg joined
19:29
andrzejku joined
19:31
lichtkind joined
19:39
darutoko left
19:40
brrt left
19:41
iH2O left
19:42
zacts left
19:50
seatek joined,
seatek left
19:51
zacts joined
19:54
cdg left
|
|||
Geth | doc: 3b409ccf9f | (Jan-Olof Hendig)++ | doc/Type/List.pod6 Fixed formatting and some typos |
20:01 | |
20:04
AlexDaniel joined
20:06
obfusk_ left
20:15
espadrine joined
20:23
AlexDaniel left,
AlexDaniel joined
|
|||
zengargoyle | if *anybody* has a good name for a module that does the `at` timespec ... suggestions are welcome... i'm horrible at nameing things. | 20:32 | |
TEttinger | hoy | 20:33 | |
ahora | |||
zengargoyle | One of the miseries of life is that everybody names things a little bit wrong. —- Richard P. Feynman | ||
timotimo | just today i held my "surely you're joking mister feynman" book in my hands | 20:34 | |
TEttinger | I do like that Spanish has two words for what English just has "now" for. IIRC, hoy is like today, and ahora is "at the present moment" | ||
zeitgeist is also a good term in general | 20:35 | ||
geekosaur | 'today' vs. (literally) 'at (this) hour', yes | ||
(or 'to the hour' if you want to be really literal) | |||
TEttinger | at and to are both "a" though? | ||
and it would be a la hora or alhora for to the hour | 20:36 | ||
geekosaur | compare 'today' = 'to (the) day' | ||
zengargoyle went to 'summer camp' for physics at Caltech and had the Feynman lecture books. | |||
TEttinger | mmm. | ||
today may have a weird etymology though, since this is English | 20:37 | ||
20:37
cyphase left
|
|||
BenGoldberg | Time::Spec::At, perhaps? | 20:37 | |
zengargoyle | (along with the Tufte books. | ||
geekosaur | older English documents often have it as to-day | ||
zengargoyle | `at` can also do 'yyyy-mm-dd hh:mm:ss' stuff, so the today is a bit iffy. | 20:38 | |
and the 'now' is now yyyymmddhhmmss and not really 'today' | 20:39 | ||
pmurias | samcv: what's the difference between the UCD and unicode grant repos? | 20:42 | |
zengargoyle | `at` has a 'today' token. so probably covered. i haven't looked that deeply into the .l and .y files of the acutal parser yet. | 20:43 | |
20:43
cyphase joined
|
|||
zengargoyle | and a 'tomorrow' token. not sure if those resolve to the 'midnight' token or not.... | 20:45 | |
and there's 'noon' and 'teatime' | |||
BenGoldberg++ Time::Spec::At is pretty decent. | 20:46 | ||
BenGoldberg | Another possibility is Time::Unix::At. | ||
Just in case there's some windows program named At which uses a different spec ;) | 20:47 | ||
BenGoldberg wonders when is teatime. | |||
zengargoyle | echo 'teatime' | at teatime; atq; --> 5 Sat Jun 24 16:00:00 2017 a zen | 20:49 | |
4 o'clock. :P | |||
BenGoldberg | Well, certainly too early for dinner, but a good time for a snack and caffiene :) | ||
zengargoyle | i'll have to search the modules page, i really thought there was some module that did the yacc -> grammar sort of thing... | 20:51 | |
20:52
travis-ci joined
|
|||
travis-ci | Doc build errored. Jan-Olof Hendig 'Fixed formatting and some typos' | 20:52 | |
travis-ci.org/perl6/doc/builds/246626653 github.com/perl6/doc/compare/76686...409ccf9fb9 | |||
20:52
travis-ci left,
rindolf left
|
|||
zengargoyle thinks but anyway a .l and .y transform into grammar and actions sould be a good bit of experimentation nonetheless. | 20:54 | ||
20:57
andrzejku left
|
|||
zengargoyle | are we (p6) keeping the CamelCase naming for modules? a part of me crinces at calling `at` 'At'. | 20:58 | |
*cringes | 20:59 | ||
the next question is of course ... to allow \d (unicode Nu and Nd) or just <[0..9]> for digits. :P | 21:02 | ||
TEttinger | telugu! | ||
zengargoyle | at ²pm | 21:03 | |
ugexe | App::at | ||
zengargoyle | App:: ? | 21:04 | |
21:05
nhywyll left
|
|||
zengargoyle | more of a 'at timespec of sorts' --> DataTime | 21:05 | |
rather than a job scheduler | 21:06 | ||
ugexe | AtTime fits with `at`... eg. lib/AtTime.pm6 and bin/at.pl6 | 21:07 | |
zengargoyle | hehe, App::at -- echo 'teatime' | p6-at '²²pm' | 21:08 | |
Geth | Swapped META.info → META6.json in 3 dists in github.com/perl6/ecosystem/commit/39967a6a0c | 21:10 | |
zengargoyle | aside from direct `at` usage, i always used Date::Manip from p5 to just allow 'at spec of date/time' as a valid input to CLI programs that wanted a timestamp sort of input. | 21:11 | |
e.g. `blocks --between '2 days ago' --and 'now' | 21:12 | ||
i guess App::At would just depend on Time::Spec::At or whatnot. | 21:14 | ||
which means we probably need a good `cron` spec for events. | 21:15 | ||
huggable: eco cron | |||
huggable | zengargoyle, nothing found | ||
zengargoyle | huggable: eco event | 21:16 | |
huggable | zengargoyle, nothing found | ||
ugexe | is there an easy way to match /$SOME-QUOTE-CHARACTER <string-that-can-contain-escaped-quote-character> $SOME-QUOTE-CHARACTER/ ? | 21:17 | |
21:19
zapwai joined
|
|||
moritz | ugexe: '"' ~ '"' [ <-["]>* % '\%' ] | 21:21 | |
erm | |||
ugexe: '"' ~ '"' [ [<-["]>+]* % '\"' ] | |||
something alog those lines | |||
'"' ~ '"' [ [<-["\\]>+]* % ['\\' . ] ] # probably more robust | 21:22 | ||
21:22
mscha left
|
|||
ugexe | should I be able to do $something like `<q>=["'`] ~ $<q>` to handle multiple types of quotes? | 21:22 | |
moritz | I don't know if ~ works with captures | 21:24 | |
but in principle, yes | |||
ugexe | cool thanks! | ||
moritz | and then you have to replace the negative character class with [ <!before $<q>|\\> . ] | ||
zengargoyle | m: my $SQC = '²'; say '²foo²bar²' ~~ m/^<$SQC>(.*?)<$SQC>$/; | 21:25 | |
camelia | 5===SORRY!5=== Error while compiling /home/camelia/EVAL_0 Unrecognized regex metacharacter ² (must be quoted to match literally) at /home/camelia/EVAL_0:1 ------> 3anon regex {7⏏5 ²} |
||
zengargoyle | m: my $SQC = '\²'; say '²foo²bar²' ~~ m/^<$SQC>(.*?)<$SQC>$/; | 21:27 | |
camelia | 「²foo²bar²」 0 => 「foo²bar」 |
||
zengargoyle | hrmmm... quotemeta how? | ||
moritz | use $SQC instead of <$SQC> when you want to match it literally | 21:28 | |
zengargoyle | ah | 21:29 | |
21:29
wamba joined
|
|||
zengargoyle | m: my $SQC = '²'; say '²foo²bar²' ~~ m/^{$SQC}(.*?){$SQC}$/; | 21:31 | |
camelia | 「²foo²bar²」 0 => 「²foo²bar²」 |
||
zengargoyle | m: my $SQC = '²'; say '²foo²bar²' ~~ m/^$SQC(.*?)$SQC$/ | 21:32 | |
camelia | 「²foo²bar²」 0 => 「foo²bar」 |
||
zengargoyle | m: my $SQC = '²'; say '²foo²bar²' ~~ m/^${SQC}(.*?)${SQC}$/; | 21:33 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Unsupported use of ${SQC}; in Perl 6 please use $SQC at <tmp>:1 ------> 3$SQC = '²'; say '²foo²bar²' ~~ m/^${SQC}7⏏5(.*?)${SQC}$/; |
||
zengargoyle | m: my $SQC = '²'; say '²foo²bar²' ~~ m/^$SQC (.*?) $SQC$/; | 21:34 | |
camelia | 「²foo²bar²」 0 => 「foo²bar」 |
||
zengargoyle guesses that's where the spaces come in... | |||
p5 brain still fighting me. :) | 21:36 | ||
21:42
Cabanossi left
21:43
S007 joined
21:45
Cabanossi joined
21:49
espadrine left
21:52
zakharyas joined
|
|||
timotimo | m: sub MAIN('bob') { }; say &MAIN.signature.params[0].constraints[0].perl | 21:55 | |
camelia | all("bob") Usage: <tmp> bob |
||
timotimo | why do we put a junction there? | ||
Geth | doc: 0ba54816cb | (Jan-Olof Hendig)++ | doc/Type/List.pod6 Fixed link |
22:16 | |
22:20
kyan joined
22:25
zapwai left,
danlei joined
22:26
zakharyas left
|
|||
zengargoyle | timotimo: heh, that's really funny to try in the REPL. it runs MAIN() and gives an error message. :) | 22:28 | |
timotimo | yup | ||
wait, immediately? | |||
that *is* funny | |||
22:29
zapwai joined
|
|||
zengargoyle | not only that, but puts all('bob') in the command buffer.... | 22:31 | |
m: multi sub MAIN('bob') { }; multi sub MAIN('joe') { }; say &MAIN.signature.params[0].constraints[0].perl | 22:32 | ||
camelia | all() Usage: <tmp> bob <tmp> joe |
||
timotimo | the "command buffer"? | ||
zengargoyle | it's left after my prompt: zen@zim:~/p6/p6-Time-Spec-at$ all() | 22:33 | |
timotimo | strange! | ||
zengargoyle | and hitting <RETURN> leaves me in what i'm assuming is a define function in bash situation. | ||
maybe not... adding a { echo } leaves me at '>' prompt. :) | 22:34 | ||
might be cut-n-paste weirdness in my xterm.... | 22:36 | ||
timotimo | oh no! Util was bragging about the "execute stuff out of order in hyper stuff" feature, but it has been axed for performance reasons at some point :S | ||
(in the yapc::na talk he gave) | 22:37 | ||
zengargoyle | m: multi sub MAIN('bob') { }; multi sub MAIN('joe') { }; say &MAIN.signature.params[0].constraints[0].perl | 22:39 | |
camelia | all() Usage: <tmp> bob <tmp> joe |
||
zengargoyle | . | 22:40 | |
.u  | 22:41 | ||
yoleaux | U+2424 SYMBOL FOR NEWLINE [So] () | ||
22:42
pmurias left
22:43
Cabanossi left
|
|||
zengargoyle | last m: gives Usage: interactive bob interactive joe interactive bob interactive joe | 22:43 | |
so doubles the output and exits the REPL. :P | |||
zengargoyle guesses REPL is no place to play with &MAIN | 22:45 | ||
22:45
Cabanossi joined
22:52
araraloren left
|
|||
ugexe | `$<q>=[\'] ~ $<q> [ [[ <!before $<q>|\\> . ]+]* % ['\\' . ] ]` works, but not if I add a second character to $<q>=[...]. I tried using a proto token for ' and " ala `$<sym> ~ $<sym> [ [[ <!before $<sym>|\\> . ]+]* % ['\\' . ] ]` but that doesn't work for some reason :( | 22:52 | |
22:52
araraloren joined
|
|||
zengargoyle | m: multi sub MAIN('bob') { }; multi sub MAIN('joe') { }; say &MAIN.signature.params> | 22:54 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing required term after infix at <tmp>:1 ------> 3('joe') { }; say &MAIN.signature.params>7⏏5<EOL> expecting any of: prefix term |
||
zengargoyle | m: multi sub MAIN('bob') { }; multi sub MAIN('joe') { }; say &MAIN.signature.params>>.constraints>>.perl | ||
camelia | (all()) Usage: <tmp> bob <tmp> joe |
||
23:04
zapwai left,
Ben_Goldberg joined
23:05
BenGoldberg left,
Ben_Goldberg is now known as BenGoldberg
23:06
travis-ci joined
|
|||
travis-ci | Doc build errored. Jan-Olof Hendig 'Fixed link' | 23:06 | |
travis-ci.org/perl6/doc/builds/246653724 github.com/perl6/doc/compare/3b409...a54816cb10 | |||
23:06
travis-ci left
23:15
wamba left
|
|||
Geth | doc: f441ed3db7 | (Jan-Olof Hendig)++ | doc/Language/nativecall.pod6 Added some missing types Closes #918 |
23:24 | |
23:28
Cabanossi left
23:30
Cabanossi joined
23:53
TimToady left
23:54
zapwai joined,
cog_ left
23:55
TimToady joined
23:56
bwisti left
23:59
bwisti joined
|