»ö« 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:02
sufrostico joined
00:08
poohman left,
poohman joined
00:12
sufrostico left
00:13
sufrostico joined,
Guest75687 is now known as ponbiki
00:17
pierre_ joined
00:18
mcsnolte left
00:21
flexibeast joined
00:23
RabidGravy left
00:27
mcmillhj joined
00:31
newbie1 left
00:37
Zoffix joined,
jstimpfle left
|
|||
Zoffix | What's the difference between +@ and *@ slurpries? | 00:37 | |
m: sub a(+@a){ dd @a }; sub b(*@a){ dd @a }; a 1, 2, 3; b 1, 2, 3; a 1; b 1; my @a = ^2; a @a; b @a; | |||
camelia | rakudo-moar 8be36b: OUTPUT«[1, 2, 3][1, 2, 3][1][1][0, 1][0, 1]» | ||
00:38
jstimpfle joined
|
|||
Zoffix | No idea what this sentence is supposed to mean: "The single argument rule allows to treat arguments to subroutines, for-loops and list constructors based on context." docs.perl6.org/type/Signature#Sing...ule_Slurpy | 00:38 | |
00:39
mr-foobar left
00:40
mr-foobar joined
|
|||
Zoffix | m: sub a(+@a){ dd @a }; sub b(*@a){ dd @a }; a [1, 2], 3; b [1, 2], 3; | 00:41 | |
camelia | rakudo-moar 8be36b: OUTPUT«[[1, 2], 3][1, 2, 3]» | ||
00:41
mr-foobar left
|
|||
skids | Gah the error disappears under valgrind. :-( | 00:44 | |
00:44
Zoffix left
|
|||
skids | m: sub a(+@a){ dd @a }; sub b(*@a){ dd @a }; a((1,2),3); b((1,2),3); # Zoffix | 00:52 | |
camelia | rakudo-moar 8be36b: OUTPUT«[(1, 2), 3][1, 2, 3]» | ||
skids | see also docs.perl6.org/language/functions#...onventions | 00:53 | |
TimToady | + says a semantic list is expected without caring whether that list is made by syntactic commas, while * and ** mean a syntactic comma list is expected; ** hides commas inside parens so you can make a list of lists, while * makes a flat list by hoisting parenthesized lists (and interpolated lists) up to the top level | ||
skids | m: sub a(+@a){ dd @a }; sub b(*@a){ dd @a }; sub c(**@a){ dd @a }; a(($_ for 1,2,3)); b((1,2),3); c((1,2),3); a(($_ for 1,2,3)); b(($_ for 1,2,3)); c(($_ for 1,2,3)); | 00:57 | |
camelia | rakudo-moar 8be36b: OUTPUT«[1, 2, 3][1, 2, 3][(1, 2), 3][1, 2, 3][1, 2, 3][(1, 2, 3),]» | ||
00:57
sQuEE` is now known as sQuEE
01:04
mcmillhj left
01:11
stigo left,
stigo joined
01:12
dataangel joined
01:13
nadim left
01:15
mr-foobar joined
01:21
mr-foobar left,
mcmillhj joined
01:24
poohman_ joined,
doc_ joined
01:26
poohman left
01:27
doc_ left
01:29
finanalyst joined
01:32
_slade_ left,
_slade_ joined
01:34
sufrostico left
01:37
yoleaux joined,
itaipu joined,
ChanServ sets mode: +v yoleaux
01:39
mr-foobar joined
01:45
ilbot3 left,
MasteDuke joined
01:47
ilbot3 joined
01:49
_sfiguser left
01:51
pierre_ left
02:01
pierre_ joined
02:03
eliasr left
|
|||
MasteDuke | m: say "⒗".uniprop; say "١".uniprop | 02:04 | |
camelia | rakudo-moar 8be36b: OUTPUT«NoNd» | ||
02:04
_sfiguser joined
02:06
pierre_ left
|
|||
MasteDuke | m: say "⒗".unival | 02:08 | |
camelia | rakudo-moar 8be36b: OUTPUT«16» | ||
02:09
dayangkun joined
02:13
cdg joined
|
|||
MasteDuke | .tell harmil_wk ⒗ won't work by design for a bunch of stuff. see github.com/rakudo/rakudo/commit/e2...6d25995a90 for some discussion. it has a .uniprop of 'No' instead of 'Nd' | 02:14 | |
yoleaux | MasteDuke: I'll pass your message to harmil_wk. | ||
02:17
noganex joined
02:18
itaipu left
02:19
pierre_ joined,
noganex_ left
02:20
dayangkun left
02:23
pierre_ left
02:24
itaipu joined
02:27
dayangkun joined
02:32
finanalyst left
02:36
ka joined
02:47
mcmillhj left
02:48
sprocket joined
|
|||
sprocket | hello #perl6! | 02:48 | |
i just updated to the latest version of rakudo on my raspberry pi, and wanted to say thank to whomever is responsible for the markedly faster startup times :) | 02:49 | ||
skids | o/ They aren't awake probably but I'm sure they'll backlog. | 02:50 | |
03:00
MasteDuke left
|
|||
AlexDaniel | sprocket: huh, did you compile it yourself right on raspberry pi? :) | 03:02 | |
03:02
poohman_ left
|
|||
sprocket | using rakudobrew, yes | 03:02 | |
AlexDaniel | sprocket: how long did it take? | 03:03 | |
sprocket | the last version i’d had was 2016.04 i believe, and it was about a 20 second startup when loading a perl6 program | ||
i think compilation of rakudo took about a hour? i dunno, i was doing other things :) | |||
but 2016.09 perl6 binary starts up in a couple seconds | 03:04 | ||
AlexDaniel | interesting. I've always pulled it from debian unstable because I am impatient | ||
sprocket | makes testing a lot nicer | ||
AlexDaniel | at this moment it is slightly outdated :( 2016.07.1 | ||
03:11
poohman joined
03:14
wamba joined
03:16
itaipu left
|
|||
skids | m: class A { my $e = 42 }; import A; say A::("\$e") # I wonder what that message is trying to say | 03:23 | |
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Combination of indirect name lookup and call not supportedat <tmp>:1------> 3onder what that message is trying to say7⏏5<EOL> expecting any of: argument list» | ||
03:23
pierre_ joined
|
|||
skids | Also trying to figure out how to acess symbols from another module without importing into own namespace. | 03:24 | |
m: | |||
m: class A { $e = 42 }; import A; $A::e.perl.say | 03:25 | ||
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '$e' is not declaredat <tmp>:1------> 3class A { 7⏏5$e = 42 }; import A; $A::e.perl.say» | ||
skids | m: class A { my $e = 42 }; import A; $A::e.perl.say | ||
camelia | rakudo-moar 8be36b: OUTPUT«Any» | ||
skids | This is confusing. | ||
(not the first one, that the symbol exists but is Any in the second one.) | 03:26 | ||
03:28
MasterDuke joined,
pierre_ left
03:29
pierre_ joined
03:31
cdg left
|
|||
geekosaur | I think I could argue that the bug there is that it is visible at all; a "my" should not be accessible, at least without using namespace magic | 03:39 | |
m: class A { our $e = 42 }; $A::e.perl.say | 03:40 | ||
camelia | rakudo-moar 8be36b: OUTPUT«42» | ||
skids | "our" only works in the same compunit. | 03:41 | |
Hrm. Grr. No it seems to work, in a simple test module. I guess it must be something to do with the fact that my modules share a base namespace. | 03:43 | ||
TimToady | m: class A { my $e = 42 }; import A; $a::nonesuch.perl.say | 03:45 | |
camelia | rakudo-moar 8be36b: OUTPUT«Any» | ||
TimToady | that's what's really going on | ||
m: class A { my $e = 42 }; import A; $A::nonesuch.perl.say | |||
camelia | rakudo-moar 8be36b: OUTPUT«Any» | ||
TimToady | $A::nonesuch is assumed to be a package variable that might or might not exist yet | ||
geekosaur | heh. that first one is actually even more informative | 03:46 | |
TimToady | otherwise escape analysis would be completely impossible | ||
skids | Ahah maye figured it out. | 03:49 | |
One of the modules isn't defining a name that matches its compunit's path. | 03:51 | ||
yeah that did it. I wonder if that counts as a bug in the file-based repo code. | 03:57 | ||
Oh nm. I'm obviously just up too late. | 04:02 | ||
04:02
labster left
04:11
MasterDuke left
04:15
skids left
04:17
AlexDaniel left
04:23
khw left
04:25
wamba left
04:41
pierre_ left
04:43
BenGoldberg left
04:48
pierre_ joined
04:50
dayangkun left
04:51
Cabanossi left
04:53
pierre_ left
04:55
Cabanossi joined
04:57
poohman left
05:10
sprocket left
05:13
cpage_ left
05:20
rgrinberg left
05:32
bioduds left
05:34
dayangkun joined,
labster joined
05:38
ufobat joined
05:44
poohman joined
05:52
poohman left
05:59
domidumont joined
06:00
_sfiguser left,
domidumont left
06:01
Actualeyes left,
Actualeyes joined
06:02
domidumont joined
06:08
Actualeyes left
06:10
labster left
06:12
cpage_ joined,
_sfiguser joined
06:16
rindolf joined
06:19
pierre_ joined
06:20
Actualeyes joined
06:25
firstdayonthejob joined
06:29
poohman joined
06:36
firstdayonthejob left
06:41
mr-foobar left
06:42
mr-foobar joined
06:45
brrt left
06:47
domidumont left
06:48
pierre_ left
06:53
domidumont joined
06:54
pierre_ joined
06:58
pierre_ left,
pierre_ joined
07:11
dogbert17 left
07:12
bjz left
07:16
wamba joined
07:19
rindolf left
07:20
brrt joined,
darutoko joined,
nadim joined
07:23
TeamBlast left
|
|||
nine | DrForr: rt.perl.org/Public/Bug/Display.htm...xn-1410204 | 07:23 | |
07:26
brrt left
07:28
brrt joined,
CIAvash joined
07:29
zakharyas joined,
mohae left
07:30
TeamBlast joined,
sivoais left,
mohae joined
07:32
sivoais joined
07:34
cibs left
07:36
mohae left
07:37
darutoko left,
sivoais left,
darutoko joined
07:39
TeamBlast left,
Actualeyes left
07:40
cibs joined,
sivoais joined
07:43
TeamBlast joined,
ka left
07:51
TeamBlast left
07:52
dakkar joined,
sivoais left
07:53
sivoais joined,
Ven` joined,
Actualeyes joined,
TeamBlast joined
08:00
TeamBlast left
08:02
ocbtec joined
08:03
TeamBlast joined
08:13
sivoais left
08:14
zakharyas left,
sivoais joined
08:15
labster joined
08:16
ka joined
08:23
canopus left
08:24
dayangkun left
08:28
RabidGravy joined
08:29
canopus joined
08:36
darutoko- joined
08:37
dayangkun joined
08:39
darutoko left
|
|||
El_Che | build 2016.09 packages as we speak | 08:41 | |
building 2016.09 packages as we speak | |||
08:42
matt_ joined
|
|||
raydiak | in a grammar, is there a better way to entirely ignore things like comments without having a separate preprocessing grammar or putting <comment> between every atom of every rule? | 08:43 | |
08:43
matt_ is now known as Guest29463
|
|||
timotimo | you can make it part of your own "ws" rule | 08:44 | |
and then use sigspace in the appropriate places | |||
raydiak | thought about that...guess I could...but then I can't use sigspace as intended elsewhere in the grammar, because I even want it to ignore them in the middle of sequences which don't allow whitespace | 08:46 | |
timotimo | ah | ||
arnsholt | Depending on how the grammar is factored, you might hack around it with dynvars | 08:47 | |
I did that to have two different <ws>es in Snake, depending on whether we're inside parens or not | |||
08:47
Guest29463 is now known as matt_
08:48
darutoko joined
|
|||
raydiak | I see | 08:48 | |
arnsholt | So if the toggle is called $*WS-MODE, you can then do method ws { $*WS-MODE ?? self.ws1 !! self.ws2 } | 08:50 | |
raydiak | was just looking at github.com/arnsholt/snake/blob/mas...ar.nqp#L74 | ||
arnsholt | And ":$*WS-MODE = 1;" in a rule to change it | ||
Yup | |||
That's it | |||
Of course, that's NQP, but it should be pretty much identical in Perl 6 | 08:51 | ||
Except you can use assignment instead of binding =) | |||
08:51
darutoko- left
|
|||
timotimo | how does ":$*WS-MODE = 1" behave in regards to backtracking? | 08:52 | |
wouldn't it be wiser to have a "my" to go with it first? | |||
arnsholt | Oh, derp | ||
It's :my $*WS-MODE = 1; yeah | |||
raydiak | would make things a bit messy, having to have spaces literally everywhere and changing a dynvar instead of just writing "rule". any reason that'd be better than a preprocessing grammar? I have doubts about it performing better. | 08:54 | |
timotimo | right. difficult. | 08:56 | |
08:56
wamba left
|
|||
jnthn | You'd still write rule, the mode would just tweak what ws considers itself allowed to match | 08:57 | |
08:58
wamba joined
|
|||
raydiak | well yes but I'd be writing rule everywhere because token wouldn't do what I want, its no longer a useful choice | 08:59 | |
arnsholt | What are you parsing, OOC? | ||
raydiak | markdown in this case | 09:00 | |
arnsholt | Oh, horror! =) | ||
IIRC MarkDown is not super-amenable to CFG parsing | |||
raydiak | guess that explains why there's not an actual Grammar for it in our ecosystem yet | 09:01 | |
arnsholt | ISTR it originally being implemented by a cascade of regex search-replace | ||
And it turns out cascades of search-replace let you do context *sensitive* things | 09:02 | ||
raydiak | incidentally, I don't even know if markdown usually allows comments or not in the places I'm being asked to allow them | 09:03 | |
timotimo | when people see "markdown supported", they probably expect commonmark instead of the original markdown anyway, no? | 09:04 | |
arnsholt | I have no idea | ||
jnthn reads the first answer to stackoverflow.com/questions/4823468...n-markdown and is mildly horrified :) | 09:05 | ||
raydiak | actually it's a vague mix of multimarkdown and some other variants and some of our own proprietary additions that I'm supposed to parse :) | 09:06 | |
timotimo | yay | ||
raydiak | its coming along well so far though, near as I can tell | ||
if I just do "pile of regexes", I run into issues differentiating between things like bulleted lists and bolded chunks of text with linebreaks in the middle | 09:10 | ||
brrt wonders if org-mode syntax is more parseable... | 09:11 | ||
given as it has multiple-language support | |||
arnsholt | I'm currently leaning towards RST | 09:13 | |
Haven't looked at org-mode though, being a non-emacser =) | 09:14 | ||
raydiak | yeah that SO answer is pretty horrifying. we had thought about adding another comment syntax, but I'm hoping to avoid adding much of our own because I know nobody here is a real language designer and I fear we'll end up in impossible situations which are difficult to forsee | ||
arnsholt | RST syntax is a bit clunkier than MarkDown, but it has the definite advantage of being much more clearly defined, and has well-defined ways of extending it | ||
timotimo | raydiak: if you build your own comment syntax, you can potentially pre-process the whole document to strip out the comments and continue with a regular grammar :P | ||
arnsholt | raydiak: Are you gree-fielding, or implementing to support something that's already extant? | 09:15 | |
*green-fielding | |||
raydiak | preprocessing was what I waas wondering if there was a way to avoid int he first place. I can preprocess the html comments out just as easily | ||
timotimo | since grammars can't do streaming parsing yet anyway, you'll not lose much from pre-processing | 09:16 | |
arnsholt | Oh, that's the other horrifying thing about MarkDown: Allowing HTML | ||
timotimo | a little bit, yeah | ||
on the other hand: yay, graphics embedded into markdown by way of SVG! | |||
raydiak | there is a large amount of existing data in this...vaguely-defined pile of PHP loops and PCREs that I'm replacing | 09:18 | |
brrt | org-mode is awesome | ||
raydiak | but not so much with the mixing in of HTML, if my understanding is correct. I only have a small amount of test data | ||
brrt | in both senses of that word | ||
arnsholt | raydiak: Yeah, that's why I asked. If you were making something new, I'd have urged you to consider something not MarkDown, but when you have an existing corpus to work with, you can't | 09:19 | |
raydiak | it's good advice, wish I could take it :) | ||
arnsholt | Anyways, if you have an existing implementation and a corpus of source/rendered pairs, the first thing I'd do is extract all the source/rendered pairs into unit-tests | 09:20 | |
And then copy the existing implementation, horrors and all, as closely as possible | |||
raydiak | also there are a number of tools people are already using here that need to support what we're doing, even if they don't recognize our additions and modifications | ||
arnsholt | And then try to replace the horrors once you have something that works | 09:21 | |
raydiak | I'll think about that with at least a subset of the data. it's a lot | ||
arnsholt | Yeah, if it's a massive corpus, extract a random sample | ||
But I think I'd extract a really large sample as well as a kind of stress test | 09:22 | ||
Actually, it might be attractive to do low-level hackery on the Cursor API here | |||
The token/regex/rule stuff lets you do CFG-stuff, but if you do things with methods and manipulate the underlying cursor directly, you might be able to use declarative stuff for most of it, and then wire the loops and horid stuff together using lower-level primitives | 09:23 | ||
09:24
pierre_ left
|
|||
arnsholt | I'm not very familiar with the Cursor API though, and it might not be very well documented, so you might have to do some non-trivial source-diving to figure out exactly how to do it | 09:24 | |
raydiak | don't know that I have the time to get that deep into it, this is only a small part of a much larger project with a way-too-soon deadline | 09:25 | |
just gonna preprocess for now, but you all helped me figure that out :) | 09:26 | ||
arnsholt | Good that we could help =) | ||
09:27
brrt left
|
|||
raydiak | might even end up with more than two grammar stages if it gets hairy, to somewhat mimic the regex pile...but making tests is a smart idea | 09:28 | |
and that cursor api thought is really interesting, I've got that filed away in the back of my mind for another time :) | |||
09:29
brrt joined
09:33
pierre_ joined
|
|||
raydiak | one of my saving graces is that we don't just have proprietary additions, but also a few subtractions and simplifications...really calling it "markdown" is a tad bit of a stretch in places | 09:34 | |
anyway, thanks timotimo++ arnsholt++ brrt++ jnthn++ | 09:35 | ||
nadim | Good morning all | ||
raydiak | good morning nadim | ||
09:35
pierre_ left
09:36
pierre_ joined,
dayangkun left,
brrt left
09:38
_slade_ left
|
|||
raydiak thinks about future needs and considers trying again to fix Grammar::Generative | 09:42 | ||
but who knows how far gone that is now that it's been rotting since...2013...so much has changed since then, not just the GLR and method names | 09:43 | ||
09:49
mcmillhj joined
09:50
dayangkun joined
09:54
mcmillhj left
09:56
zakharyas joined
09:57
iH2O joined
10:00
brrt joined
10:05
dayangkun left
10:07
poohman left
10:09
labster left
10:13
ShimmerFairy left
10:14
Ven` left
10:21
ShimmerFairy joined
|
|||
llfourn_ | "Method 'foo' must be resolved by class Bar because it exists in multiple roles" | 10:26 | |
how does one "resolve" this? | |||
jnthn | Write a method foo in the class that decides what to do | ||
llfourn_ | jnthn: kk thanks | 10:27 | |
10:29
dayangkun joined
10:30
dayangkun left
10:31
dayangkun joined,
dayangkun left
10:32
dayangkun joined
10:41
eliasr joined
|
|||
lizmat | m: role A { method a {"A"} }; role B { method a {"B"} }; class C does A does B { method a { self.A::a } }; dd C.new.a # llfourn_ | 10:44 | |
camelia | rakudo-moar 8be36b: OUTPUT«"A"» | ||
llfourn_ | lizmat: thanks :) | 10:49 | |
maybe the error message could be clearer... | 10:54 | ||
"Bar must have a method 'foo' because it exists in multiple roles" | |||
although I get the reason why "resolve" is used now it does immediately suggest the solution | 10:55 | ||
doesn't* | |||
10:55
poohman joined
|
|||
jnthn | It'd be nice if the error said which roles also | 10:56 | |
llfourn_ | jnthn: it does | 10:57 | |
I just cut it short :) | |||
jnthn | Oh! | 10:58 | |
So, it' snot entirely LTA then :) | |||
eww, snot | |||
*it's not | |||
llfourn_ | no, it's pretty good. Just might need to point more directly at the solution. | 10:59 | |
11:02
pierre_ left,
poohman left
11:03
poohman joined
11:08
ka left
11:09
rindolf joined
11:10
dayangkun left
|
|||
lizmat clickbaits p6weekly.wordpress.com/2016/09/19/...he-robots/ | 11:14 | ||
masak | lizmat++ | 11:16 | |
11:16
TEttinger left
11:17
rindolf left
11:22
Ven` joined
|
|||
Ven` | raydiak: that'd be really interesting :-) | 11:22 | |
11:27
jonas2 joined
11:44
bjz joined
11:48
zakharyas left
11:49
rgrinberg joined
11:52
iH2O left
12:03
andrzejku joined
12:05
pierre_ joined
|
|||
moritz | lizmat++ | 12:05 | |
12:07
Ven` left,
newbie1 joined
12:08
bjz left
12:12
Ven` joined,
zakharyas joined
12:25
bjz joined
|
|||
[Coke] | caffeine by committe this morning: should I drink get coke zero, coffee, or tea to start? | 12:30 | |
*ee | 12:31 | ||
s/drink// - 'cause I need something, it seems. | |||
brrt | tea | ||
12:39
bioduds joined,
bjz left
|
|||
tadzik | is "zero" in "coke zero" the amount of teeth that you'll have in your 80s? :P | 12:40 | |
12:41
bjz joined
|
|||
tadzik | I'd usually go for tea on normal days and coffee if I really desperately need to wake up after too little sleep | 12:41 | |
masak | [Coke]: tea, but good tea | 12:43 | |
or, failing that, coffee but good coffee | |||
spoil yourself a little with quality stuff! | |||
12:44
itaipu joined
|
|||
Ven` | ;q | 12:44 | |
oh well. | |||
masak | Ven`: why is the little q crying? :/ | 12:45 | |
or is it just trying to exit vim? | |||
moritz | don't cry for me little q, the truth is, I never left you! | ||
masak .oO( come on, colon, I only semi-left you ) | 12:46 | ||
masak .oO( exit half of vim ) | 12:47 | ||
jkramer | m: perl6 -e 'class Foo {}; my $x = Foo; { my $x.=new; say $x.WHAT }' | ||
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Two terms in a rowat <tmp>:1------> 3perl6 -e7⏏5 'class Foo {}; my $x = Foo; { my $x.=ne expecting any of: infix infix stopper postfix statement end…» | ||
jkramer | Oops | ||
m: class Foo {}; my $x = Foo; { my $x.=new; say $x.WHAT } | |||
camelia | rakudo-moar 8be36b: OUTPUT«(Any)» | ||
masak .oO( ؛q -- exit the other half of vim ) | |||
jkramer | m: class Foo {}; my $x = Foo; { my $y = $x.new; say $y.WHAT } | ||
camelia | rakudo-moar 8be36b: OUTPUT«(Foo)» | ||
jkramer | Why is this? | ||
12:47
tushar joined
|
|||
masak | jkramer: because instances also have a .new method | 12:48 | |
jkramer: does that answer your question? | |||
it's occasionally useful -- I believe the 007 code base uses or used the fact that you can call .new on a non-type object | |||
jkramer | masak: Nope, I'm wondering why the result of the first one is Any | ||
masak | jkramer: because in that case `$x` starts out as `Any`, and then you call `.new` on that | 12:49 | |
jkramer | Also: | ||
m: class Foo {}; my $x = Foo; { say $x.new.WHAT } | |||
camelia | rakudo-moar 8be36b: OUTPUT«(Foo)» | ||
jkramer | here it works again | ||
masak | jkramer: ah, I see you *think* that you're using the *outer* `$x` in the first program | ||
jkramer | Just the assignment not | ||
masak | jkramer: that's not the case. | ||
jkramer | Oh | ||
Ven` | masak: yes. I have `(define-key state-map (kbd ";") 'evil-ex)` in my config :) | ||
masak | jkramer: once you introduce a new `$x` in the innter scope, | ||
that's what you get | |||
lizmat | m: class Foo {}; my Foo $x; { $x.=new.WHAT } | 12:50 | |
camelia | ( no output ) | ||
12:50
brrt left
|
|||
lizmat | m: class Foo {}; my Foo $x; { say $x.=new.WHAT } | 12:50 | |
camelia | rakudo-moar 8be36b: OUTPUT«(Foo)» | ||
Ven` | (yes, I'm running evil, vim emulation inside emacs. And I'm connected to IRC via said emacs...) | ||
jkramer | Ok, I see :) | ||
masak | jkramer: I think this is a difference from Perl 5. | ||
Ven` | masak: I'm curious as to how you type that "reversed" semi, however :) | 12:51 | |
.oO( Is the semi-colon half-full or half-empty? ) |
|||
12:51
poohman left
|
|||
masak | .u ؛ | 12:51 | |
yoleaux | U+061B ARABIC SEMICOLON [Po] (؛) | ||
12:51
brrt joined
|
|||
masak | I didn't type it, I used au++'s App::Uni | 12:51 | |
I use that one quite a lot | |||
[Coke] | masak: quality is not an option this morning. | 12:52 | |
tea it is. | |||
Ven` | yoleaux++ | ||
I must say, I'm pleasantly surprised with ERC. But I need to find a way to enable vim emulation here. | |||
masak | [Coke]: I curse you with the task of seeking out quality ASAP, if not this morning. | ||
Ven`: I was on ERC for a long time. I liked it a lot. | |||
12:53
bjz left,
bjz joined,
newbie1 left
|
|||
[Coke] | lipton bag tea, with splenda. | 12:56 | |
12:57
sufrostico joined
12:58
newbie1 joined
12:59
poohman joined
|
|||
masak .oO( I am altering the curse. pray I do not alter it any further. ) | 13:00 | ||
[Coke] | wow, this is not good. | 13:01 | |
masak | whyy, committee, whyyy?! | ||
13:01
mcmillhj joined
13:06
bjz left
13:07
bjz joined
13:09
cdg joined
|
|||
[Coke] | next up, I need to find a comittee to tell me what to work on today! | 13:12 | |
... and more letters to use. | |||
13:20
poohman_ joined
13:23
poohman left
13:24
rindolf joined
|
|||
jkramer | m: role R { has Str @x }; class C does R { @x = <foo bar baz> } | 13:28 | |
13:28
poohman_ left
|
|||
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '@x' is not declaredat <tmp>:1------> 3role R { has Str @x }; class C does R { 7⏏5@x = <foo bar baz> }» | 13:28 | |
jkramer | How can I make this work? | ||
Declaring @x in C as well also throws an error | |||
13:28
poohman joined
|
|||
masak | use @!x | 13:28 | |
OO attributes want a twigil | |||
and you may want to initialize @!x inside a BUILD submethod in the class | 13:29 | ||
jkramer | m: role R { has Str @!x }; class C does R { @!x = <foo bar baz> } | ||
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable @!x used where no 'self' is availableat <tmp>:1------> 3 R { has Str @!x }; class C does R { @!x7⏏5 = <foo bar baz> }» | ||
masak | m: role R { has @.x }; class C does R { submethod BUILD { @!x = <foo bar baz> } }; say C.new.x | ||
camelia | rakudo-moar 8be36b: OUTPUT«[foo bar baz]» | ||
jkramer | Hmm, is there no easier way to override the value? | 13:30 | |
masak | m: role R { method x { () } }; class C does R { method x { <foo bar baz> } }; say C.new.x | ||
camelia | rakudo-moar 8be36b: OUTPUT«(foo bar baz)» | ||
13:31
rgrinberg left
|
|||
jkramer | Can role parameters be named? I.e. role R[Str :@x] or something? | 13:32 | |
masak | sure | ||
they're full-fledged parameters | |||
jkramer | \o/ | ||
masak | I could've answered "try it and see" on that one :) | ||
13:36
MilkmanDan left
|
|||
jkramer | Arrrgh, I presume a role parameter can't have the role as type? :D | 13:36 | |
m: role R[R :$x] {} | |||
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Invalid typename 'R' in parameter declaration.at <tmp>:1------> 3role R[R7⏏5 :$x] {}» | ||
masak | I think that runs up against R not being declared yet inside the `[ ]` brackets | 13:37 | |
jnthn, correct me if I'm wrong | |||
jnthn | You'd be right | ||
I guess because the signature is considered part of the role's long name | |||
masak | right | ||
m: role R {}; role R[R :$x] {} | |||
camelia | ( no output ) | ||
13:37
kaare__ joined
|
|||
masak | that works :) | 13:37 | |
jnthn | We might be able to fudge it though. | ||
masak | m: role R { ... }; role R[R :$x] {} | 13:38 | |
camelia | ( no output ) | ||
13:38
MilkmanDan joined
|
|||
jnthn | But yeah, that workaround works fine enough | 13:38 | |
masak | yeah | ||
I don't think we should over-promise by making names available before they're even declared :P | |||
13:40
skids joined
|
|||
jkramer | m: sub x(--> Array[Int]) { return [] }; x | 13:47 | |
camelia | rakudo-moar 8be36b: OUTPUT«Type check failed for return value; expected Array[Int] but got Array ($[]) in sub x at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
jkramer | How can I make this work? :) | ||
Ah got it | |||
m: sub x(--> Array[Int]) { return Array[Int].new }; x | |||
camelia | ( no output ) | ||
13:49
AlexDaniel joined
13:50
Sgeo_ left
|
|||
masak | m: sub x(--> Array[Int]) { my Int @x = 1, 2, 3; return @x }; say x | 13:50 | |
camelia | rakudo-moar 8be36b: OUTPUT«[1 2 3]» | ||
13:50
bjz left
|
|||
masak | typing of containers is nominal in Perl 6, not structural | 13:51 | |
13:51
niko joined,
bjz joined
|
|||
masak | so it's not enough for an array to contain only the desired type of values; it must also be declared to do so | 13:51 | |
jkramer | Alright | 13:54 | |
13:57
igncogneato joined
|
|||
masak | m: sub x(--> Array[Real]) { my Int @x = 1, 2, 3; return @x }; say x | 13:57 | |
camelia | rakudo-moar 8be36b: OUTPUT«Type check failed for return value; expected Array[Real] but got Array[Int] (Array[Int].new(1, 2, 3)) in sub x at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
masak | also, arrays are not covariant, it seems. probably a good thing. | ||
14:02
mcsnolte joined
14:03
_sfiguser left
14:04
ka joined
14:05
b2gills left
14:06
andrzejku left
|
|||
SmokeMachine____ | moritz: thanks! | 14:06 | |
Ven` | masak: I'd agree with that :-) | ||
14:08
ka left,
Khisanth left
14:09
zakharyas left
14:12
poohman left,
optikalmouse joined
|
|||
dalek | c: 724e5fa | coke++ | doc/Language/ (2 files): fix whitespace |
14:12 | |
14:14
MetaZoffix joined
|
|||
MetaZoffix | Human relations question: is naming an IRC bot responsible for reporting test coverage results "CoverGirl" sexist or undesirable? | 14:14 | |
14:15
ptolemarch joined,
khw joined,
_sfiguser joined
14:16
bjz left
|
|||
moritz | I like the name, but I can see the potential for ill will | 14:16 | |
MetaZoffix | k. I'll think of something else :) | 14:17 | |
14:17
bjz joined
|
|||
ilmari | covertly? | 14:17 | |
MetaZoffix | That's good :) | ||
AlexDaniel | … coverable? ;D | 14:18 | |
moritz | lid | ||
because the lid covers the eye | |||
(idea courtesy by masak++) | |||
optikalmouse | goooood morning | ||
mst | MetaZoffix: given it's mostly there to upset people about their coverage being insufficient | 14:19 | |
MetaZoffix: I vote for coverrage | |||
COVERRAGE SMASH 20% REPORT | |||
[Coke] | undercover(ed) | 14:20 | |
mst | [Coke]++ | ||
DrForr | 'Undercover Brother' is as bad in the wrong direction :) | 14:21 | |
MetaZoffix goes with undercover, as it's an available nick. [Coke]++ | |||
14:21
bjz left,
Khisanth joined
|
|||
vcv | spin off of [Coke]'s idea: uncover(ed) | 14:21 | |
MetaZoffix | Thanks, all! | 14:22 | |
14:22
MetaZoffix left,
bjz joined
|
|||
timotimo | is there a reason we don't allow #`» ... « for comments? | 14:24 | |
m: say » hi there « | |||
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Missing infix inside hyperat <tmp>:1------> 3say »7⏏5 hi there « expecting any of: infix infix stopper» | ||
timotimo | well ... | ||
for code i understand it | |||
moritz | because the quotes pair the other way around | 14:25 | |
timotimo | not if you're french | ||
masak | was gonna say -- think it's language-dependent | ||
timotimo | we allow smart quotes for all kinds of stuff, but not for this | 14:26 | |
masak | I for one wouldn't grieve too much if the above never worked | ||
but YMMV | |||
timotimo | m: say foo ~~ / foo / | 14:27 | |
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Expected a term, but found either infix ~~ or redundant prefix ~ (to suppress this message, please use a space like ~ ~)at <tmp>:1------> 3say foo ~~7⏏5 / foo /» | ||
14:27
mohae joined
|
|||
timotimo | m: say foo ~~ rx/ foo / | 14:27 | |
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Expected a term, but found either infix ~~ or redundant prefix ~ (to suppress this message, please use a space like ~ ~)at <tmp>:1------> 3say foo ~~7⏏5 rx/ foo /» | ||
timotimo | m: say "foo" ~~ rx/ foo / | ||
camelia | rakudo-moar 8be36b: OUTPUT«「foo」» | ||
14:28
Ven` left
14:29
pd_ joined
|
|||
jkramer | Is there a nicer way for saying: <foo 123 baz>.map: -> $x { val($x) } | 14:29 | |
14:30
pd_ left
|
|||
jkramer | .map: val(*) doesn't seem to work and >>.val doesn't work because it's not a method | 14:30 | |
timotimo | m: say < foo 123 baz >.perl | ||
camelia | rakudo-moar 8be36b: OUTPUT«("foo", IntStr.new(123, "123"), "baz")» | ||
timotimo | m: say <foo 123 baz>.perl | ||
camelia | rakudo-moar 8be36b: OUTPUT«("foo", IntStr.new(123, "123"), "baz")» | ||
timotimo | it already goes through val | ||
jkramer | Wut | ||
timotimo | m: say qqA test A | ||
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared name: A used at line 1Undeclared routines: qqA used at line 1 test used at line 1» | ||
timotimo | m: say qq☺ test ☺ | ||
camelia | rakudo-moar 8be36b: OUTPUT« test » | ||
timotimo | m: say qq☺test☺ | 14:31 | |
camelia | rakudo-moar 8be36b: OUTPUT«test» | ||
AlexDaniel | m: say qq» test » | ||
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Use of a closing delimiter for an opener is reservedat <tmp>:1------> 3say qq7⏏5» test »» | ||
jkramer | Is this specific to <...> or lists of stuff in general? | ||
masak | specific to <...> | ||
well, and <<...>> | |||
jkramer | Ah, then ignore that and assume it's an Array of Str :) | ||
14:31
wamba left
|
|||
jkramer | I just used <> for demonstrating | 14:31 | |
DrForr | m: say qq AtestA | 14:32 | |
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Alphanumeric character is not allowed as a delimiterat <tmp>:1------> 3say qq7⏏5 AtestA» | ||
masak | m: say ("foo", "123", "baz")>>.&val | ||
camelia | rakudo-moar 8be36b: OUTPUT«(foo 123 baz)» | ||
masak | m: say ("foo", "123", "baz")>>.&val.perl | ||
camelia | rakudo-moar 8be36b: OUTPUT«("foo", IntStr.new(123, "123"), "baz")» | ||
DrForr | Huh, thought I tested for that. | ||
jkramer | So >>.& works for any routine? | 14:33 | |
timotimo | that's right | ||
just like .&foo will also work | |||
jkramer | Sweet, thanks! :) | ||
masak .oO( we're lazy, so we just made it work consistently for everything ) | |||
jkramer | Ha, didn't know that either. I should read through the infinite list of operators some time :) | ||
masak | >>. is technically a dotty, not an operator :P | 14:34 | |
and & is a sigil | |||
AlexDaniel | m: say ("foo", "123", "baz")>>.&{“Blah! $_”}.perl | ||
camelia | rakudo-moar 8be36b: OUTPUT«("Blah! foo", "Blah! 123", "Blah! baz")» | ||
AlexDaniel | ↑ and here's how you can do almost anything | ||
jkramer | OMG :D | 14:35 | |
masak | our aim is to leave language purists with their mouths agape, unable to utter a word in protest | ||
jkramer | That's genius | ||
timotimo | twitter.com/AFresh1/status/778054292804546561 - does my answer seem good? | ||
Juerd | .{ ... } works? Wow! | ||
jkramer | So what's the point of .map then? :) I'll never use it again | 14:36 | |
AlexDaniel | jkramer: um, they are completely different | ||
14:36
Ven` joined
|
|||
moritz | jkramer: map works with multi-arg blocks, for example | 14:37 | |
also, map is lazy, >> is very eager | |||
AlexDaniel | and » is potentially parallelizable | ||
vcv | m: say <a 1 b 2 c 3>.map: * ~ "=" ~ * | 14:38 | |
camelia | rakudo-moar 8be36b: OUTPUT«(a=1 b=2 c=3)» | ||
Juerd | Ah, I forgot the &. But still, .&{ ... } is amazing. | ||
timotimo | &.foo is also a thing, but a very different thing :P | 14:39 | |
gfldex | m: dd <foo 123 baz>.map: { .&val } | ||
camelia | rakudo-moar 8be36b: OUTPUT«("foo", IntStr.new(123, "123"), "baz").Seq» | ||
timotimo | and & .foo is yet another very different thing | 14:40 | |
mst | well, that's neat | ||
one can't use * as a method name | |||
but one can define a postfix .* | |||
14:40
itaipu left
|
|||
Juerd | mst: What are you going to use that for? Call a random method? :P | 14:40 | |
timotimo | fwiw, .*blah already exists | 14:41 | |
mst | timotimo: which is? | ||
masak | mst: | ||
m: class C { method foo { say "C" } }; class D is C { method foo { say "D" } }; D.new.*foo | |||
camelia | rakudo-moar 8be36b: OUTPUT«DC» | ||
timotimo | yes, that | ||
masak | "call all methods in the mro" | ||
timotimo | in that vain, .+ also exists | ||
masak | vein* :) | ||
timotimo | m: say "heyo".+vain | ||
camelia | rakudo-moar 8be36b: OUTPUT«No such method 'vain' for invocant of type 'Str' in block <unit> at <tmp> line 1» | ||
timotimo | m: say "heyo".*vain | ||
camelia | rakudo-moar 8be36b: OUTPUT«()» | ||
timotimo | m: say "heyo".?vain | ||
camelia | rakudo-moar 8be36b: OUTPUT«Nil» | ||
mst | yep, but that's not what I care about | ||
perlpilot | timotimo: for completion you should mention that .?foo also exists | ||
timotimo | perlpilot: i just did :) | ||
masak .oO( it is vain to correct someone's spelling ) :P | |||
mst | Juerd: nope | ||
perlpilot | yeah, I'm too slow typing this morning :) | 14:42 | |
mst | and that means | ||
timotimo | perlpilot: don't worry, i'm just very fast | ||
mst | sub postfix:<.foo> ($foo) { sub ($bar) { $bar ~ ' ' ~ $foo.f() } } | ||
$f.foo(3) | |||
works | |||
which means | |||
I can potentially do C# style extension methods | |||
EXCELLENT | |||
lexical augmentation of available methods on an object, transparently | |||
14:42
itaipu joined
|
|||
timotimo | they won't show up in things like .^methods or other introspection, though | 14:42 | |
14:42
pmurias joined
|
|||
masak | mst: you kind of already get that through .&foo, though | 14:43 | |
mst | I can live with that | ||
masak: the & OFFENDS ME | |||
masak | a-ha | ||
timotimo | OK | ||
Juerd | Where's .& documented? | ||
masak | Juerd: it's an emergent feature :P | ||
it falls out of being able to use variables in place of a literal method name | 14:44 | ||
Juerd | Still :) | ||
mst | masak: also, AFAICS, with appropriate matching, I can, for things that already have a .foo, fall through to that | ||
timotimo | watch out if you spell it like that, masak | ||
mst: indeed | |||
mst | and that's really interesting | ||
since IIRC '$x but Foo' copies $x whereas this would work in-place on $x | 14:45 | ||
14:45
mcmillhj left
|
|||
timotimo | yeah, and "does" will mutate the original object | 14:45 | |
mst | right | 14:46 | |
and I want augment-if-necessary-within-my-current-scope | |||
basically | |||
there's uses for that | |||
dalek | c: c4a4116 | gfldex++ | doc/Language/operators.pod6: remove superstitiuos parentheses from example |
14:47 | |
vcv | Semi-related, is there a way to call variants of a multi that match instead of just the "best" match? | ||
14:47
igncogneato left
|
|||
vcv | call all variants* | 14:47 | |
timotimo | that's what .* does | 14:48 | |
moritz | .* (for method calls) | ||
timotimo | it'll still only call those that match the passed arguments | ||
vcv | right | ||
I was just trying.. I must have been doing it wrong then :( | |||
timotimo | oh | ||
if you have just the multi, you can use something like .can or .cando or something | 14:49 | ||
i never needed that | |||
14:50
wamba joined
|
|||
masak | m: class C { multi method foo($x) { say "x" }; multi method foo($y) { say "y" } }; C.new.*foo(42) | 14:52 | |
camelia | rakudo-moar 8be36b: OUTPUT«Ambiguous call to 'foo'; these signatures all match::(C $: $x, *%_):(C $: $y, *%_) in block <unit> at <tmp> line 1» | ||
jnthn | .* is only about the inheritance tree, not about multis | ||
masak | ...what jnthn said :) | ||
jnthn | .cando can be used to find all matching multis | ||
masak | I don't remember if this changed somewhere along the line, or if it was always just the mro chain | 14:53 | |
jnthn | It changes years and years ago, when proto methods started to exist :) | ||
*changed | |||
14:54
geraud left
|
|||
jnthn | So ~2010 | 14:54 | |
Maybe 2011 | |||
masak | ah. | ||
jnthn | It was debated a few times, but the final ruling in the run-up to 6.c was that it stays the way it is. | 14:55 | |
14:56
LeCamarade joined
|
|||
jnthn | .cando can be used to get all multi candidates matching a Capture | 14:57 | |
15:00
mcmillhj joined,
poohman joined,
andrzejku joined,
poohman_ joined,
perlawhirl joined
15:01
brrt left
15:02
pierre_ left,
cdg left
|
|||
vcv | fffffff~./~. | 15:03 | |
right~. | |||
timotimo | die, ssh connection, die! | ||
moritz | RETURN TILDA DOT | 15:04 | |
poohman | Hello all, dont we have Str.len or Str.length? | ||
15:04
Ven` left
|
|||
timotimo | m: say "foobar".length | 15:04 | |
camelia | rakudo-moar 8be36b: OUTPUT«Method 'length' not found for invocant of class 'Str' in block <unit> at <tmp> line 1» | ||
moritz | poohman: nope; you must ask for a specific unit | ||
timotimo | i thought we used to have a nice error message for that | ||
moritz | poohman: like .chars or .codes (or .bytes on buffers) | 15:05 | |
poohman | oh ok | ||
15:05
geraud joined
|
|||
poohman | perfect thanks | 15:06 | |
mst | poohman: means you're never confused about "which length" | 15:07 | |
timotimo | but how do i figure out how long a string would be if i asked javascript about it? :( | 15:08 | |
mst | roll a d6, assume that's as accurate as anything else | ||
timotimo | i guess i'd just have to go through the string codepoint-per-codepoint and if the codepoint is on the astral plane (or something?) count it as two characters | 15:09 | |
15:10
wamba left
15:12
domidumont left
15:13
poohman_ left,
poohman_ joined,
huggable left
15:14
Ven` joined
|
|||
jkramer | Is there a nice and safe way to generate a bunch of methods in a role or class? Not necessarily monkey-patching at runtime, I'm just looking to safe myself from some typing | 15:14 | |
perlpilot | EVAL? :> | ||
jkramer | I.e. curryently I have "multi method x(*@) { all-do-the-same-thing() }" ~10 times with different names instead of x | 15:15 | |
15:15
huggable joined
|
|||
perlpilot | docs.perl6.org/routine/add_method | 15:15 | |
moritz | jkramer: look for add_method and compose in the docs | ||
jkramer | And I'd like to do "for <lots of method names> -> $name { make multi method $name(*@) { ... } } | ||
15:16
canopus left
|
|||
perlpilot | see also docs.perl6.org/language/mop | 15:16 | |
moritz | for @names ->name { ::?CLASS.^add_method($name, method (*@) { ...}) }; | ||
pmurias | timotimo: wouldn't you need to go through codepoint-per-codepoint (if it's on the basic plane i++ and if on the astral/supplementary plane i += 2) | 15:17 | |
timotimo | pmurias: yeah, that's what i meant? | ||
15:18
canopus joined,
mcmillhj left
|
|||
jkramer | moritz: That looks like what I want, but doesn't seem to work with multi methods | 15:18 | |
15:19
domidumont joined
|
|||
timotimo | i believe you can add_multi_method or something? | 15:19 | |
jkramer | timotimo: I think it's because it's an anonymous method in the call to add_method | 15:20 | |
timotimo | multi methods absolutely require you to compose something | ||
pmurias | timotimo: ok, I have looked at generated javascripted too much today ;) | ||
jkramer | "An anonymous method may not take a multi declarator" | ||
timotimo | yeah | 15:21 | |
jkramer | Ah no it works :) | ||
timotimo | we don't have a way to associate multiple multi candidates into the same "thingie" if they don't have a name | ||
jkramer | Ok, got it :) add_multi_method but with "method $name" instead of "multi method $name" | ||
pmurias | timotimo: str.replace(/([\uD800-\uDBFF][\uDC00-\uDFFFF]|[\S\s])/g, "_").length | 15:23 | |
timotimo | _ rather than __? | 15:24 | |
perlawhirl | timotimo: shell(q{node -e 'console.log("ñoñó".length)'}, :out).out.lines | 15:26 | |
yoleaux | 19 Sep 2016 07:57Z <nine> perlawhirl: note that just installing an older version when a newer one was already installed, won't make rakudo use that old version. If no :ver is specified in the use statement, we pick the newest version. | ||
perlawhirl ducks | |||
timotimo | :) | ||
skaji | Hi, | 15:29 | |
IO::Socket::Async used to read data all at once, if data is small. | 15:30 | ||
But now IO::Socket::Async always does not read data all at once. | |||
Is this expected? | |||
Please look at gist.github.com/skaji/664077e99b80...d1a54a0910 | |||
15:31
canopus left
|
|||
timotimo | if you read non-binary, you'll have to wait for a control character to get the very last character | 15:31 | |
because the next bytes you receive could introduce a composing character | |||
and if you already got the data via string, it'll be too late for perl6 to give you the right data, it might already have "escaped" | 15:32 | ||
bioduds | hey guys, I installed MongoDB but it is not working | ||
how can I check if install was ok? | |||
timotimo | bioduds: what are the symptoms? | ||
bioduds | when I run the program | ||
it says | |||
😀 bem vinda Já conhece o trabalho do BUKKAKEROS? | |||
sorry | |||
15:32
poohman left
|
|||
bioduds | wrong copy paste | 15:32 | |
here | 15:33 | ||
===SORRY!=== Could not find MongoDB::Client at line 7 in: | |||
could not find? | |||
but I installed | |||
im confused | |||
:) | |||
timotimo | it could be the module doesn't have a provides section? | ||
nine | ^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H/win 13 | ||
timotimo | did the module run its tests successfully? | ||
bioduds | I dont know | ||
how can I check? | |||
timotimo | the module does have a provides section that looks correct | 15:34 | |
just try to install it again, maybe put --force after "panda" or "zef" | |||
skaji | timotimo: Oh, composing character, I see. | ||
bioduds | ok | ||
timotimo | skaji: we're in the process of exposing encoding and such better to the user | 15:35 | |
skaji: until then you might want to just set latin1 as the encoding or use binary blobs and do your own decoding | |||
nine | Considering that --force only helps if the very same version is already installed, I would only suggest it really sparingly and only if I knew it would actually solve something. | ||
15:36
domidumont left
|
|||
timotimo | right | 15:36 | |
bioduds | re-installing | ||
timotimo | that makes sense | ||
15:37
mcmillhj joined
|
|||
nine | Also the precomp repository now puts more trust in the immutability of distributions and I'm not sure we actually outdate precomp files when a distro gets overwritten with a modified version. | 15:37 | |
Well modified code but same version to be precise. | |||
skaji | timotimo: OK, I will use Supply(:bin). Thanks! | 15:38 | |
15:38
canopus joined
|
|||
timotimo | good luck! | 15:39 | |
skaji: in the future we'll be properly able to change the encoding in the middle of a connection, which will be good for HTTP | |||
mst | m: sub roll { for %_.kv -> $k, $v { my ($d) = $k.comb(rx{<[0..9]>+}); say &CORE::roll(0+$v, 1..$d).join(", ") } }; roll :6d6 | 15:43 | |
camelia | rakudo-moar 8be36b: OUTPUT«1, 6, 4, 1, 4, 2» | ||
mst | m: sub roll { for %_.kv -> $k, $v { my ($d) = $k.comb(rx{<[0..9]>+}); say &CORE::roll(0+$v, 1..$d).join(", ") } }; roll :d12 | ||
camelia | rakudo-moar 8be36b: OUTPUT«11» | ||
mst | :D | ||
timotimo | that's cute | 15:44 | |
does it fit into a tweet? looks a tad long for that | 15:45 | ||
mst | wc says 142 | ||
so | |||
and that includes the 'perl6 -e' bit | |||
timotimo | it'd want some description of what it does, too | 15:47 | |
m: say "foobar" ~~ /<digit>+/ | 15:48 | ||
camelia | rakudo-moar 8be36b: OUTPUT«Nil» | ||
timotimo | m: say "9d10" ~~ /<digit>+/ | ||
camelia | rakudo-moar 8be36b: OUTPUT«「9」 digit => 「9」» | ||
timotimo | m: say "<[0..9]>".chars; say "<digit>".chars | ||
camelia | rakudo-moar 8be36b: OUTPUT«87» | ||
timotimo | but <digit> may include some weird unicode ones, too, if you don't like that | ||
.u die face | 15:50 | ||
yoleaux | U+2680 DIE FACE-1 [So] (⚀) | ||
U+2681 DIE FACE-2 [So] (⚁) | |||
U+2682 DIE FACE-3 [So] (⚂) | |||
timotimo | m: say (:⚀d⚂) | ||
camelia | rakudo-moar 8be36b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Bogus statementat <tmp>:1------> 3say (:7⏏5⚀d⚂) expecting any of: colon pair» | ||
timotimo | OK, So doesn't go there | ||
m: say "⚂".&uniprop | 15:51 | ||
camelia | rakudo-moar 8be36b: OUTPUT«So» | ||
timotimo | committable6: releases say "⚂".&uniprop | ||
committable6 | timotimo, ¦«2015.10,2015.11,2015.12,2016.02,2016.03,2016.04,2016.05,2016.06,2016.07.1,2016.08.1,HEAD»: So | ||
timotimo | oh, i thought it might have something numeric about it | 15:52 | |
have had* | |||
15:52
perlawhirl left
|
|||
mst | timotimo: yes, that's exactly why I didn't use <digit> | 15:53 | |
timotimo | understood | ||
m: my $k = "d20"; my ($d) = $k ~~ /<[0..9]>+/; say $d | 15:54 | ||
camelia | rakudo-moar 8be36b: OUTPUT«「20」» | ||
timotimo | this ought to be shorter than using .comb and the parens | ||
BBL | |||
16:00
newbie1 left,
poohman joined
|
|||
pmurias | [Coke]: I fixed t/docs/opcodes.t | 16:00 | |
16:03
poohman left,
acrussell joined
16:04
zakharyas joined
16:05
andrzejku left
16:07
domidumont joined
16:12
cdg joined
|
|||
[Coke] | Thanks. Hopefully you didn't have to mangle your code. | 16:15 | |
16:20
acrussell left,
itaipu left
16:23
wamba joined
16:26
itaipu joined
16:28
wamba left
|
|||
jkramer | Is the precedence of multi methods with the same signature defined (and documented somewhere)? | 16:29 | |
perlpilot | "multi methods with the same signature"? | 16:30 | |
timotimo | if you have two multi methods with the same signature, you should get a compile-time error | ||
jkramer | They're not 100% the same, but technically they both match the same stuff. One is (*@) and one is (*@foo) | 16:31 | |
16:31
jonas2 left
|
|||
timotimo | that's the same signature and ought to give you an error | 16:32 | |
jkramer | It seems like (*@foo) is preferred (which is what I want) but I'd feel better if that was defined behavior :) | ||
Well it doesn't | |||
timotimo | are you using add_method or add_multi_method? | ||
jkramer | Yup :) How did you know ;) | ||
timotimo | it's probably the grammar (or rather the actions) that cause that particular error | 16:33 | |
16:33
itaipu left
|
|||
jkramer | Ah | 16:33 | |
timotimo | are you composing the class after you're done adding stuff? | ||
16:33
itaipu joined
|
|||
jkramer | The add_multi_method happens in a role which is then applied to a class. The other confliciting method is defined in yet another role which is applied to the same class, if that matters | 16:34 | |
However the other method isn't added with add_multi_method | |||
timotimo | are you adding a method with add_method and then a method with the same name with add_multi_method? | ||
jkramer | No, only with add_multi_method and in the other role the other method is defined as usual with "multi method foo..." | 16:35 | |
timotimo | mhm, mhm | ||
i'd do some prodding with .^methods and .candidates on the methods to see what's really going on | |||
16:36
mcmillhj left
16:37
domidumont left,
mcmillhj joined
16:38
domidumont joined,
dakkar left
|
|||
jkramer | Here's a dump of the ^methods and their .candidates dpaste.com/3VY1DVY | 16:41 | |
The method I'm concerned about is "get" | |||
post, put, patch, head and delete are the other ones added with add_multi_method | |||
So the candidates for get() are one proper method and one anon | 16:42 | ||
16:42
mcmillhj left,
Possum left
|
|||
timotimo | ah | 16:44 | |
well, you've got different signatures there anyway :) | |||
so it shouldn't give you an error | |||
and the narrowness is clear for that | 16:45 | ||
jkramer | Because of the Mu vs Image? | ||
timotimo | yes | ||
jkramer | Hmm, interesting. So the Image methods have precendence because the others are in Mu which is higher up in the inheritance thing? | 16:46 | |
16:46
zakharyas left
|
|||
timotimo | the part before the : is the type constraint on the "self" (aka the invocant) | 16:47 | |
a narrower type constraint gets preferred | |||
jkramer | And the Mu comes from the add_multi_method thing I guess? So if I define it as multi method get(*@) in that role it should crash? | 16:49 | |
Oh yeah it does. | |||
Nice, so the add_multi_method is actually helping me quite a bit here :) | |||
16:52
dogbert17 joined
16:54
mcmillhj joined
16:58
cdg left,
acrussell joined
17:00
BillSussman joined,
AndyBotwin left
17:04
poohman_ left
17:06
Possum joined
17:18
psch joined
17:23
geraud left,
acrussell left
17:30
poohman joined
17:32
firstdayonthejob joined,
b2gills joined
17:33
andrzejku joined
17:34
_slade_ joined
17:37
optikalmouse left
17:41
itaipu left,
wamba joined,
itaipu joined
17:42
cdg joined
17:43
geraud joined
17:49
geraud left,
itaipu left,
itaipu joined
17:52
ocbtec left
|
|||
vcv | What's the shortest way to print a new line to stdout? say ''; anything shorter? | 17:53 | |
mst | sub nl () { say '' } | ||
nl; | |||
TimToady | m: say() | 17:54 | |
camelia | rakudo-moar 8be36b: OUTPUT«» | ||
17:55
harmil_wk joined
|
|||
vcv | ah. i wrongly assumed say() was the same as just say | 17:55 | |
harmil_wk | Should FIRST now be defined inside a loop? I get: | ||
yoleaux | 02:14Z <MasteDuke> harmil_wk: ⒗ won't work by design for a bunch of stuff. see github.com/rakudo/rakudo/commit/e2...6d25995a90 for some discussion. it has a .uniprop of 'No' instead of 'Nd' | ||
harmil_wk | m: sub sd ($d) { $d.DateTime.local }; for ^3 { say "Time: {sd BEGIN now}, {sd INIT now}, {sd FIRST now}, {sd ENTER now}, {sd now}"; } | 17:56 | |
camelia | rakudo-moar 8be36b: OUTPUT«Use of Nil in string context in block at <tmp> line 1Time: 2016-09-20T19:56:11.317111+02:00, 2016-09-20T19:56:11.358320+02:00, , 2016-09-20T19:56:11.373095+02:00, 2016-09-20T19:56:11.375848+02:00Use of Nil in string context in block at <tmp…» | ||
17:56
rindolf left
|
|||
psch | harmil_wk: it's 'sub FIRST $val' vs 'FIRST sub $val' what gives you the warning | 17:58 | |
m: for ^1 { FIRST say "hi"; }; | |||
camelia | rakudo-moar 8be36b: OUTPUT«hi» | ||
psch | m: for ^2 { FIRST say "hi"; }; | ||
camelia | rakudo-moar 8be36b: OUTPUT«hi» | ||
psch | m: for ^2 { say FIRST "hi"; }; | ||
camelia | rakudo-moar 8be36b: OUTPUT«WARNINGS for <tmp>:Useless use of constant string "hi" in sink context (line 1)NilNil» | ||
psch | harmil_wk: ...plus something about FIRST apparently not returning a value..? | ||
harmil_wk | psch: That can't be. It still happened before I added sd | ||
psch | (note the second example has two Nils) | ||
harmil_wk: right, that's what i just noticed myself. looks wrongish from here, but i'm a bit out of practice. better wait for someone else to chime in :) | 17:59 | ||
18:00
robertle joined
|
|||
TimToady | according to S04:1391 FIRST is supposed to return a value, but I believe it is NYI | 18:02 | |
synopsebot6 | Link: design.perl6.org/S04.html#1391_FIRS...rn_a_value | ||
TimToady | say wot? | ||
18:02
codydn joined
|
|||
psch | bad heuristics, probably | 18:03 | |
timotimo | whoops :) | ||
psch | i remember having fiddled with that once, probably waterbedded something :S | ||
timotimo | it's very easy to waterbed this particular piece of software | 18:04 | |
TimToady | .oO(waterbedding as a form of torture...) |
||
18:06
Ven` left
18:07
LeCamarade left,
rindolf joined
18:17
Ven` joined,
itaipu left
18:18
itaipu joined
18:21
Ven` left
18:22
firstdayonthejob left
|
|||
harmil_wk | Note that the example above was based on seeing INIT in the example at rosettacode.org/wiki/Handle_a_signal#Perl_6 | 18:22 | |
I assumed it was generalizable to all phasers. | 18:23 | ||
TimToady | notice the asterisks in the table at S04:1380 | 18:25 | |
synopsebot6 | Link: design.perl6.org/S04.html#line_1380 | ||
18:25
canopus left
|
|||
poohman | m: say "Hello testing" | 18:26 | |
camelia | rakudo-moar 8be36b: OUTPUT«Hello testing» | ||
18:26
girafe joined
|
|||
TimToady | phasers without an asterisk cannot be used for their value because that would involve time travel | 18:27 | |
which is one of the few things we haven't solved in Perl 6... | |||
but note that has a speculated asterisk, indicating it should work | 18:28 | ||
s/that/that FIRST/ | |||
speaking of time travel... | |||
AlexDaniel | synopsebot6: source | 18:30 | |
meh | 18:31 | ||
SourceBaby: source | |||
SourceBaby | AlexDaniel, See: github.com/zoffixznet/perl6-sourceable | ||
AlexDaniel | SourceBaby: good bot | ||
18:32
firstdayonthejob joined
18:33
canopus joined
|
|||
SmokeMachine____ | Hi! can anyone help me? I am having a problem but I couldn't find how to simplify it to post here... :( but thats it: the error is intermittent: if I change a class to add a new attribute, it gives a error on another class... | 18:34 | |
www.irccloud.com/pastebin/bwRXBjJO/Error | 18:35 | ||
the original code is in: github.com/FCO/ProblemSolver | 18:36 | ||
psch would guess lingering precomp files | 18:37 | ||
SmokeMachine____ | psych: if I remove the .precomp dir, it gives error from the first time... www.irccloud.com/pastebin/iqGbQi4Y/ | 18:38 | |
psch | SmokeMachine____: alright, i probably guessed wrong then, sorry :) | 18:39 | |
TimToady | how is add-heuristic declared? | 18:40 | |
SmokeMachine____ | psch: thanks for trying! :) | ||
TimToady: its handled by a array attribute of Problem | |||
TimToady | I mean, what's the signature? | 18:41 | |
TimToady too lazy to download it all to grep... | |||
SmokeMachine____ | TimToady: no, sorry... its a normal method! | ||
TimToady | with what signature? | ||
SmokeMachine____ | method add-heuristic($var, &heu) { | ||
and: has Array of Callable%!heuristics; | 18:42 | ||
TimToady | okay, so something inside that method | ||
SmokeMachine____ | the only line of the method: %!heuristics{$var}.push: &heu | ||
TimToady | huh, it's like it's expecting Array[Callable]:U or so | 18:43 | |
SmokeMachine____ | TimToady: 👆 | ||
18:44
cdg left
|
|||
TimToady | well, it's apparently not autoviving for you somehow, seems | 18:44 | |
SmokeMachine____ | this is the method: github.com/FCO/ProblemSolver/blob/...em.pm6#L11 | ||
TimToady | try making sure the element exists first? | ||
timotimo | oh, autovivification sometimes just doesn't work if you declare a constraint | ||
timotimo hasn't investigated yet | |||
SmokeMachine____ | but it works if it does not exists a Array of Callable on another class... :( | 18:45 | |
TimToady | might be a () vs some undef value thing | 18:46 | |
the attribute is probably forcing a .new at some point on the value that is complaining it's a .new, but that doesn't explain why the assignment wouldn't work | 18:47 | ||
anyway, it does look a little buggy to me | |||
SmokeMachine____ | the problem occours when I add this line: github.com/FCO/ProblemSolver/blob/...ate.pm6#L7 | 18:48 | |
TimToady | yes, which is an array of callables, which is probably getting Array[Callable].new somewhere | ||
which is not assigning right inside the push | 18:49 | ||
SmokeMachine____ | but its in another class... | ||
and no-one uses that array... | |||
TimToady | what happens if, before the push, you say %!heuristics{$var} //= Array[Callable].new; | ||
SmokeMachine____ | let me try it... | 18:50 | |
TimToady | this will rule out an autoviv problem | ||
CIAvash | the error message reminds me of this bug: rt.perl.org/Public/Bug/Display.html?id=127309 | 18:51 | |
18:52
optikalmouse joined
|
|||
SmokeMachine____ | TimToad: the same www.irccloud.com/pastebin/LSSo6eIY/ | 18:52 | |
TimToady | wow CIAvash++ | ||
psch | #127309 looks like some kind of parameterization caching problem? | ||
synopsebot6 | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=127309 | ||
psch | anyway, yeah, spooky :) | 18:53 | |
TimToady | so praps a noan bugg | ||
SmokeMachine____ | This is Rakudo version 2016.09-19-g8be36b1 built on MoarVM version 2016.09 implementing Perl 6.c. | ||
psch | (wow that phonetic transcription took me a while to pull apart, TimToady++) | 18:54 | |
TimToady | spellin' is my speshialitee | 18:55 | |
lunch & | 18:56 | ||
18:57
sufrostico left
18:59
ka joined
19:08
Actualeyes left
19:21
domidumont left
19:23
andrzejku left
19:24
darutoko left
19:40
andrzejku joined
19:41
itaipu left
19:42
itaipu joined
19:44
MetaZoffix joined
19:52
MetaZoffix left
19:55
optikalmouse left
20:07
poohman left
20:17
telex left,
wamba left
20:18
telex joined
20:19
cdg joined,
codydn left
20:20
LegalResale joined
20:22
Ven_ joined
20:23
bazzaar joined
20:25
andrzejku left
20:26
bazzaar left
|
|||
broquaint | If I want to run perl6 on the JVM is my best option to build from source or is it part of Rakudo Star (or other)? | 20:28 | |
konobi | broquaint: ask mst | 20:29 | |
konobi ducks | |||
timotimo | huh? | ||
what does mst have to do with rakudo-jvm? | 20:30 | ||
broquaint: at the moment, rakudo-j has a few problems | |||
geekosaur | build from source, but note that jvm is known broken | ||
broquaint | Aha, thanks for the heads up :) | 20:31 | |
geekosaur | there's ongoing work but it is prone to crash on things rakudo-m works on still | 20:32 | |
20:35
kaare__ left
20:36
Ven_ left
20:37
Ven_ joined
|
|||
stmuk | rakudo-j works well enough for simple short code examples but panda etc doesnt work | 20:37 | |
20:37
[particle] left
|
|||
tailgate | how do I check if an object has an attribute? | 20:40 | |
dogbert17 | o/ #perl6 | ||
20:41
zakharyas joined
20:43
BillSussman left
|
|||
jnthn | m: class C { has $.x }; say so C.^lookup('x'); say so C.^lookup('y') | 20:43 | |
camelia | rakudo-moar 8be36b: OUTPUT«TrueFalse» | ||
dogbert17 | m: my @a = [1,[2,3],4]; dd @a.duckmap({ $_ ~~ Int ?? $_ !! Any }) # this works well | ||
camelia | rakudo-moar 8be36b: OUTPUT«(1, (2, 3), 4)» | ||
dogbert17 | m: my @a = [1,[2,3],'a']; dd @a.duckmap({ $_ ~~ Int ?? $_ !! Any }) # this not so much | ||
camelia | rakudo-moar 8be36b: OUTPUT«Memory allocation failed; could not allocate 6296072 bytes» | 20:44 | |
timotimo | that somehow infinitely recurses | ||
20:44
espadrine joined
|
|||
dogbert17 | timotimo: yeah, it should work I guess | 20:45 | |
timotimo | yeah, i'd say it should | ||
dogbert17 | guess I'll rt then | 20:46 | |
20:46
TEttinger joined
20:47
zakharyas left
20:52
poohman joined
20:54
Ven_ left
|
|||
dogbert17 | done, rt.perl.org/Public/Bug/Display.html?id=129321 | 20:54 | |
tushar | I have a private method that I am calling in each public method. Is there any way I can call private method after the object creation automatically? | 20:55 | |
timotimo | you can do that in BUILD for example | 20:56 | |
moritz | or BUILDALL | ||
docs.perl6.org/language/objects#Ob...nstruction | |||
tushar | timotimo, I am not writing any custom BUILD method rather using the default BUILD method | 20:57 | |
20:59
CIAvash left
|
|||
tushar | timotimo, moritz, thanks. I will explore it. | 20:59 | |
21:01
poohman left
21:02
skids left
|
|||
tushar | what is "|" mean in BUILDALL(|)? Does it indicate Junction operator? | 21:02 | |
21:05
Ven_ joined
|
|||
vcv | | is a capture which gobbles up all remaining positional and named arguments | 21:06 | |
if those arguments arent going to be used, you dont have to name it, thus | instead of something like |c | |||
it also means BUILDALL(|) can accept any number of parameters of any type | 21:07 | ||
tushar | vcv: thanks | ||
21:07
itaipu left
21:08
itaipu joined,
girafe2 joined
21:11
girafe left
|
|||
gfldex | tushar: see docs.perl6.org/type/Signature | 21:11 | |
tushar | :gfldex thanks. | 21:13 | |
vcv | Yeah, the Capture Parameters section. I don't see anything about nameless parameters though.. maybe it's there under a different name/term | 21:14 | |
21:16
mcmillhj left
21:21
sufrostico joined
21:23
Ven_ left
21:27
itaipu left,
Ven_ joined
21:30
ufobat left
21:32
Ven_ left
21:34
itaipu joined
21:39
tushar left
21:41
setty1 left
21:44
mcmillhj joined
21:47
adu joined
21:49
mcmillhj left
21:52
bjz left,
bjz joined
21:55
mcmillhj joined,
rindolf left
|
|||
Woodi | so, here are some stats for Rakudo releases: gist.github.com/slunski/0c79c21557...70381e8bed | 21:59 | |
21:59
mcmillhj left
|
|||
Woodi | all that experiment tought me that Perl6 OO is quite stable since few years :) | 22:00 | |
22:05
mcmillhj joined
22:06
_sfiguser left
22:09
pmurias left
22:10
mcmillhj left
22:11
geraud joined
22:12
harmil_wk left
|
|||
El_Che | no regressions lately :) | 22:12 | |
timotimo | no ragrets | 22:15 | |
wiki.gnome.org/Outreachy/2016/Dece...anizations - it seems like Perl is already participating in outreachy; that's very cool | 22:17 | ||
could applicants potentially work on perl6 stuff? | |||
oh, the description reads TPF will sponsor an applicant to work on bugzilla | 22:18 | ||
22:19
baest_ joined,
_sfiguser joined
22:21
baest left,
mcmillhj joined
22:22
harmil_wk joined
22:27
mcmillhj left
|
|||
dylanwh | That is because that's what I can reasonably make time to mentor for. | 22:31 | |
timotimo | ah | 22:32 | |
thank you for mentoring, in any case! :) | |||
22:33
mcmillhj joined
|
|||
dylanwh | hopefully brings a new person to perl, and maybe a new person to perl6 afterwards. :-) | 22:34 | |
22:36
captain-adequate joined
|
|||
timotimo | that'd be cool | 22:36 | |
dylanwh | btw, I countered the person at mozilla that thought the whatever-star operator / fibonacci example was "line noise" with the CSS 2.1 parser, and the person was actually impressed by that grammar. | ||
22:36
skids joined
|
|||
dylanwh | so a small victory in mind share, maybe. | 22:37 | |
22:38
mcmillhj left
|
|||
timotimo | neat :) | 22:38 | |
the ... operator is fantastic | 22:40 | ||
i used it to great effect to follow a node's "parent" pointer from the target to the source in a graph that had a dijkstra path finding algorithm run over it | |||
dylanwh | I think there is literally something in people's mental model of programming that either makes them love symbols or hate symbols, with no inbetween. | 22:41 | |
timotimo | and the result of the ... was the list of nodes along the path | ||
dylanwh | it might have to do with exposure to maths notation | ||
timotimo | a friend of mine was astounded to see me switch from python to perl6 | ||
dataangel | My exposure to maths notation made me hate maths notation | ||
timotimo | what with python having a dearth of symbols and perl6 having the opposite :) | ||
22:42
firstdayonthejob left
|
|||
dataangel | In math pretty much no symbol has a consistent meaning | 22:42 | |
Instead of an easy-to-read name you get a Greek letter that tells you nothing without going back and referring to an earlier part of the paper | |||
22:43
Sgeo joined
|
|||
geekosaur | and even when there are consistent names, they're only consistent within one branch | 22:45 | |
timotimo | yeah | 22:47 | |
at least in perl6 symbols tend to keep their meaning and different things look different | 22:49 | ||
dataangel | Yeah math notation never gets executed so they never discover that they're being inconsistent | ||
timotimo | ipython notebooks (and by extension julia notebooks and some others) have made a nice dent in that issue | 22:51 | |
at one point there was a talk or article about "you can basically click one button to fire up an AWS instance that'll reproduce our results in a couple of hours or days" | |||
22:52
mcmillhj joined,
poohman joined
22:54
sufrostico left
22:57
mcmillhj left
22:59
lambd0x joined,
girafe2 left
|
|||
lambd0x | Hi everyone! | 22:59 | |
timotimo | hello lambd0x | 23:05 | |
lambd0x | timotimo: :D | ||
23:05
adu left
23:06
poohman left
23:13
RabidGravy left
|
|||
lambd0x | timotimo: do you know what does @array.grep uses internally for the search? I've just done some testing of finding an element on an array of ordered elems. sizing from 1,000 up to 15,000 using grep and compared it against a simple binary search and the second was significant better in time. tinyurl.com/zgc2lcq (codes), tinyurl.com/hrlx4v7 (results) | 23:18 | |
timotimo | well, grep will definitely not use binary search, because it's not guaranteed to have a sorted list to search through | 23:20 | |
lambd0x | timotimo: could we optimize grep by narrowing it down to cases? Such as for ascending, descending, etc...? | 23:23 | |
vcv | dylanwh: do you have a link to the CSS parser? | 23:26 | |
timotimo | definitely not | 23:27 | |
grep just goes through the list. if you want to figure out if the list is sorted, you also have to go through the whole list | |||
so finding out if the list is sorted or not is about as expensive as doing the grep itself | |||
23:27
mcmillhj joined
|
|||
lambd0x | timotimo: I see. thanks for explaining :). | 23:29 | |
vcv | You could, in theory, implement a SortedList object and write your own grep method for that | ||
23:32
mcmillhj left
|
|||
timotimo | also, sorting a list is eager, but perl6 gives you a lazy grep | 23:33 | |
lambd0x | vcv: I was thinking about that, but what timotimo said is true. Normally u wouldn't know if the array is or not already sorted and so, how to tell it otherwise than just checking it which will take its share of the time alonside with grep. | 23:34 | |
timotimo | if you already know it's sorted coming in, or you've done the work up front, use a module from the ecosystem that gives you binary search or something similar :) | ||
23:36
ka left
|
|||
vcv | i suppose binary search and grep dont fit together at all anyway -- maybe first, if given a known sorted list | 23:36 | |
actually that might not make sense either | 23:37 | ||
lambd0x | timotimo: the difference between eager and lazy lists is that the second just resolves the element when accessed? | ||
23:38
tushar joined
|
|||
timotimo | that's right | 23:38 | |
lambd0x | vcv: exactly :/ | ||
timotimo: thanks :) | |||
timotimo | grep gives you a list of items that match a predicate | ||
if you have a predicate like "is exactly 9", you can easily binary-search, because it gives you "greater than" or "less than" results | |||
but if your predicate is like "is a prime number" or "this field has a stone placed on it" or things like that ... not so much | 23:39 | ||
lambd0x | timotimo: that's interesting | 23:40 | |
23:42
mcmillhj joined
|
|||
lambd0x | oh another thing, if I wanted to use hashes with a different hashing function would that be let's say using OOP, or not even with such? | 23:43 | |
timotimo | i can't parse that sentence | 23:44 | |
lambd0x | sorry. Is possible in perl6 to use a different hashing function for hashes? | ||
timotimo | the hashing function used for built-in hashes is an implementation detail | 23:45 | |
but you can implement your own hashes using arrays and your own hashing function | |||
it'll also be kinda slow :) | |||
vcv | s: help | ||
SourceBaby | vcv, Something's wrong: ERR: ===SORRY!=== Error while compiling -eUndeclared routine: help used at line 6 | ||
lambd0x | I'm literally wanting to reinvent the road, yes I know ahahha | ||
vcv | s help | ||
lambd0x | timotimo: just for learning I think its worth :) | 23:46 | |
thanks. | |||
vcv | s: Hash, 'keys' | ||
timotimo | i'm going to bed, gnite! | ||
SourceBaby | vcv, Something's wrong: ERR: Type check failed in binding to &code; expected Callable but got Method+{<anon|74133312>} (Method+{<anon|7413331...) in sub do-sourcery at /home/zoffix/services/lib/CoreHackers-Sourcery/lib/CoreHackers/Sourcery.pm6 (CoreHackers::Sourcery) line 42 in sub sourcery at /home/zoffix/services/lib/CoreHackers-Sourcery/lib/CoreHackers/Sourcery.pm6 (CoreHackers::Sourcery) line 33 in block <unit> at -e line 6 | ||
lambd0x | timotimo: o/ | 23:47 | |
vcv | s: Hash | ||
SourceBaby | vcv, Something's wrong: ERR: Cannot resolve caller sourcery(Hash); none of these signatures match: ($thing, Str:D $method, Capture $c) ($thing, Str:D $method) (&code) (&code, Capture $c) in block <unit> at -e line 6 | ||
vcv | s: 'abs' | ||
SourceBaby | vcv, Something's wrong: ERR: Cannot resolve caller sourcery(Str); none of these signatures match: ($thing, Str:D $method, Capture $c) ($thing, Str:D $method) (&code) (&code, Capture $c) in block <unit> at -e line 6 | ||
timotimo | s: &abs | ||
SourceBaby | timotimo, Sauce is at github.com/rakudo/rakudo/blob/8be3...ric.pm#L46 | ||
vcv | thanks, i can never remember how to operate this bot | ||
23:48
mcmillhj left
|
|||
vcv | lambd0x: github.com/rakudo/rakudo/blob/8be3...re/Hash.pm Perl 6 Hash object, but its heavily using underlying nqp ops which makes it much faster than you could with pure Perl 6 | 23:48 | |
23:50
ka joined
|
|||
lambd0x | vcv: thanks u very much \o/ | 23:51 | |
23:52
mcmillhj joined
23:56
bjz left
|