Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2014-06-08

Perl 6 | Reference Documentation | Rakudo

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

All times shown according to UTC.

Time Nick Message
00:01 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 masak hm, that's not very convincing.
00:01 masak in this case, it *could* be written as for loops :)
00:02 masak trying again.
00:02 masak the use case I had in mind for this was something like the following:
00:03 masak `collect { my @result; for 1..$N -> $x { for 1..$N -> $y { @result[$x][$y] = accept some_calulated_alternatives() } }; take @result.clone }`
00:05 masak maybe this helps: gather/take : coroutines :: collect/accept : backtracking
00:09 BenGoldberg joined #perl6
00:10 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:11 masak 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:12 rindolf joined #perl6
00:12 TimToady if it's parallel, it's not backtracking; sounds like a race to me
00:12 xenoterracide joined #perl6
00:13 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:14 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 masak a bit like hyper.
00:15 masak 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
00:15 TimToady logic variables, or some such
00:16 TimToady "here's the constraints, please solve"
00:17 TimToady and presumably return solutions lazily
00:17 masak *nod*
00:17 masak anyway, I'm not suggesting anything should be added to the language/spec as such.
00:18 masak this is a perfect example of something that should be experimented with in module space.
00:18 masak ...but I do note how often I end up inventing nice features that end up depending on CPS transform :>
00:19 masak if I make it to YAPC::EU this year, my submitted talk will be about CPS transforms :)
00:27 colomon Carsonville - Port Saniliac?
00:27 * colomon decides that is unlikely and backlogs
00:27 avuserow joined #perl6
00:27 TimToady cycles per second, obviously :)
00:30 masak colomon: "Continuation Passing Style"
00:30 colomon masak++
00:30 masak colomon: basically, treating control flow as a first-class entity.
00:43 Pleiades` joined #perl6
00:50 colomon jnthn: rakudo commit 408ebb9738d468cb996a8b70ea9eae4629a5b1a7 is the one that broke panda on moar.  (Unsurprising, I suppose.  But I confirmed it just to be sure.)
01:23 masak 'night, #perl6
01:24 colomon \o
01:34 Su-Shee joined #perl6
01:39 bjz joined #perl6
01:40 klapperl joined #perl6
01:45 FROGGS joined #perl6
01:46 skids joined #perl6
02:38 xragnar_ joined #perl6
02:43 BenGoldberg joined #perl6
02:43 BenGoldberg .tell masak Your "accept" operator sounds a lot like the "amb" nondeterministic choice operator.  Take a look at <http://rosettacode.org/wiki/Amb#Perl>, in particular the first perl5 solution.
02:43 yoleaux BenGoldberg: I'll pass your message to masak.
02:44 TimToady I believe he mentioned amb, in fact
02:44 btyler joined #perl6
02:44 BenGoldberg Oh, nevermind then.
02:45 BenGoldberg :)
03:00 hoverboard joined #perl6
03:14 rurban joined #perl6
03:30 molaf joined #perl6
03:33 sivoais joined #perl6
03:43 sivoais joined #perl6
03:47 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)
04:13 bjz joined #perl6
04:35 rurban joined #perl6
04:55 sivoais joined #perl6
05:26 telex joined #perl6
05:36 rurban joined #perl6
05:47 SamuraiJack joined #perl6
05:58 Rotwang joined #perl6
06:04 virtualsue joined #perl6
06:09 mikegrb joined #perl6
06:11 kaare_ joined #perl6
06:16 darutoko joined #perl6
06:25 zengargoyle left #perl6
06:37 rurban joined #perl6
07:03 itz joined #perl6
07:11 Timbus joined #perl6
07:13 virtualsue joined #perl6
07:38 brrt joined #perl6
07:38 rurban joined #perl6
07:45 bjz_ joined #perl6
08:16 vendethiel joined #perl6
08:21 SevenWolf joined #perl6
08:29 mr-foobar joined #perl6
08:39 rurban joined #perl6
08:48 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 <http://rosettacode.org/wiki/Amb#Perl>, in particular the first perl5 solution.
08:48 masak yes, it might very well be the same as "amb".
08:48 masak biggest difference is that "amb" isn't scoped, but you'd have to scope an "accept" inside of a "collect".
08:55 SamuraiJack joined #perl6
09:08 itz joined #perl6
09:11 spider-mario joined #perl6
09:24 denis_boyun_ joined #perl6
09:38 denis_boyun joined #perl6
09:40 rurban joined #perl6
09:47 Psyche^ joined #perl6
10:01 hoverboard joined #perl6
10:08 vendethiel joined #perl6
10:32 SamuraiJack_ joined #perl6
10:41 rurban joined #perl6
10:50 thou joined #perl6
10:57 pdcawley joined #perl6
10:57 FROGGS[mobile] joined #perl6
11:00 FROGGS hehe, three answers within five minutes :o)
11:00 FROGGS (#perl6)++ # p6u
11:06 jnthn :)
11:08 timotimo we're all right
11:08 colomon o/
11:11 FROGGS jnthn: I have a nice problem when switching to a slang btw
11:12 FROGGS jnthn: when I want to say the match, like in a token: .* { say $/ }, I get:
11:12 FROGGS Cannot find method 'substr': no method cache and no .^find_method
11:12 FROGGS though I can .DUMP the match, and it looks fine
11:12 FROGGS I can also do: say $/.orig.substr($/.orig.from, ...), which is the same as the code that explodes in the setting
11:14 FROGGS I guess that the creation of the cursor in FOREIGN_LANG is to blame... but I'm not sure
11:17 jnthn FROGGS: Might be that you're getting a NQP string leaking out
11:42 rurban joined #perl6
11:47 FROGGS my $s := nqp::findmethod(self, 'orig')(self); say nqp::isstr $s
11:47 FROGGS 1
11:47 FROGGS \o/
11:47 FROGGS jnthn++
11:47 FROGGS now I just need to fix it :o)
12:05 cibs joined #perl6
12:27 brrt joined #perl6
12:38 thou joined #perl6
12:43 rurban joined #perl6
13:00 xinming_ joined #perl6
13:18 guru joined #perl6
13:20 mr-foobar joined #perl6
13:33 anaeem1 joined #perl6
13:44 rurban joined #perl6
13:45 xenoterracide joined #perl6
13:48 SHODAN joined #perl6
13:52 vendethiel joined #perl6
14:06 rurban joined #perl6
14:10 zakharyas joined #perl6
14:26 thou joined #perl6
14:37 chenryn joined #perl6
14:44 bjz joined #perl6
14:48 masak I have a feeling that running `prove -e perl6` isn't so good for optimization.
14:49 masak 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 masak info pertinent to good optimization doesn't carry over from .t file to .t file
14:51 thou joined #perl6
14:52 moritz it would be much better if it automatically precompiled and cached those files
14:53 masak sure.
14:54 masak but that still doesn't adress JITting.
14:54 masak colomon++ commented here: https://github.com/perl6/specs/commit/ca66483bd8cec50859e5b79b9248e48c9d36ab50#commitcomment-6594349
14:54 colomon \o
14:54 masak I'm not sure either what to do with the wording. someone is welcome to give it a second go.
14:55 masak I just copy-pasted a paragraph from infix:</> without any changes.
14:55 zengargoyle joined #perl6
14:55 masak if this one needs changing, maybe the original does, too.
14:55 colomon that explains the oddity.  ;)
14:55 colomon no
14:55 colomon no!
14:55 colomon well… maybe
14:55 colomon but it never makes sense for / to return an Int, and it certainly makes sense for % to return one.
14:57 moritz for a % of fractions?
14:57 kurahaupo joined #perl6
14:57 moritz not more than a / of fractions, IMHO
14:57 colomon Int / Int should return Rat (or Num)
14:57 colomon Int % Int should return Int always
14:58 colomon Rat % Rat should probably return Rat (or Num)
14:58 moritz agreed
14:58 moritz % isn't diffy at all
14:58 colomon FatRat % FatRat should be a FatRat
14:58 * colomon has a 5 year old begging him to bake sugar cookies.
14:59 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
15:00 masak I think Rat % Rat should return Rat, not Num
15:00 masak at least I can't see a case where it'd have to be Num
15:02 colomon masak: it's there
15:02 colomon I thought about it carefully this morning.  :)
15:02 colomon essentially it boils down to Rat + Rat, and that definitely can return a Num
15:03 colomon m: say 1/5 % 1/7
15:03 camelia rakudo-moar 28d672: OUTPUT«0.0285714285714286␤»
15:03 colomon m: say (1/5 % 1/7).perl
15:03 camelia rakudo-moar 28d672: OUTPUT«0.0285714285714286e0␤»
15:04 colomon :(
15:04 colomon n: say (1/5 % 1/7).perl
15:04 camelia niecza v24-109-g48a8de3: OUTPUT«<1/35>␤»
15:04 moritz % is like /, except that it also subtracts stuff aftewards
15:04 masak but Rat - Rat returns a Rat, no?
15:04 moritz so the denominator can grow, and thus overflow the magical 64 bit limit
15:04 masak ok, fairynuff
15:05 moritz I think Rat - Rat can also overflow
15:05 masak yes
15:05 masak because subtraction is addition of something of opposite sign
15:05 masak so, "most of the time" it should return a Rat
15:05 vendethiel joined #perl6
15:05 colomon n: say ((1/5) % (1/7)).perl
15:05 camelia niecza v24-109-g48a8de3: OUTPUT«<2/35>␤»
15:06 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«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/tmpfileâ�¤Variable '$lage' is not declared. Did you mean '$large'?â�¤at /tmp/tmpfile:1â�¤------> [32mmy $large = 2**62; my $d = 1/$lage[33mâ��[31m -  (1/($large - 1)); say $d; say $d…»
15:06 camelia ..niecza v24-109-g48a8de3: OUTPUT«[31m===[0mSORRY![31m===[0mâ�¤â�¤Variable $lage is not predeclared at /tmp/tmpfile line 1:â�¤------> [32mmy $large = 2**62; my $d = 1/[33mâ��[31m$lage -  (1/($large - 1)); say $d; say $[0mâ�¤â�¤Unhandled exception: Check failedâ�¤â�¤  at /home/…»
15:06 moritz p6: my $large = 2**62; my $d = 1/$large -  (1/($large - 1)); say $d; say $d.WHAT
15:06 camelia rakudo-jvm 28d672: OUTPUT«-4.70197740328915E-38␤(Num)␤»
15:06 camelia ..rakudo-{parrot,moar} 28d672: OUTPUT«-4.70197740328915e-38␤(Num)␤»
15:06 camelia ..niecza v24-109-g48a8de3: OUTPUT«-4.70197740328915E-38␤Num()␤»
15:06 colomon n: say ((1/(2**62)) % (1/(-1+2**62))).perl
15:06 camelia niecza v24-109-g48a8de3: OUTPUT«0.00000000000000000021684043449710088680149056017398834228515625␤»
15:14 skids joined #perl6
15:16 jnthn joined #perl6
15:16 Rotwang joined #perl6
15:16 mls joined #perl6
15:16 rhr joined #perl6
15:16 isacloud__ joined #perl6
15:16 pnu joined #perl6
15:17 pdurbin joined #perl6
15:18 guru joined #perl6
15:23 cognominal__ joined #perl6
15:23 dalek specs: 5cad811 | (Konrad Borowski)++ | S03-operators.pod:
15:23 dalek specs: Int % Int should give Int, not Rat.
15:23 dalek specs: review: https://github.com/perl6/specs/commit/5cad8110c9
15:23 xfix I tried improving it slightly.
15:24 xfix Except it still doesn't handle `FatRat` properly.
15:24 skids joined #perl6
15:29 Rotwang joined #perl6
15:30 rindolf joined #perl6
15:36 Alula_ joined #perl6
15:41 mls joined #perl6
15:42 isacloud__ joined #perl6
15:42 pnu joined #perl6
15:42 [Coke] CPS is obviously "Cookies per Second" (cookieclicker)
15:44 * colomon and son now have a batch of sugar cookie dough cooling in the fridge
15:52 * colomon hopes this turns out better than every single time I've tried to make sugar cookies before.  :)
15:55 cognominal joined #perl6
15:57 masak [Coke]: I like that.
15:57 masak [Coke]: I'll try to remember that for my endangered YAPC::EU talk.
16:11 dmol joined #perl6
16:22 Serpent7776 joined #perl6
16:25 guru joined #perl6
16:31 cognominal r:  say(nqp::eqaddr((class A {}), Nil))
16:31 camelia rakudo-{parrot,jvm,moar} 28d672: OUTPUT«0␤»
16:32 cognominal n:  say(nqp::eqaddr((class A {}), NQPMu))
16:32 camelia niecza v24-109-g48a8de3: OUTPUT«[31m===[0mSORRY![31m===[0mâ�¤â�¤Undeclared name:â�¤       'NQPMu' used at line 1â�¤â�¤Unhandled 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…»
16:32 cognominal nqp:  say(nqp::eqaddr((class A {}), NQPMu))
16:32 camelia nqp-{moarvm,parrot}: OUTPUT«1␤»
16:32 camelia ..nqp-jvm: OUTPUT«(signal )#␤# There is insufficient memory for the Java Runtime Environment to continue.␤# pthread_getattr_np␤»
16:34 cognominal How do I test class equality in nqp?
16:35 cognominal nqp::eqaddr does not cut it.
16:35 ajr joined #perl6
16:36 molaf joined #perl6
16:37 cognominal or more likely (class A {}) does not return A
16:39 cognominal 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:␤# »
16:39 camelia ..nqp-{moarvm,parrot}: OUTPUT«0␤»
16:39 cognominal indeed
16:58 carlin joined #perl6
16:59 nebuchadnezzar joined #perl6
17:02 brrt joined #perl6
17:24 colomon joined #perl6
17:24 woosley joined #perl6
17:24 robinsmidsrod joined #perl6
17:24 mtj joined #perl6
17:25 synopsebot joined #perl6
17:38 ren1us joined #perl6
17:39 ren1us is there any particular reason why i wouldn't be able to have a list of lists?
17:40 colomon it's a datastructure, LoL
17:41 ren1us so? still an object
17:41 ren1us at least i assume so
17:41 ren1us because it looks like my sublists are all getting flattened together when i try to access elements
17:41 vendethiel ren1us: you can have one, you just need to itemize them
17:42 vendethiel or something, it looks like nobody's actually able to tell me what is happening or, more importantly, why it's happening
17:43 timotimo or have a list of arrays
17:43 timotimo or an array of arrays
17:43 timotimo m: my @a; @a[1][1] = "hi!"; say @a.perl
17:43 camelia rakudo-moar 28d672: OUTPUT«Array.new(Any, [Any, "hi!"])␤»
17:43 jnthn ren1us: How are you constructing it?
17:44 jnthn m: my @a = [1,2], [3,4]; say @a[1]
17:44 camelia rakudo-moar 28d672: OUTPUT«3 4␤»
17:44 ren1us this is probably a syntactical calamity that i should be ashamed of even thinking of, but:
17:44 ren1us my @rules =     (<visited pt1>, <goal pt1>) => (<finished>), (<visited pt1>, <adjacent pt2>, <not, visited, pt2>) => (<visited, pt2>);
17:45 ren1us 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
17:45 timotimo you could say:
17:45 timotimo you have activated my trap card! mwahahahaha
17:46 timotimo i'm kind of surprised it would flatten through the pair, though
17:46 timotimo m: my @test = ("hey", "how") => "are", "you"; say @test.perl; say @test[0];
17:46 camelia rakudo-moar 28d672: OUTPUT«Array.new($("hey", "how") => "are", "you")␤$("hey", "how") => "are"␤»
17:47 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?
17:47 timotimo that would be quite interesting
17:48 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
17:48 xfix (but this probably would be too strict for dealing with invalid code)
17:48 timotimo however, syntax highlighters benefit greatly from ... yes
17:49 timotimo i wonder how one could build a ruby slippers parser with grammars
17:49 timotimo that would probably be a quite fantastic module to have
17:49 timotimo though to be honest i don't have any experience with using any of those
17:49 xfix It would be fun to have Perl 6 grammar to parse grammars (like ANTLR) that parse programs.
17:50 xfix And there is grammar for Perl 6 grammars in STD.pm6 too, so it's even better.
17:53 rurban joined #perl6
17:54 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"␤»
17:54 ren1us just gives me "test" locally
17:55 rurban1 joined #perl6
17:55 ren1us of course, this is the same install that yells at panda, saying it can't find $*EXECUTABLE or something
17:55 ren1us so i hesitate to trust it
17:57 dmol joined #perl6
17:57 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␤»
17:58 ren1us well that's actually really unfortunate
17:59 timotimo m: say $*PERL
17:59 camelia rakudo-moar 28d672: OUTPUT«Perl 6␤»
17:59 timotimo m: say $*VM;
17:59 camelia rakudo-moar 28d672: OUTPUT«moar (2014.5.18.g.6.b.19.b.4.b)␤»
17:59 timotimo why the many dots there? o_O
18:00 timotimo ren1us: what does perl6 --version look like?
18:00 timotimo This is perl6 version 2014.05-138-g609fb8f built on MoarVM version 2014.05-15-gcdf5c71
18:00 timotimo is mine, for reference
18:01 ren1us This is perl6 version 2014.01 built on parrot 5.9.0 revision 0
18:01 ren1us which should be blatantly wrong
18:02 ren1us ATH=$PATH:$HOME/.perl6/rakudo-star-2014.04/install/bin <--- taken from my ~/.bashrc
18:02 ren1us PATH=*
18:02 timotimo well what does "which perl6" say?
18:03 ren1us ah, i never removed my old version from like... january
18:03 ren1us /usr/local/rakudo-star-2014.01/install/bin/perl6
18:05 ren1us there we go, fixed everything
18:06 timotimo why was that wrong in january? o_O
18:07 ren1us it probably was just a hiccup on my end then too
18:09 timotimo well, i don't recall things being very strange that late
18:09 timotimo i've been around for ~1.5 years and rakudo has always been pretty good
18:09 timotimo what you found there seems like a pretty big problem
18:10 ren1us i find that most simple things i do tend to turn out weird
18:11 timotimo you're very valuable, in that case :)
18:11 timotimo to us, that is
18:11 timotimo you, on the other hand, will be annoyed quite a bit :D
18:11 ren1us it's okay, i'm usually annoyed anyway
18:16 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.   https://github.com/cognominal/nqp/commits/better-metamodel-info
18:18 ren1us well, not everything works.  still can't bootstrap panda
18:25 jsn_ joined #perl6
18:32 colomon ren1us: wait, what can't bootstrap panda?
18:32 brrt joined #perl6
18:33 colomon ren1us: the bleeding edge latest Rakudo-moar is broken and cannot bootstrap panda, if that's what you're trying to do.
18:35 ren1us http://pastebin.com/HuctLHLg
18:35 colomon If that's the case, going back to Rakudo's 9644b265bba2d54900e0ce59a3376eeadfdb43f2 commit works.
18:35 colomon ]oh, no, that's a completely different error than the one I've been getting
18:37 colomon ren1us: is that the panda that came with that r*?
18:37 guru joined #perl6
18:38 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
18:38 colomon there's a tag in panda's git for the last version that would work with that.
18:39 colomon I think this is it?  https://github.com/tadzik/panda/releases/tag/2014.04
18:41 ren1us i'll check it in a moment, trying to hunt down where something's sneaking into my $PATH
18:52 colomon https://www.concertwindow.com/shows/6736-pierre-michaud-new-directions-cello-festival # probably not our pmichaud ;)
18:59 hoverboard joined #perl6
18:59 ren1us colomon: worked perfectly
19:00 colomon \o/
19:03 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␤»
19:03 ren1us is there a good way to do that without having the key list flattened?
19:04 jnthn [<this is>], [<a list>], ...
19:05 jnthn Or (<this is>, <a list>, <of four>, <sublists>).tree =>  "Or is it?"
19:08 ren1us oh wow, those both work.  that's awesome.
19:09 jnthn phew, I didn't try them before suggesting... :)
19:09 ren1us i'm curious.  what do .tree and the extra []s do?
19:10 ren1us just flag it as "Don't flatten me, I like being complicated!"?
19:11 masak [] is an array constructor
19:11 masak .tree (as far as I grok it) takes parcels and makes arrays out of them, recursively
19:16 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:18 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:20 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.
19:20 masak the [] take care of non-flattening/item context.
19:20 jnthn It's really all about scalars
19:21 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>)
19:21 jnthn )
19:22 jnthn 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:23 jnthn 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
19:24 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.
19:24 jnthn r: my @a = <a b>.item, <c d>.item; say @a[1]
19:24 camelia rakudo-{parrot,jvm,moar} 28d672: OUTPUT«c d␤»
19:24 jnthn Right.
19:24 masak right.
19:24 jnthn hey. :P
19:25 vendethiel joined #perl6
19:26 masak quantum entanglement. it happens, on #perl6.
19:29 ren1us that feels much cleaner.  i might just add a postfix operator to call .item or something
19:36 masak r: sub postfix:<!>(@list) { @list.item }; say (<this is>!, <a list>!, <of four>!, <sublists>!).perl
19:37 camelia rakudo-{parrot,jvm,moar} 28d672: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/tmpfileâ�¤Calling 'postfix:<!>' will never work with argument types (str)â�¤    Expected: :(@list)â�¤at /tmp/tmpfile:1â�¤------> [32m is>!, <a list>!, <of four>!, <sublists>[33mâ��[3…»
19:37 masak oh, right.
19:37 masak r: sub postfix:<!>(\list) { list.item }; say (<this is>!, <a list>!, <of four>!, <sublists>!).perl
19:37 camelia rakudo-{parrot,jvm,moar} 28d672: OUTPUT«($("this", "is"), $("a", "list"), $("of", "four"), "sublists")␤»
19:39 jnthn hehe...it even caught your opertor mis-use at compile time there :D
19:41 Serpent7776 joined #perl6
19:43 masak yes :)
19:46 zakharyas joined #perl6
19:50 thou joined #perl6
19:57 rurban joined #perl6
19:57 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")␤»
19:57 vendethiel $()-ish
19:58 timotimo yeah, postfix dereferencing is in perl5 now
20:02 zengargoyle what is `\list`?  a form of sigilless variable or some sort of capture/parcel/whatever thing?
20:04 timotimo sigil-less variable
20:04 timotimo it's meant to signify "neither list nor item semantics are applied, if they weren't there before"
20:04 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:05 timotimo 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.
20:06 timotimo it's also a nice way to have mathematical formulas look nicer
20:06 timotimo m: my \ℕ = (1, 2, 3); say ℕ
20:06 camelia rakudo-moar 28d672: OUTPUT«1 2 3␤»
20:11 Serpent7776 joined #perl6
20:19 pippo joined #perl6
20:20 pippo o/ #perl6
20:20 timotimo hey there pippo
20:20 pippo Some one can direct me on how to use the when construct?
20:21 vendethiel pippo: when is basically `if $_ ~~`
20:22 pippo vendethiel: Thsnk you very much!
20:22 pippo vendethiel: Thank you very much!
20:22 timotimo combines well with things that set $_ ("contextualizers") like for, CATCH, given, ...
20:23 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!␤»
20:23 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!' } }
20:23 camelia rakudo-moar 28d672: OUTPUT«good, go drink␤»
20:23 carlin joined #perl6
20:25 btyler joined #perl6
20:25 timotimo and it also combines well with succeed and proceed
20:25 * vendethiel hasn't done perl 6 in a while now ...
20:25 * cognominal can't figure out what is nqp::p6bindattrinvres
20:25 * vendethiel but has convinced his internship ... "manager" ? to take a look
20:26 jnthn colomon: What it says :D
20:26 jnthn oops
20:26 jnthn cognominal: ^^
20:26 jnthn bind attribute, and take the invocant as the result :)
20:26 jnthn nqp::bindattr(...) evaluates to the bound value rather than the invocant.
20:27 jnthn bindattrinvres is mostly used to get nicer code-gen on some hot paths without introducing a temporary var.
20:27 jnthn And makes the code look nicer too
20:27 cognominal thanx
20:27 pippo jnthn: thank you for the example :-). Is there the possibility to have a when that is matched if all previous are not?
20:28 jnthn default { }
20:28 pippo TY!
20:29 carlin_ joined #perl6
20:30 carlin_ NativeCall on the JVM doesn't seem to like trait_mod:<is>(&foo, :native('libfoo')); hackery
20:31 carlin_ works fine on moar though
20:40 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:48 carlin_ dies in a BEGIN block too
20:49 carlin_ it works with sub foo is native(...); but with trait_mod:<is> it dies with "This representation can not unbox another"
20:52 ivanshmakov joined #perl6
20:54 ivanshmakov joined #perl6
20:59 raiph joined #perl6
21:05 raiph .tell xfix I'm trying to encourage a little cleanup of gh/perl6; http://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.
21:06 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; http://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:06 xfix I doubt that anyone works on these now.
21:07 xfix 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?
21:07 xfix I don't.
21:07 raiph thx
21:07 xfix Only the last commit was my work.
21:10 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 https://questhub.io/realm/perl/quest/534571eabbd0bed24e00006d and http://irclog.perlgeek.de/perl6/2014-06-08#i_8840143)
21:10 yoleaux raiph: I'll pass your message to pmichaud.
21:11 raiph .tell moritz I'm trying to encourage a little cleanup of gh/perl6; please search for 'moritz' in https://questhub.io/realm/perl/quest/534571eabbd0bed24e00006d TIA
21:11 yoleaux raiph: I'll pass your message to moritz.
21:40 xenoterracide joined #perl6
22:18 kst joined #perl6
22:36 BenGoldberg joined #perl6
23:07 hoverboard joined #perl6
23:11 hummeleB1 joined #perl6
23:24 BenGoldberg joined #perl6
23:42 haroldwu joined #perl6
23:44 breinbaas joined #perl6
23:51 haroldwu joined #perl6
23:53 SevenWolf joined #perl6

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

Perl 6 | Reference Documentation | Rakudo