»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg camelia perl6: ... | irclog: irc.perl6.org | UTF-8 is our friend! Set by sorear on 25 June 2013. |
|||
masak | `collect { for 1..3 -> $x { my $y = accept 1..3; my $z = accept 1..3; next if $x + $y + $z > 4; take "$x$y$z" }` # results in <111 112 121 211> | 00:01 | |
hm, that's not very convincing. | |||
in this case, it *could* be written as for loops :) | |||
trying again. | 00:02 | ||
the use case I had in mind for this was something like the following: | |||
`collect { my @result; for 1..$N -> $x { for 1..$N -> $y { @result[$x][$y] = accept some_calulated_alternatives() } }; take @result.clone }` | 00:03 | ||
maybe this helps: gather/take : coroutines :: collect/accept : backtracking | 00:05 | ||
00:09
BenGoldberg joined,
vendethiel left
|
|||
masak | in the case of `take` control flow *returns to the caller* for as long as the caller doesn't require the next one to be calculated. | 00:10 | |
in the case of `accept`, control flow *splits into several parallel universes* of computation, running them all separately, each with its own lexpad, stack, etc. | 00:11 | ||
00:12
xenoterracide left,
rindolf joined
|
|||
TimToady | if it's parallel, it's not backtracking; sounds like a race to me | 00:12 | |
00:12
xenoterracide joined
|
|||
TimToady | and gather/take can already handle the backtracking in a lazy context | 00:13 | |
masak | hm, I meant parallel more in the sense of "aside each other". | ||
00:13
btyler left
00:14
avuserow left
|
|||
masak | but yeah, I guess there's nothing to prevent them from actually running in parallel, as long as the results come out in the expected order. | 00:14 | |
a bit like hyper. | |||
I'm currently trying to make my code work with gather and some recursion. | 00:15 | ||
TimToady | anyway, I think STD has demonstrated that lazy lists are already sufficient for backtracking, so this would need to enable something more | ||
logic variables, or some such | |||
"here's the constraints, please solve" | 00:16 | ||
00:17
xenoterracide left
|
|||
TimToady | and presumably return solutions lazily | 00:17 | |
masak | *nod* | ||
anyway, I'm not suggesting anything should be added to the language/spec as such. | |||
this is a perfect example of something that should be experimented with in module space. | 00:18 | ||
...but I do note how often I end up inventing nice features that end up depending on CPS transform :> | |||
if I make it to YAPC::EU this year, my submitted talk will be about CPS transforms :) | 00:19 | ||
colomon | Carsonville - Port Saniliac? | 00:27 | |
colomon decides that is unlikely and backlogs | |||
00:27
avuserow joined
|
|||
TimToady | cycles per second, obviously :) | 00:27 | |
masak | colomon: "Continuation Passing Style" | 00:30 | |
colomon | masak++ | ||
masak | colomon: basically, treating control flow as a first-class entity. | ||
00:39
Pleiades` left
00:40
raiph left
00:43
Pleiades` joined
|
|||
colomon | jnthn: rakudo commit 408ebb9738d468cb996a8b70ea9eae4629a5b1a7 is the one that broke panda on moar. (Unsurprising, I suppose. But I confirmed it just to be sure.) | 00:50 | |
00:52
carlin left
01:19
dayangkun left
|
|||
masak | 'night, #perl6 | 01:23 | |
colomon | \o | 01:24 | |
01:27
bjz left
01:31
skids left,
FROGGS left
01:32
beastd left
01:33
Su-Shee left
01:34
Su-Shee joined
01:38
klapperl_ left
01:39
bjz joined
01:40
klapperl joined
01:41
risou is now known as risou_awy
01:45
FROGGS joined
01:46
skids joined
02:04
risou_awy is now known as risou
02:37
dwarring left
02:38
xragnar_ joined,
xragnar is now known as Guest47065,
xragnar_ is now known as xragnar
02:41
Guest47065 left
02:42
BenGoldberg left
02:43
BenGoldberg joined
|
|||
BenGoldberg | .tell masak Your "accept" operator sounds a lot like the "amb" nondeterministic choice operator. Take a look at <rosettacode.org/wiki/Amb#Perl>, in particular the first perl5 solution. | 02:43 | |
yoleaux | BenGoldberg: I'll pass your message to masak. | ||
TimToady | I believe he mentioned amb, in fact | 02:44 | |
02:44
btyler joined
|
|||
BenGoldberg | Oh, nevermind then. | 02:44 | |
:) | 02:45 | ||
03:00
hoverboard joined
03:03
rurban left
03:14
rurban joined
03:30
molaf joined
03:32
sivoais left
03:33
sivoais joined
03:40
sivoais left
03:43
sivoais joined
|
|||
avuserow | (re Proxy sugar) I'd love to add something like smls++'s idea to Audio::Taglib::Simple. And certainly makes sense to try that in module-space first (or exclusively) | 03:47 | |
03:55
bjz left
04:04
rurban left
04:07
BenGoldberg left
04:13
bjz joined
04:20
rindolf left
04:35
rurban joined
04:40
rurban left
04:50
sivoais left
04:55
sivoais joined
04:57
Guest9496 is now known as ponbiki
05:01
btyler left
05:24
telex left
05:26
telex joined
05:36
rurban joined
05:41
rurban left
05:47
SamuraiJack joined
05:52
SamuraiJack left
05:58
Rotwang joined
06:04
virtualsue joined
06:09
mikegrb joined
06:11
kaare_ joined
06:13
hoverboard left
06:16
darutoko joined
06:25
zengargoyle left
06:37
rurban joined
06:41
rurban left
06:54
virtualsue left
07:03
itz joined
07:11
Timbus joined
07:13
virtualsue joined,
virtualsue left
07:38
brrt joined,
rurban joined
07:43
rurban left
07:45
bjz_ joined
07:48
bjz left
08:16
vendethiel joined
08:21
SevenWolf joined
08:29
mr-foobar joined
08:39
rurban joined
08:43
rurban left
|
|||
masak | antenoon, #perl6 | 08:48 | |
yoleaux | 02:43Z <BenGoldberg> masak: Your "accept" operator sounds a lot like the "amb" nondeterministic choice operator. Take a look at <rosettacode.org/wiki/Amb#Perl>, in particular the first perl5 solution. | ||
masak | yes, it might very well be the same as "amb". | ||
biggest difference is that "amb" isn't scoped, but you'd have to scope an "accept" inside of a "collect". | |||
08:54
itz left
08:55
SamuraiJack joined
09:08
itz joined
09:11
spider-mario joined
09:24
denis_boyun_ joined
09:26
thou left
09:28
denis_boyun_ left
09:38
denis_boyun joined
09:40
rurban joined
09:45
rurban left
09:47
Psyche^ joined
09:51
Psyche^_ left
09:54
vendethiel left
10:01
hoverboard joined
10:07
SevenWolf left
10:08
vendethiel joined
10:32
SamuraiJack_ joined
10:33
SamuraiJack left
10:37
brrt left
10:41
rurban joined
10:45
rurban left
10:50
thou joined
10:51
SamuraiJack_ left
10:53
jack_rabbit left
10:54
thou left
10:56
FROGGS[mobile] left,
pdcawley left
10:57
pdcawley joined,
FROGGS[mobile] joined
|
|||
FROGGS | hehe, three answers within five minutes :o) | 11:00 | |
(#perl6)++ # p6u | |||
jnthn | :) | 11:06 | |
timotimo | we're all right | 11:08 | |
colomon | o/ | ||
11:09
itz left,
hoverboard left
|
|||
FROGGS | jnthn: I have a nice problem when switching to a slang btw | 11:11 | |
jnthn: when I want to say the match, like in a token: .* { say $/ }, I get: | 11:12 | ||
Cannot find method 'substr': no method cache and no .^find_method | |||
though I can .DUMP the match, and it looks fine | |||
I can also do: say $/.orig.substr($/.orig.from, ...), which is the same as the code that explodes in the setting | 11:13 | ||
I guess that the creation of the cursor in FOREIGN_LANG is to blame... but I'm not sure | 11:14 | ||
jnthn | FROGGS: Might be that you're getting a NQP string leaking out | 11:17 | |
11:39
denis_boyun left
11:42
rurban joined
11:46
rurban left
|
|||
FROGGS | my $s := nqp::findmethod(self, 'orig')(self); say nqp::isstr $s | 11:47 | |
1 | |||
\o/ | |||
jnthn++ | |||
now I just need to fix it :o) | |||
12:00
cibs left
12:05
cibs joined
12:27
brrt joined
12:38
thou joined
12:42
thou left
12:43
rurban joined
12:47
rurban left
13:00
xinming_ joined
13:04
xinming left
13:18
mr-foobar left,
guru joined
13:19
guru is now known as Guest7761,
Guest7761 is now known as ajr_
13:20
mr-foobar joined
13:25
vendethiel left
13:33
anaeem1 joined
13:37
anaeem1 left
13:44
rurban joined
13:45
xenoterracide joined
13:47
SHODAN left,
lizmat_ is now known as lizmat
13:48
SHODAN joined,
rurban left
13:52
vendethiel joined,
vendethiel left
14:06
rurban joined
14:10
zakharyas joined
14:26
thou joined
14:31
thou left
14:36
Rotwang left
14:37
chenryn left,
chenryn joined
14:43
bjz_ left
14:44
bjz joined
|
|||
masak | I have a feeling that running `prove -e perl6` isn't so good for optimization. | 14:48 | |
because the runtime needs to start afresh with each new test file, even though the implementation code tested is the same all the time. | 14:49 | ||
info pertinent to good optimization doesn't carry over from .t file to .t file | |||
14:51
thou joined
|
|||
moritz | it would be much better if it automatically precompiled and cached those files | 14:52 | |
masak | sure. | 14:53 | |
but that still doesn't adress JITting. | 14:54 | ||
colomon++ commented here: github.com/perl6/specs/commit/ca66...nt-6594349 | |||
colomon | \o | ||
masak | I'm not sure either what to do with the wording. someone is welcome to give it a second go. | ||
I just copy-pasted a paragraph from infix:</> without any changes. | 14:55 | ||
14:55
zengargoyle joined
|
|||
masak | if this one needs changing, maybe the original does, too. | 14:55 | |
colomon | that explains the oddity. ;) | ||
no | |||
no! | |||
well… maybe | |||
but it never makes sense for / to return an Int, and it certainly makes sense for % to return one. | 14:56 | ||
moritz | for a % of fractions? | 14:57 | |
14:57
kurahaupo joined
|
|||
moritz | not more than a / of fractions, IMHO | 14:57 | |
colomon | Int / Int should return Rat (or Num) | ||
Int % Int should return Int always | |||
Rat % Rat should probably return Rat (or Num) | 14:58 | ||
moritz | agreed | ||
% isn't diffy at all | |||
colomon | FatRat % FatRat should be a FatRat | ||
colomon has a 5 year old begging him to bake sugar cookies. | |||
moritz | it's curious how persuasive children can be, no? :-) | 14:59 | |
colomon | when he's climbing on my back it certainly makes it hard to ignore him | ||
masak | I think Rat % Rat should return Rat, not Num | 15:00 | |
at least I can't see a case where it'd have to be Num | |||
colomon | masak: it's there | 15:02 | |
I thought about it carefully this morning. :) | |||
essentially it boils down to Rat + Rat, and that definitely can return a Num | |||
m: say 1/5 % 1/7 | 15:03 | ||
camelia | rakudo-moar 28d672: OUTPUT«0.0285714285714286» | ||
colomon | m: say (1/5 % 1/7).perl | ||
camelia | rakudo-moar 28d672: OUTPUT«0.0285714285714286e0» | ||
colomon | :( | 15:04 | |
n: say (1/5 % 1/7).perl | |||
camelia | niecza v24-109-g48a8de3: OUTPUT«<1/35>» | ||
moritz | % is like /, except that it also subtracts stuff aftewards | ||
masak | but Rat - Rat returns a Rat, no? | ||
moritz | so the denominator can grow, and thus overflow the magical 64 bit limit | ||
masak | ok, fairynuff | ||
moritz | I think Rat - Rat can also overflow | 15:05 | |
masak | yes | ||
because subtraction is addition of something of opposite sign | |||
so, "most of the time" it should return a Rat | |||
15:05
vendethiel joined
|
|||
colomon | n: say ((1/5) % (1/7)).perl | 15:05 | |
camelia | niecza v24-109-g48a8de3: OUTPUT«<2/35>» | ||
moritz | p6: my $large = 2**62; my $d = 1/$lage - (1/($large - 1)); say $d; say $d.WHAT | 15:06 | |
camelia | rakudo-{parrot,jvm,moar} 28d672: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfileVariable '$lage' is not declared. Did you mean '$large'?at /tmp/tmpfile:1------> my $large = 2**62; my $d = 1/$lage⏏ - (1/($large - 1)); say $d; say $d…» | ||
..niecza v24-109-g48a8de3: OUTPUT«===SORRY!===Variable $lage is not predeclared at /tmp/tmpfile line 1:------> my $large = 2**62; my $d = 1/⏏$lage - (1/($large - 1)); say $d; say $Unhandled exception: Check failed at /home/…» | |||
moritz | p6: my $large = 2**62; my $d = 1/$large - (1/($large - 1)); say $d; say $d.WHAT | ||
camelia | rakudo-jvm 28d672: OUTPUT«-4.70197740328915E-38(Num)» | ||
..rakudo-{parrot,moar} 28d672: OUTPUT«-4.70197740328915e-38(Num)» | |||
..niecza v24-109-g48a8de3: OUTPUT«-4.70197740328915E-38Num()» | |||
colomon | n: say ((1/(2**62)) % (1/(-1+2**62))).perl | ||
camelia | niecza v24-109-g48a8de3: OUTPUT«0.00000000000000000021684043449710088680149056017398834228515625» | ||
15:10
skids left
15:14
skids joined,
Alula_ left
15:16
pdurbin left,
mls left,
jnthn joined,
Rotwang joined,
mls joined,
rhr joined,
isacloud__ joined,
pnu joined
15:17
pdurbin joined
15:18
guru joined,
guru is now known as Guest33342
15:21
ajr_ left
15:22
skids left
15:23
cognominal__ joined
|
|||
dalek | ecs: 5cad811 | (Konrad Borowski)++ | S03-operators.pod: Int % Int should give Int, not Rat. |
15:23 | |
xfix | I tried improving it slightly. | ||
Except it still doesn't handle `FatRat` properly. | 15:24 | ||
15:24
skids joined
15:26
cognominal left
15:29
Rotwang left,
Rotwang joined
15:30
cognominal__ left,
rindolf joined
15:36
Alula_ joined
15:41
mls left,
mls joined
15:42
isacloud__ left,
isacloud__ joined,
pnu left,
pnu joined
|
|||
[Coke] | CPS is obviously "Cookies per Second" (cookieclicker) | 15:42 | |
colomon and son now have a batch of sugar cookie dough cooling in the fridge | 15:44 | ||
colomon hopes this turns out better than every single time I've tried to make sugar cookies before. :) | 15:53 | ||
15:55
cognominal joined
|
|||
masak | [Coke]: I like that. | 15:57 | |
[Coke]: I'll try to remember that for my endangered YAPC::EU talk. | |||
16:11
dmol joined
16:20
nebuchadnezzar left
16:22
Serpent7776 joined
16:23
molaf left
16:25
guru joined,
Guest33342 left
16:26
guru is now known as Guest26641,
Guest26641 is now known as ajr_
|
|||
cognominal | r: say(nqp::eqaddr((class A {}), Nil)) | 16:31 | |
camelia | rakudo-{parrot,jvm,moar} 28d672: OUTPUT«0» | ||
cognominal | n: say(nqp::eqaddr((class A {}), NQPMu)) | 16:32 | |
camelia | niecza v24-109-g48a8de3: OUTPUT«===SORRY!===Undeclared name: 'NQPMu' used at line 1Unhandled exception: Check failed at /home/p6eval/niecza/boot/lib/CORE.setting line 1502 (die @ 5)  at /home/p6eval/niecza/src/STD.pm6 line 1147 (P6.comp_un…» | ||
cognominal | nqp: say(nqp::eqaddr((class A {}), NQPMu)) | ||
camelia | nqp-{moarvm,parrot}: OUTPUT«1» | ||
..nqp-jvm: OUTPUT«(signal )## There is insufficient memory for the Java Runtime Environment to continue.# pthread_getattr_np» | |||
16:33
ajr_ left
|
|||
cognominal | How do I test class equality in nqp? | 16:34 | |
16:34
brrt left
|
|||
cognominal | nqp::eqaddr does not cut it. | 16:35 | |
16:35
ajr joined,
ajr is now known as Guest50252
16:36
Guest50252 is now known as ajr_,
molaf joined
|
|||
cognominal | or more likely (class A {}) does not return A | 16:37 | |
nqp: class A {}; say(nqp::eqaddr(A, NQPMu)) | 16:39 | ||
camelia | nqp-jvm: OUTPUT«(signal )## There is insufficient memory for the Java Runtime Environment to continue.# pthread_getattr_np# An error report file with more information is saved as:# » | ||
..nqp-{moarvm,parrot}: OUTPUT«0» | |||
cognominal | indeed | ||
16:42
bjz left
16:58
carlin joined,
thou left
16:59
nebuchadnezzar joined
17:02
brrt joined
17:10
brrt left
17:22
rurban left
17:23
robinsmidsrod left,
mtj left,
woosley left,
synopsebot left,
colomon left
17:24
colomon joined,
woosley joined,
robinsmidsrod joined
17:25
mtj joined,
synopsebot joined
17:27
ajr_ left
17:38
ren1us joined
|
|||
ren1us | is there any particular reason why i wouldn't be able to have a list of lists? | 17:39 | |
colomon | it's a datastructure, LoL | 17:40 | |
ren1us | so? still an object | 17:41 | |
at least i assume so | |||
because it looks like my sublists are all getting flattened together when i try to access elements | |||
vendethiel | ren1us: you can have one, you just need to itemize them | ||
or something, it looks like nobody's actually able to tell me what is happening or, more importantly, why it's happening | 17:42 | ||
timotimo | or have a list of arrays | 17:43 | |
or an array of arrays | |||
m: my @a; @a[1][1] = "hi!"; say @a.perl | |||
camelia | rakudo-moar 28d672: OUTPUT«Array.new(Any, [Any, "hi!"])» | ||
jnthn | ren1us: How are you constructing it? | ||
m: my @a = [1,2], [3,4]; say @a[1] | 17:44 | ||
camelia | rakudo-moar 28d672: OUTPUT«3 4» | ||
ren1us | this is probably a syntactical calamity that i should be ashamed of even thinking of, but: | ||
my @rules = (<visited pt1>, <goal pt1>) => (<finished>), (<visited pt1>, <adjacent pt2>, <not, visited, pt2>) => (<visited, pt2>); | |||
if i say @rules, i get something that looks like the proper structure. but if i just do @rules[0], i get "visited" | 17:45 | ||
timotimo | accessing the list will cause its flattening rules to become active | ||
you could say: | |||
you have activated my trap card! mwahahahaha | |||
i'm kind of surprised it would flatten through the pair, though | 17:46 | ||
m: my @test = ("hey", "how") => "are", "you"; say @test.perl; say @test[0]; | |||
camelia | rakudo-moar 28d672: OUTPUT«Array.new($("hey", "how") => "are", "you")$("hey", "how") => "are"» | ||
ren1us | o.O looks like my install's doing bizarre things again | 17:47 | |
timotimo | huh, can you try to golf it down to a simple one-line piece of code that breaks for you locally and works in the evalbot? | ||
that would be quite interesting | |||
xfix | Could Perl 6 grammars be used to make a syntax highlighter? That could be interesting use of them. | 17:48 | |
timotimo | in theory, of course it could | ||
xfix | (but this probably would be too strict for dealing with invalid code) | ||
timotimo | however, syntax highlighters benefit greatly from ... yes | ||
i wonder how one could build a ruby slippers parser with grammars | 17:49 | ||
that would probably be a quite fantastic module to have | |||
though to be honest i don't have any experience with using any of those | |||
xfix | It would be fun to have Perl 6 grammar to parse grammars (like ANTLR) that parse programs. | ||
And there is grammar for Perl 6 grammars in STD.pm6 too, so it's even better. | 17:50 | ||
17:53
rurban joined
|
|||
ren1us | p: my @rules = (<test line>, <another test>, <yay>) => "sup", "bleh"; say @rules[0]; | 17:54 | |
camelia | rakudo-parrot 28d672: OUTPUT«$(("test", "line"), ("another", "test"), "yay") => "sup"» | ||
ren1us | just gives me "test" locally | ||
17:55
rurban1 joined
|
|||
ren1us | of course, this is the same install that yells at panda, saying it can't find $*EXECUTABLE or something | 17:55 | |
so i hesitate to trust it | |||
17:55
dmol left
17:57
rurban left,
dmol joined
|
|||
ren1us | p: my @rules = (<test line>, <another test>, <yay>) => "sup", "bleh"; say @rules[0].key; | 17:57 | |
camelia | rakudo-parrot 28d672: OUTPUT«test line another test yay» | ||
ren1us | well that's actually really unfortunate | 17:58 | |
timotimo | m: say $*PERL | 17:59 | |
camelia | rakudo-moar 28d672: OUTPUT«Perl 6» | ||
17:59
rurban1 left
|
|||
timotimo | m: say $*VM; | 17:59 | |
camelia | rakudo-moar 28d672: OUTPUT«moar (2014.5.18.g.6.b.19.b.4.b)» | ||
timotimo | why the many dots there? o_O | ||
ren1us: what does perl6 --version look like? | 18:00 | ||
This is perl6 version 2014.05-138-g609fb8f built on MoarVM version 2014.05-15-gcdf5c71 | |||
is mine, for reference | |||
ren1us | This is perl6 version 2014.01 built on parrot 5.9.0 revision 0 | 18:01 | |
which should be blatantly wrong | |||
ATH=$PATH:$HOME/.perl6/rakudo-star-2014.04/install/bin <--- taken from my ~/.bashrc | 18:02 | ||
PATH=* | |||
timotimo | well what does "which perl6" say? | ||
ren1us | ah, i never removed my old version from like... january | 18:03 | |
/usr/local/rakudo-star-2014.01/install/bin/perl6 | |||
there we go, fixed everything | 18:05 | ||
timotimo | why was that wrong in january? o_O | 18:06 | |
ren1us | it probably was just a hiccup on my end then too | 18:07 | |
18:07
rindolf left
|
|||
timotimo | well, i don't recall things being very strange that late | 18:09 | |
i've been around for ~1.5 years and rakudo has always been pretty good | |||
what you found there seems like a pretty big problem | |||
ren1us | i find that most simple things i do tend to turn out weird | 18:10 | |
timotimo | you're very valuable, in that case :) | 18:11 | |
to us, that is | |||
you, on the other hand, will be annoyed quite a bit :D | |||
ren1us | it's okay, i'm usually annoyed anyway | ||
18:12
zakharyas left
|
|||
cognominal | I am making a branch to make nqp more palatable for the newcomer. Tested only on moar with the nqp test suit so far. github.com/cognominal/nqp/commits/...model-info | 18:16 | |
ren1us | well, not everything works. still can't bootstrap panda | 18:18 | |
18:25
jsn_ joined
|
|||
colomon | ren1us: wait, what can't bootstrap panda? | 18:32 | |
18:32
brrt joined
|
|||
colomon | ren1us: the bleeding edge latest Rakudo-moar is broken and cannot bootstrap panda, if that's what you're trying to do. | 18:33 | |
ren1us | pastebin.com/HuctLHLg | 18:35 | |
colomon | If that's the case, going back to Rakudo's 9644b265bba2d54900e0ce59a3376eeadfdb43f2 commit works. | ||
]oh, no, that's a completely different error than the one I've been getting | |||
ren1us: is that the panda that came with that r*? | 18:37 | ||
18:37
guru joined,
guru is now known as Guest73462
18:38
Guest73462 is now known as ajr_
|
|||
ren1us | no, it's the panda that comes from cloning the git repo | 18:38 | |
colomon | oh, panda latest probably isn't compatiable with r* from April anymore | ||
there's a tag in panda's git for the last version that would work with that. | |||
I think this is it? github.com/tadzik/panda/releases/tag/2014.04 | 18:39 | ||
ren1us | i'll check it in a moment, trying to hunt down where something's sneaking into my $PATH | 18:41 | |
colomon | www.concertwindow.com/shows/6736-p...o-festival # probably not our pmichaud ;) | 18:52 | |
18:59
hoverboard joined
|
|||
ren1us | colomon: worked perfectly | 18:59 | |
colomon | \o/ | 19:00 | |
19:02
darutoko left
|
|||
ren1us | m: my $pair = (<this is>, <a list>, <of four>, <sublists>) => "Or is it?"; say $pair.key; | 19:03 | |
camelia | rakudo-moar 28d672: OUTPUT«this is a list of four sublists» | ||
ren1us | is there a good way to do that without having the key list flattened? | ||
jnthn | [<this is>], [<a list>], ... | 19:04 | |
Or (<this is>, <a list>, <of four>, <sublists>).tree => "Or is it?" | 19:05 | ||
ren1us | oh wow, those both work. that's awesome. | 19:08 | |
jnthn | phew, I didn't try them before suggesting... :) | 19:09 | |
ren1us | i'm curious. what do .tree and the extra []s do? | ||
just flag it as "Don't flatten me, I like being complicated!"? | 19:10 | ||
masak | [] is an array constructor | 19:11 | |
.tree (as far as I grok it) takes parcels and makes arrays out of them, recursively | |||
jnthn | The key to it is that there are items and lists, and items never flatten and lists do - unless you use soemthing like .tree which enforces a context where they won't. [...] says "I want an array, and I mean it as a single item". | 19:16 | |
19:17
vendethiel left
|
|||
ren1us | so something like [<hello world>] is making an array of a list so the list has a buffer between itself and the parent list and doesn't get assimilated into the collective? | 19:18 | |
masak | right. the <> are only there to get you the list-quoting environment. | 19:20 | |
jnthn | A better way to understand it is that when you write "my $a = 42" then $a is a Scalar container and it holds a 42. [<hello world>] makes an array and puts it in a container. | ||
masak | the [] take care of non-flattening/item context. | ||
jnthn | It's really all about scalars | ||
19:21
jsn_ left
|
|||
masak | like Rust's `mut` keyword. | 19:21 | |
jnthn | [<hello world>] is really like Array.new(<hello world>).item which is really like (my $anon = Array.new(<hello world>) | ||
) | |||
At the end of the day, in a context where something might flatten, the question is always "is it in a scalar"? If yes, it won't flatten. | 19:22 | ||
It's a relatively simple rule at the heart of it. Just means learning which things give you items. [...] is one of those things that does. | 19:23 | ||
ren1us | the reasoning makes sense, but the use of an array to fake it just feels kinda dirty | ||
jnthn | It's not the array that matters, really...it's the item. It's just that [<a b>] is nice to type :) | 19:24 | |
masak | <a b>.item would work too, I guess. | ||
jnthn | r: my @a = <a b>.item, <c d>.item; say @a[1] | ||
camelia | rakudo-{parrot,jvm,moar} 28d672: OUTPUT«c d» | ||
jnthn | Right. | ||
masak | right. | ||
jnthn | hey. :P | ||
19:25
vendethiel joined
|
|||
masak | quantum entanglement. it happens, on #perl6. | 19:26 | |
ren1us | that feels much cleaner. i might just add a postfix operator to call .item or something | 19:29 | |
masak | r: sub postfix:<!>(@list) { @list.item }; say (<this is>!, <a list>!, <of four>!, <sublists>!).perl | 19:36 | |
camelia | rakudo-{parrot,jvm,moar} 28d672: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfileCalling 'postfix:<!>' will never work with argument types (str) Expected: :(@list)at /tmp/tmpfile:1------> is>!, <a list>!, <of four>!, <sublists>⏏[3…» | 19:37 | |
19:37
Serpent7776 left
|
|||
masak | oh, right. | 19:37 | |
r: sub postfix:<!>(\list) { list.item }; say (<this is>!, <a list>!, <of four>!, <sublists>!).perl | |||
camelia | rakudo-{parrot,jvm,moar} 28d672: OUTPUT«($("this", "is"), $("a", "list"), $("of", "four"), "sublists")» | ||
jnthn | hehe...it even caught your opertor mis-use at compile time there :D | 19:39 | |
19:41
Serpent7776 joined
|
|||
masak | yes :) | 19:43 | |
19:46
zakharyas joined
19:50
thou joined
19:57
rurban joined
|
|||
vendethiel | m: sub postfix:<$>(\list) { list.item; }; say (<this is>$, <a list>$, <of four>$, <sublists>$).perl | 19:57 | |
camelia | rakudo-moar 28d672: OUTPUT«($("this", "is"), $("a", "list"), $("of", "four"), "sublists")» | ||
vendethiel | $()-ish | ||
timotimo | yeah, postfix dereferencing is in perl5 now | 19:58 | |
19:59
hoverboard is now known as moistcherry
20:01
rurban left
20:02
kaare_ left
|
|||
zengargoyle | what is `\list`? a form of sigilless variable or some sort of capture/parcel/whatever thing? | 20:02 | |
timotimo | sigil-less variable | 20:04 | |
it's meant to signify "neither list nor item semantics are applied, if they weren't there before" | |||
20:04
brrt left
|
|||
timotimo | if you put something into a $var, you'll get it turned into a scalar container if it isn't one; if you put something into a @var, it'll be turned into a flattening container type of thing | 20:04 | |
if you use \, you'll get whatever is on the right side of the = | 20:05 | ||
zengargoyle | cool, gotcha. i've seen it a few times in places and sorta guessed that's what it was. | ||
timotimo | it's also a nice way to have mathematical formulas look nicer | 20:06 | |
m: my \ℕ = (1, 2, 3); say ℕ | |||
camelia | rakudo-moar 28d672: OUTPUT«1 2 3» | ||
20:10
Serpent7776 left
20:11
carlin left,
Serpent7776 joined
20:14
haroldwu left
20:20
pippo joined
|
|||
pippo | o/ #perl6 | 20:20 | |
timotimo | hey there pippo | ||
pippo | Some one can direct me on how to use the when construct? | ||
vendethiel | pippo: when is basically `if $_ ~~` | 20:21 | |
pippo | vendethiel: Thsnk you very much! | 20:22 | |
vendethiel: Thank you very much! | |||
timotimo | combines well with things that set $_ ("contextualizers") like for, CATCH, given, ... | ||
jnthn | m: my $does-pippo-know-how-when-works = 'no'; given $does-pippo-know-how-when-works { when 'yes' { say 'good, go drink' }; when 'no' { say 'look, like this!' } } | 20:23 | |
camelia | rakudo-moar 28d672: OUTPUT«look, like this!» | ||
jnthn | m: my $does-pippo-know-how-when-works = 'yes'; given $does-pippo-know-how-when-works { when 'yes' { say 'good, go drink' }; when 'no' { say 'look, like this!' } } | ||
camelia | rakudo-moar 28d672: OUTPUT«good, go drink» | ||
20:23
carlin joined
20:24
carlin is now known as Guest36329
20:25
btyler joined
|
|||
timotimo | and it also combines well with succeed and proceed | 20:25 | |
vendethiel hasn't done perl 6 in a while now ... | |||
cognominal can't figure out what is nqp::p6bindattrinvres | |||
vendethiel but has convinced his internship ... "manager" ? to take a look | |||
jnthn | colomon: What it says :D | 20:26 | |
oops | |||
cognominal: ^^ | |||
bind attribute, and take the invocant as the result :) | |||
nqp::bindattr(...) evaluates to the bound value rather than the invocant. | |||
20:27
Guest36329 left
|
|||
jnthn | bindattrinvres is mostly used to get nicer code-gen on some hot paths without introducing a temporary var. | 20:27 | |
And makes the code look nicer too | |||
cognominal | thanx | ||
20:27
Rotwang left
|
|||
pippo | jnthn: thank you for the example :-). Is there the possibility to have a when that is matched if all previous are not? | 20:27 | |
jnthn | default { } | 20:28 | |
pippo | TY! | ||
20:29
carlin_ joined
|
|||
carlin_ | NativeCall on the JVM doesn't seem to like trait_mod:<is>(&foo, :native('libfoo')); hackery | 20:30 | |
works fine on moar though | 20:31 | ||
timotimo | carlin_: perhaps it needs to go into a BEGIN block? | 20:40 | |
jnthn | Probably tells us there's some r-j bug, though... | ||
20:41
moistcherry left
20:42
ren1us left
|
|||
carlin_ | dies in a BEGIN block too | 20:48 | |
it works with sub foo is native(...); but with trait_mod:<is> it dies with "This representation can not unbox another" | 20:49 | ||
20:49
ivanshmakov left,
zakharyas left
20:52
ivanshmakov joined
20:54
ivanshmakov left,
ivanshmakov joined,
ajr_ left
20:59
raiph joined
|
|||
raiph | .tell xfix I'm trying to encourage a little cleanup of gh/perl6; github.com/perl6/bench-scripts; last update by xfix 1 year ago; does it make sense to move scripts into japb/perl6-bench then delete repo? if so, would you be willing to do that? | 21:05 | |
yoleaux | raiph: I'll pass your message to xfix. | ||
xfix | I don't care bench-scripts anyway. That was a random change to make them work in newest releases. | 21:06 | |
yoleaux | 21:05Z <raiph> xfix: I'm trying to encourage a little cleanup of gh/perl6; github.com/perl6/bench-scripts; last update by xfix 1 year ago; does it make sense to move scripts into japb/perl6-bench then delete repo? if so, would you be willing to do that? | ||
xfix | I doubt that anyone works on these now. | ||
I just fixed the script to be able to compare the performance of Perl 6 1.5 years before. I doubt they work now. | 21:07 | ||
raiph | do you have privs to remove that repo? | ||
xfix | I don't. | ||
raiph | thx | ||
xfix | Only the last commit was my work. | ||
raiph | .tell pmichaud I'm trying to encourage a little cleanup of gh/perl6; please delete github.com/perl6/bench-scripts, /reports, and /nqpbook (for a bit more detail see questhub.io/realm/perl/quest/53457...d24e00006d and irclog.perlgeek.de/perl6/2014-06-08#i_8840143) | 21:10 | |
yoleaux | raiph: I'll pass your message to pmichaud. | ||
raiph | .tell moritz I'm trying to encourage a little cleanup of gh/perl6; please search for 'moritz' in questhub.io/realm/perl/quest/53457...d24e00006d TIA | 21:11 | |
yoleaux | raiph: I'll pass your message to moritz. | ||
21:28
spider-mario left
21:40
xenoterracide left,
xenoterracide joined
21:52
molaf left
22:00
xenoterracide left
22:18
kst joined
22:36
BenGoldberg joined
22:50
carlin_ left
23:02
btyler left
23:07
hoverboard joined
23:11
hummeleB1 joined
23:12
vendethiel left
23:18
raiph left
23:22
BenGoldberg left
23:25
BenGoldberg joined
23:26
kurahaupo left
23:30
dmol left
23:38
Serpent7776 left
23:42
haroldwu joined
23:44
breinbaas joined
23:51
haroldwu left,
haroldwu joined,
hoverboard left
23:53
SevenWolf joined
|