Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2013-12-22

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:12 jeff_s1 left #perl6
00:15 census joined #perl6
00:24 xenoterracide joined #perl6
00:26 jnap joined #perl6
00:31 laidback_01 joined #perl6
00:33 BenGoldberg joined #perl6
00:46 lue joined #perl6
00:51 aindilis joined #perl6
01:25 cognominal joined #perl6
01:27 jnap joined #perl6
02:13 mtk joined #perl6
02:28 jnap joined #perl6
02:42 TimToady http://rosettacode.org/wiki/Rosetta_Code/Find_bare_lang_tags#Perl_6
02:44 BenGoldberg j: srand(42); print ('hs n elrteaAroP,cH krJeut'.comb).pick(*)
02:44 camelia rakudo-jvm 57a89f: OUTPUT«Just Another Perl Hacker,»
02:44 TimToady :)
02:44 TimToady don't need the first parens
02:44 TimToady j: srand(42); print 'hs n elrteaAroP,cH krJeut'.comb.pick(*)
02:44 camelia rakudo-jvm 57a89f: OUTPUT«Just Another Perl Hacker,»
02:47 BenGoldberg p: srand(42); print ('a'..'z').pick(*)
02:47 BenGoldberg p: srand(42); print ('a'..'z').pick(*)
02:47 camelia rakudo-parrot 57a89f: OUTPUT«ujcdltafvwqynizmeshxokpgbr»
02:47 camelia rakudo-parrot 57a89f: OUTPUT«mpjvcoqwzrabxsegthuynkfild»
02:47 BenGoldberg Parrot doesn't implement srand properly
02:49 BenGoldberg n: srand(42); print ('a'..'z').pick(*)
02:49 BenGoldberg n: srand(42); print ('a'..'z').pick(*)
02:49 camelia niecza v24-108-g17d73e4: OUTPUT«rfbjcqksolmutapzgnwxdvheiy»
02:49 camelia niecza v24-108-g17d73e4: OUTPUT«rfbjcqksolmutapzgnwxdvheiy»
02:49 BenGoldberg niecza does, though, so I could make an srand japh for it :)
02:51 BenGoldberg n: srand(42); print 'Ps c,uret neet AJohrkHalr'.comb.pick(*)
02:51 camelia niecza v24-108-g17d73e4: OUTPUT«Just Another Perl Hacker,»
03:44 colomon joined #perl6
03:55 fgomez joined #perl6
04:08 atroxaper joined #perl6
04:10 kaare__ joined #perl6
04:23 atroxaper joined #perl6
04:29 jnap joined #perl6
04:34 atroxaper joined #perl6
04:55 xenoterracide joined #perl6
04:55 preflex_ joined #perl6
04:57 raiph joined #perl6
05:17 thou joined #perl6
05:30 jnap joined #perl6
05:31 filly joined #perl6
05:33 atroxaper joined #perl6
06:02 atroxaper joined #perl6
06:19 atroxaper joined #perl6
06:35 xenoterracide joined #perl6
06:40 rurban1 joined #perl6
06:54 raiph joined #perl6
07:03 laidback_01 joined #perl6
07:13 moritz \o
07:13 preflex moritz: you have 1 new message. '/msg preflex messages' to read it.
07:24 * moritz home again, with a vomiting child
07:24 rurban1 joined #perl6
07:27 kurahaupo_mobile joined #perl6
07:30 darutoko joined #perl6
08:04 atroxaper joined #perl6
08:28 atroxape_ joined #perl6
08:30 nwc10 oh /o\
08:31 moritz she's sleeping now, and seems to have gotten a bit better
08:32 jnap joined #perl6
08:41 SamuraiJack joined #perl6
08:50 djanatyn joined #perl6
08:54 Tene joined #perl6
08:54 woolfy moritz: sleeping child is good most of the time, hope the kiddo wakes up energeting and wanting to jump on your bed
08:56 araujo joined #perl6
09:03 araujo joined #perl6
09:07 FROGGS p: my $q = "+"; say "aaa" ~~ /a<$q>/ # does somebody know if this shall be allowed?
09:07 camelia rakudo-parrot 57a89f: OUTPUT«Failed allocation of 2923167744 bytes␤Parrot VM: PANIC: Out of mem!␤C file src/gc/gc_gms.c, line 1974␤Parrot file (not available), line (not available)␤␤We highly suggest you notify the Parrot team if you have not been working on␤Parrot.  Use…»
09:12 djanatyn joined #perl6
09:19 rindolf joined #perl6
09:24 FROGGS I think we need to parse that regex at runtime when it contains a variable in an assertion
09:33 jnap joined #perl6
09:34 djanatyn joined #perl6
09:36 dmol joined #perl6
09:36 FROGGS S05 does not tell :o(
09:38 lizmat TimToady: maybe a blog post on your work on rosettacode?
09:48 nwc10 j: my $q = "+"; say "aaa" ~~ /a<$q>/
09:48 camelia rakudo-jvm 57a89f: OUTPUT«(timeout)»
09:49 FROGGS this can't work atm... the question is: should it work at all?
09:49 FROGGS r: my $q = "a+"; say "aaa" ~~ /a<$q>/
09:49 camelia rakudo-parrot 57a89f, rakudo-jvm 57a89f: OUTPUT«「aaa」␤␤»
09:50 FROGGS if you feed it a proper subrule it works
09:50 moritz woolfy: hah, the child woke up, wanted to eat cookies, and was very angry when I didn't allow it :-)
09:50 FROGGS moritz: you are soo mean!
09:50 * FROGGS cries too
09:50 * FROGGS runs away
09:51 FROGGS moritz: btw, I'd propose that we merge moar-support into nom
09:54 moritz FROGGS: I have no objections, but IMHO it's jnthn++'s decision
09:54 FROGGS hmmm, k
09:54 tadzik hmmm, do we have a MutableSet of some kind?
09:56 tadzik ah, SetHash
10:03 tadzik (fwiw, I'd expect Set.values to give me what Set.keys does, not "True True True")
10:06 kivutar joined #perl6
10:10 sqirrel joined #perl6
10:33 tgt joined #perl6
10:34 jnap joined #perl6
10:51 spider-mario joined #perl6
10:53 FROGGS p: multi postcircumfix:<[ ]>(Int $a, Int $b) { say 42 }; 42[1]
10:53 camelia rakudo-parrot 57a89f: OUTPUT«42␤»
10:54 FROGGS p: multi postcircumfix:<“ ”>(Int $a, Int $b) { say 42 }; 42“1”
10:54 camelia rakudo-parrot 57a89f: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/QAFmtVVhErâ�¤Cannot add tokens of category 'postcircumfix'â�¤at /tmp/QAFmtVVhEr:1â�¤------> [32mmulti postcircumfix:<“ â€�>[33mâ��[31m(Int $a, Int $b) { say 42 }; 42“1â€�[0mâ�¤    expectin…»
10:55 djanatyn joined #perl6
11:09 denis_boyun joined #perl6
11:28 djanatyn joined #perl6
11:29 denisboyun joined #perl6
11:33 araujo joined #perl6
11:35 kurahaupo_mobile joined #perl6
11:35 jnap joined #perl6
11:41 PacoAir joined #perl6
11:49 lizmat tadzik: afaik, Set is described as a immutable Hash of Bool
11:49 lizmat why would .values give enything but True's then ?
11:52 tadzik because it's not useful for anything, imho
11:52 denisboyun joined #perl6
11:52 tadzik and values just sounds good, like "Values in a Set"
11:54 lizmat if you have something that you don't know is a Set or a Bag or a Mix, don't you expect .values to give something that's not the key?
11:54 tadzik oh, in that case, yes
11:54 tadzik I agree now
11:56 atroxaper joined #perl6
12:03 woolfy moritz: now I am a bit disappointed that I did not buy any cookies today at the bakery...
12:18 xinming joined #perl6
12:23 jnthn afternoon, #perl6
12:23 * jnthn made it safely to family :)
12:24 timotimo jnthn: \o/
12:24 FROGGS jnthn: hehe, and now you are sitting somewhere in the corner at your laptop? :P
12:24 timotimo jnthn: what's your take on "the error message is better, except if you cause the error in the repl, in which case you either get a null pmc access or infinitely many null pointer exceptions"?
12:26 jnthn FROGGS: No, actually sitting drinking nice coffee while family are away taking care of a couple of errands :)
12:26 jnthn I'll only be around for an hour or so :)
12:26 timotimo jnthn: the error in question is what you get when you write "my int foobar" instead of \foobar or $foobar.
12:27 jnthn timotimo: Is that happening portably or just on NQP on JVM?
12:27 jnthn I know certain errors at the REPL cause it to be very unhappy...
12:27 timotimo didn't get to test it on moar yet
12:27 jnthn And just repeat the error over and over
12:27 jnthn Well, there's Parrot too. The infinite repeating of errors only happend on JVM.
12:27 timotimo well, on jvm i get infinitely many NPE's, on parrot i get a single null pmc access
12:27 jnthn I didn't get chance to look into it.
12:27 jnthn Right
12:28 timotimo it's on rakudo, fwiw
12:28 FROGGS jnthn: shall we merge moar-support into nom now? release is done... (moritz++)
12:28 jnthn So, two bugs. One is the null thingy.
12:28 jnthn FROGGS: I'd rather not do so yet.
12:28 FROGGS jnthn: roger that
12:28 jnthn FROGGS: I'd prefer we do it once it reliably builds for most people.
12:28 FROGGS k
12:28 timotimo okay. before i merge the More Than Less Than Awesome Error Message i'll look more into where the error comes from
12:28 timotimo afk for now
12:28 jnthn timotimo: Yeah, I think there are other cases where this happens.
12:29 jnthn It'd be great to solve them. OTOH, it does mean it's not a specific issue with your improved error, so I'd not block merging that.
12:30 jnthn But yeah, hunting down and fixing the issues with some REPL errors would certainly improve hte REPL experience.
12:31 jnthn FROGGS: From glancing backlog occasionally, I got the impression that lingering GC-invariant-breaking bugs are still haunting the builds of many...
12:32 Rotwang joined #perl6
12:32 FROGGS jnthn: I could reactivate some virtual machines and hope it breaks on one of them... otherwise I don't know where to start
12:33 jnthn FROGGS: Well, if you can get hold of the nwc10++ script (I know he already sent the patches to the mailing list) then you can go hunting that way
12:33 FROGGS yeah, I wanted to ask him what I need to do to get results...
12:34 jnthn That's been the most efficient way to hunt/fix GC issues so far.
12:34 FROGGS btw, I remember there was a $sym.split(' ') to get the sarter/stopper of (post)circumfixes... where lives that code?
12:34 Rotwang hi
12:34 jnthn It doesn't always get the one that's immediately blocking things, but it does always give things that are broken.
12:34 FROGGS hi Rotwang
12:34 Rotwang "I swear the only reason we don’t have factorial as a standard operator in the language, is so that we can impress people by defining it." lol, I was thinking the same thing [;
12:35 jnthn Umm...HLL::Actions iirc
12:35 FROGGS k, thanks!
12:35 jnthn But see the Q grammar, or maybe role STDish
12:35 jnthn Which needs to find the delimeters
12:35 jnap joined #perl6
12:36 denis_boyun joined #perl6
12:37 jnthn FROGGS: ah, yeah. grep for peek_delimiters.
12:37 jnthn oh, wait...no, that's not what you asked.
12:38 jnthn FROGGS: I think you are looking for add_categorical
12:39 FROGGS duh, my journey began there >.<
12:39 FROGGS jnthn++ # thank you
12:40 sqirrel joined #perl6
12:42 jnthn np
12:42 jnthn What're you working on, ooc?
12:44 FROGGS custom postcircumfixes
12:45 jnthn oh, cool :)
12:45 FROGGS :o)
12:46 jnthn We already have custom circumfixes; I suspect you can tkae some inspiration from that code
12:46 FROGGS yeah, I took it as a pattern
12:46 jnthn Looking forward ot seeing a snowman/comet postcircumfix, anyway... :D
12:46 FROGGS ahh, good example
12:49 Biohazard joined #perl6
13:05 dalek rakudo/nom: 265417d | (Timo Paulssen)++ | src/Perl6/Grammar.nqp:
13:05 dalek rakudo/nom: better error when forgetting a sigil in definition
13:05 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/265417dcbf
13:05 dalek roast: b364ac7 | (Timo Paulssen)++ | S02-names-vars/varnames.t:
13:05 dalek roast: test suggesting sigilless var names for my int a; etc.
13:05 dalek roast: review: https://github.com/perl6/roast/commit/b364ac7700
13:08 rindolf joined #perl6
13:19 timotimo well, at least now i know why the jvm infiniloops and parrot just aborts
13:19 timotimo at least i think i do.
13:21 jnthn Cool
13:23 timotimo i think it has to do with the way NPA and NPE are at different levels to jvm and parrot
13:23 timotimo similar to how 6model is more fundamental to moarvm than to parrot
13:23 timotimo afk for a bit again
13:35 Juerd_ joined #perl6
13:36 jnap joined #perl6
13:36 Juerd_ joined #perl6
13:57 raiph joined #perl6
14:04 SamuraiJack joined #perl6
14:08 smls joined #perl6
14:09 smls Just read the "Promises and Channels" advent article by jnthn
14:09 smls Not very excited about  « loop { winner $channel { more $channel { ... } done $channel { last } } »
14:09 smls Is this really supposed to be the standard Perl 6 idiom for processing items from a channel/queue?
14:10 timotimo don't we have a $channel.list?
14:10 smls Three levels of block nesting, just seems excessive.
14:10 smls It seems much simpler in Perl 5:  « while (defined($_ = $queue->dequeue())) { ... } »
14:11 timotimo actually, pretty much the same thing will work in perl6, too
14:11 timotimo let me quickly verify my assumptions
14:12 timotimo you can receive as often as you like and catch the X::Channel::ReceivedOnClosed exception
14:12 timotimo ReceiveOnClosed*
14:13 timotimo if you're guaranteed to be the only receiver on the channel, you can also poll and receive; but if you have more than one thread receiving on the channel, that gives you a race condition
14:14 smls How about merging  « loop { winner * { ... } } »  into a single loop construct:  « whenever { ... } »
14:14 smls (The 'whenever' name was suggested by someone in the advent article's comment section.)
14:14 timotimo doesn't sound bad, aye
14:17 smls Speaking of simplifying nested structures, have you thought about adding syntactic sugar for routines that do nothing but call start {...}?
14:17 smls « sub foo() { start { ... } } »  could become  « sub foo() is promise { ... } »
14:18 smls « @foo.map: -> $x { start { ... } } »  could become  « @foo.map: -> $x { ... } :promise »
14:19 timotimo my &foo = -> { start { ... } } :P
14:20 timotimo hm.
14:20 mtk joined #perl6
14:21 timotimo i don't understand why the payload of the exception is sometimes null when it reaches interactive_exception and sometimes it's not
14:24 jnap joined #perl6
14:32 Soemgyu joined #perl6
14:33 Soemgyu r: enum Players (:X(True) :O(False); Players.enums;
14:33 camelia rakudo-jvm 265417: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/wemch_6oJPâ�¤Unable to parse expression in parenthesized expression; couldn't find final ')' â�¤at /tmp/wemch_6oJP:1â�¤------> [32myers (:X(True) :O(False); Players.enums;[33mâ��[31m<EOL>[0mâ�¤  â€¦Â»
14:33 camelia ..rakudo-parrot 265417: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/BvaL8g1qeW�Unable to parse expression in parenthesized expression; couldn't find final ')' �at /tmp/BvaL8g1qeW:1�------> [32myers (:X(True) :O(False); Players.enums;[33m�[31m<EOL>[0m…»
14:34 Soemgyu r: enum Players (:X(True) :O(False)); Players.enums;
14:34 camelia rakudo-parrot 265417, rakudo-jvm 265417: ( no output )
14:34 Soemgyu r: enum Players (:X(True) :O(False)); say Players.enums;
14:34 camelia rakudo-parrot 265417, rakudo-jvm 265417: OUTPUT«("X" => Bool::True).hash␤»
14:34 Soemgyu Is that right?
14:34 Soemgyu As in, the False key disappears.
14:34 Soemgyu Similarly for slurpy hashes as sub parameters.
14:34 timotimo yes and no :)
14:34 FROGGS r: enum Players (:X(True), :O(False)); say Players.enums;
14:34 camelia rakudo-parrot 265417: OUTPUT«("X" => Bool::True, "O" => Bool::False).hash␤»
14:34 camelia ..rakudo-jvm 265417: OUTPUT«("O" => Bool::False, "X" => Bool::True).hash␤»
14:34 timotimo rakudo doesn't implement it without the comma yet
14:35 Soemgyu Ohh, I see.
14:35 Soemgyu So something missing on my end, thanks.
14:35 FROGGS without the comma the :O is an adverb to the thing before it
14:35 timotimo isn't it supposed to work, though? by spec?
14:35 FROGGS dunno
14:36 timotimo AFK
14:50 xenoterracide joined #perl6
14:57 moritz think it is
14:57 mtk joined #perl6
15:08 ajr joined #perl6
15:09 xenoterracide joined #perl6
15:11 sqirrel joined #perl6
15:20 ajr_ joined #perl6
15:21 kivutar joined #perl6
15:26 gfldex joined #perl6
15:29 ajr_ joined #perl6
15:30 mtk joined #perl6
15:54 rurban1 joined #perl6
15:58 Psyche^_ joined #perl6
16:08 xenoterracide joined #perl6
16:09 dalek mu: fe4aa86 | moritz++ | misc/perl6advent-2013/schedule:
16:09 dalek mu: [advent] claim day 23 with "unary sort"
16:09 dalek mu: review: https://github.com/perl6/mu/commit/fe4aa86548
16:19 Rotwang joined #perl6
16:22 timotimo d'oh, our moarvm stage0 doesn't have eqat
16:23 timotimo huh, the jvm stage0 doesn't have eqat either?
16:23 timotimo didn't we just recently update that?
16:23 FROGGS yes, I think so
16:23 timotimo oh wait. is it actually called eqat_s?
16:23 FROGGS that sounds familiar
16:23 timotimo nqp: say(nqp::eqat_s("foobar", "foo", 0));
16:23 camelia nqp-moarvm: OUTPUT«Error while compiling op eqat_s (source text: "nqp::eqat_s(\"foobar\", \"foo\", 0)"): No registered operation handler for 'eqat_s'␤frame_name_1109␤»
16:23 camelia ..nqp-jvm: OUTPUT«Method 'type' not found for invocant of class 'NQPMu'␤  in coerce (gen/jvm/stage2/QAST.nqp:4205)␤  in as_jast (gen/jvm/stage2/QAST.nqp:2988)␤  in  (gen/jvm/stage2/QAST.nqp:3785)␤  in compile_all_the_stmts (gen/jvm/stage2/QAST.nqp:3773)␤  in as_jast (gen/jvm…»
16:23 camelia ..nqp-parrot: OUTPUT«Error while compiling op eqat_s (source text: "nqp::eqat_s(\"foobar\", \"foo\", 0)"): No registered operation handler for 'eqat_s'␤current instr.: '' pc 57054 (gen/parrot/stage2/QAST.pir:21045) (gen/parrot/stage2/QAST.nqp:3631)␤»
16:23 timotimo nqp: say(nqp::eqat("foobar", "foo", 0));
16:23 camelia nqp-jvm, nqp-parrot: OUTPUT«1␤»
16:23 camelia ..nqp-moarvm: OUTPUT«Error while compiling op eqat (source text: "nqp::eqat(\"foobar\", \"foo\", 0)"): No registered operation handler for 'eqat'␤frame_name_1109␤»
16:24 timotimo moar has no eqat at all? o_O
16:24 timotimo ah well >_>
16:24 FROGGS nqp-m: nqp::eqat
16:24 camelia nqp-moarvm: OUTPUT«Error while compiling op eqat (source text: "nqp::eqat"): No registered operation handler for 'eqat'␤frame_name_1109␤»
16:25 FROGGS nqp/src/vm/moar/QAST/QASTOperationsMAST.nqp:1900:QAST::MASTOperations.add_core_moarop_mapping('eqat', 'eqat_s');
16:25 * FROGGS scratches his head
16:26 moritz outdated stage0?
16:26 moritz or outedated evalbot?
16:26 FROGGS ahh, the latter might be it
16:27 FROGGS nqp-m -e 'nqp::eqat'
16:27 FROGGS Error while compiling op eqat (source text: "nqp::eqat"): Arg count 0 doesn't equal required operand count 4 for op 'eqat_s'
16:27 FROGGS there we go
16:27 FROGGS timotimo: it is called nqp::eqat on all three backends
16:28 FROGGS dunno how early it is there though
16:28 gfldex joined #perl6
16:31 dalek rakudo/nom: d727971 | (Tobias Leich)++ | / (3 files):
16:31 dalek rakudo/nom: fix current regression about variable interpolation in assertions
16:31 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/d727971729
16:32 moritz FROGGS: does that fix the perl5 regex tests?
16:32 FROGGS yes
16:32 moritz and you also re-enabled the tests. great.
16:33 moritz FROGGS++
16:33 FROGGS :o)
16:33 mtk joined #perl6
16:37 Alina-malina left #perl6
16:40 Alina-malina joined #perl6
16:59 PacoAir joined #perl6
17:00 mtk joined #perl6
17:01 mtk joined #perl6
17:02 mtk joined #perl6
17:04 FROGGS hmmm, t/spec/S02-names-vars/varnames.rakudo.parrot fails
17:09 timotimo that was me
17:10 timotimo did you get a recent nom?
17:10 FROGGS yeah
17:11 FROGGS I pulled before I pushed
17:11 FROGGS brb
17:11 timotimo huh. let me check.
17:13 kivutar joined #perl6
17:16 gfldex joined #perl6
17:23 lizmat moritz++
17:27 tgt joined #perl6
17:29 moritz https://gist.github.com/moritz/387fbb263ffb3cb0f9c7 preview of the advent calendar post. Suggestion for a conclusion/finish would be very welcome, as well as other kinds of feedback
17:31 timotimo how do i tell fudgeandrun to use a specific perl6 binary? (-p in this case)
17:32 xinming_ joined #perl6
17:33 Rotwang moritz: below this example: my @sorted = sort * <=> *, @values;
17:33 Rotwang there are some stray characters: my @sorted = sort &infix:«<=>», @values;
17:34 Rotwang LATIN CAPITAL LETTER A WITH CIRCUMFLEX (U+00C2)
17:34 Rotwang or it should be there?
17:34 lizmat moritz: in perl5 example you use .lc, whereas in Perl6 example you use .uc
17:35 lizmat say sort { $^a.lc cmp $^b.lc }, @words;
17:35 lizmat say sort { .uc }, @words;
17:36 timotimo FROGGS: apparently the only wrong thing about it is the number of tests planned
17:37 timotimo ah, i counted the number of tests wrong for throws_like
17:38 timotimo here we go.
17:38 dalek roast: 5734989 | (Timo Paulssen)++ | S02-names-vars/varnames.t:
17:38 dalek roast: throws_like with 1 matcher gives 3 tests, not 2.
17:38 dalek roast: review: https://github.com/perl6/roast/commit/573498973e
17:39 BenGoldberg joined #perl6
17:47 BenGoldberg rn: my $a = all(map { srand(42); (0..9).pick(*).join('') }, 1..9); say so $a eq $a
17:47 camelia rakudo-jvm d72797, niecza v24-108-g17d73e4: OUTPUT«True␤»
17:47 camelia ..rakudo-parrot d72797: OUTPUT«False␤»
17:54 thou joined #perl6
17:57 mtk joined #perl6
17:59 FROGGS timotimo++
18:00 mtk joined #perl6
18:06 mtk joined #perl6
18:08 moritz Rotwang: just and encoding artifact, will fix
18:09 moritz lizmat: thanks, fixing
18:11 eitans joined #perl6
18:27 Juerd Please note: I'm no longer using feather for irc myself. I won't notice stuff like high loads as quickly as before, so please notify me in case of trouble :)
18:29 moritz https://gist.github.com/moritz/387fbb263ffb3cb0f9c7 updated with conlusion, encoding fixes, and by fixing s/uc/lc/. lizmat++, Rotwang++
18:29 djanatyn joined #perl6
18:30 Tene joined #perl6
18:30 Tene joined #perl6
18:48 moritz feedback welcome.
19:05 FROGGS[mobile] joined #perl6
19:13 FROGGS[mobile]2 joined #perl6
19:14 moritz advent post scheduled for publication.
19:23 smls While reading S06, I came across the following statement under "Advanced subroutine features":
19:23 smls "The want function is gone. If you want context specific behavior, return an object instead that responds accordingly to the various contextual methods."
19:24 smls However, that defeats the purpose of what would probably be the most common use-case of a want function (if experience with Perl 5's wantarray is anything to go by):
19:24 smls As a performance optimization.
19:24 smls I.e. one might factor out any calculations that are *only* needed to generate the sub's return value, and skip those calculations entirely if the sub is called in void context.
19:24 moritz smls: not at all
19:24 smls Or perform a potentially simpler set of calculations, if we're "only" in scalar context rather then in list context.
19:24 moritz smls: you can put that calculation into the method of an object you return
19:25 moritz the expensive calculation, that is
19:25 moritz it just requires you to approach the problem at bit differently
19:29 moritz also IMHO a very common use case of wantarray is   wantarray ? @$aref : $aref;
19:30 moritz or wantarray ? @a : @a[0]
19:36 smls joined #perl6
19:37 BenGoldberg joined #perl6
19:37 smls moritz: ok, but constructing such a context-aware object sounds difficult
19:37 smls not something one would do in a simple every-day function
19:39 FROGGS[mobile]2 it just needs to provide .list/.item methods, no?
19:41 FROGGS[mobile]2 and the caller would then do: @( foo() )
19:41 FROGGS[mobile]2 or foo().Str
19:41 FROGGS[mobile]2 or whatever
19:42 smls but would you want to declare and instantiate a custom Class just to return something from a function?
19:43 FROGGS[mobile]2 when I want to return something with a behaviour, I'd return an object, yes
19:43 mtk joined #perl6
19:44 moritz smls: depends on the function
19:44 smls My point is that it makes something more difficult than it was in Perl 5
19:44 mtk joined #perl6
19:45 moritz yes, that's a valid point
19:45 moritz but wantarray/want and multi dispatch simply don't mix
19:45 Ben_Goldberg joined #perl6
19:45 moritz and multi dispatch is at least an order of magnitude more useful, so want had to die.
19:46 moritz multi a(Str $x) { 'Str }; multi a(*@x) { 'List' }; a(b()); # which context is b() called in?
19:47 smls compare you custom-object solution to a simple  « if (defined wantarray) { ... } », or the examples moritz listed above
19:48 smls ok, makes sense
19:51 lumimies joined #perl6
19:53 dbrock joined #perl6
19:54 mtk joined #perl6
19:57 smls joined #perl6
19:58 denysonique joined #perl6
20:01 BenGoldberg joined #perl6
20:05 moritz anyway, in actual Perl 6 applications and modules that doesn't seem to be much of a problem
20:05 moritz also note that creating classes is much more convenient in Perl 6
20:17 lizmat moritz: maybe expand to include sort ~* and sort -~* for lexicographic and reverse lexicographic sort
20:18 lizmat r: say sort ~*, 2,10,300
20:18 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«10 2 300␤»
20:18 lizmat r: say sort -~*, 2,10,300
20:18 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«300 10 2␤»
20:21 lizmat hmm.. that last one doesn't quite do what I expected
20:21 lizmat I guess the - numifies the string after all
20:22 mtk joined #perl6
20:22 FROGGS r: say sort -~*, 2,10,"300a"
20:22 camelia rakudo-jvm d72797: OUTPUT«Cannot convert string to number: trailing characters after number in '300⏏a' (indicated by ⏏)␤  in whatevercode  at /tmp/63JqpSEwvB:1␤  in block  at gen/jvm/CORE.setting:7303␤  in block  at gen/jvm/CORE.setting:7167␤  in method gimme at gen/jvm/…»
20:22 camelia ..rakudo-parrot d72797: OUTPUT«Cannot convert string to number: trailing characters after number in '300⏏a' (indicated by ⏏)␤  in method Numeric at gen/parrot/CORE.setting:12063␤  in sub prefix:<-> at gen/parrot/CORE.setting:3822␤  in sub prefix:<-> at gen/parrot/CORE.settin…»
20:23 FROGGS yes
20:23 moritz lizmat: ..except that -~* doesn't work
20:23 lizmat indeed, I just realized that and why
20:24 lizmat FROGGS: fwiw, there are 4 todo tests passing in the spectest now
20:24 lizmat all in s05-modifier/*.t
20:24 FROGGS yes, I was going to unfudge them
20:25 lizmat moritz: you could consider the -* as quite a cheat  :-)
20:25 denis_boyun joined #perl6
20:25 lizmat afk 30 mins
20:29 dalek roast: 8e7c9fc | (Tobias Leich)++ | S05-m (4 files):
20:29 dalek roast: unfudge now passing tests (var interpolation)
20:29 dalek roast: review: https://github.com/perl6/roast/commit/8e7c9fc12a
20:29 FROGGS lizmat: thanks for the reminder
20:39 FROGGS p: sub a(*@a) { say @a }; sub b(*@a) { goto &a }; sub goto(Callable $r) { say CALLER::DYNAMIC::<&?ROUTINE>; $r() }; b(42)
20:39 camelia rakudo-parrot d72797: OUTPUT«sub b(*@a) { ... }␤␤»
20:39 FROGGS is there a way to inspect how a sub was called?
20:43 moritz what do you mean by "how"?
20:43 FROGGS getting the args
20:43 FROGGS to pass them to another sub with an identical signature
20:43 moritz sub a(\a) { b(|a) }
20:44 FROGGS moritz: I want to implement `goto &name` in v5
20:44 moritz also in rakudo iirc there's an (unspecced) lexicall that contains the original args
20:44 FROGGS ohh
20:44 moritz r: sub f($x) { say ::MY.keys }; f(42)
20:44 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«␤»
20:45 FROGGS QAST::Var(local __args__ :decl(param))
20:45 moritz r: sub f($x) { say callframe(0).my.keys.perl }; f(42)
20:45 camelia rakudo-parrot d72797: OUTPUT«("\$x", "\$_", "\$/", "\$!", "\$*DISPATCHER", "\&?ROUTINE", "RETURN").list␤»
20:45 camelia ..rakudo-jvm d72797: OUTPUT«("\$x", "\$!", "\$*DISPATCHER", "\$_", "\$/", "RETURN", "\&?ROUTINE").list␤»
20:46 telex joined #perl6
20:53 FROGGS r: sub f($x) { say callframe(0).my<$x> }; f(42)
20:53 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«42␤»
20:53 FROGGS r: sub f(*@x) { say callframe(0).my<*@x> }; f(42)
20:53 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«(Any)␤»
20:53 FROGGS r: sub f(*@x) { say callframe(0).my<@x> }; f(42)
20:53 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«42␤»
20:53 raiph joined #perl6
20:53 BenGoldberg rn: sub f($x) { callframe(0).my.keys.sort.perl.say }; f(42)
20:53 camelia niecza v24-108-g17d73e4: OUTPUT«Potential difficulties:â�¤  $x is declared but not used at /tmp/Gu6tFEhHbO line 1:â�¤------> [32msub f([33mâ��[31m$x) { callframe(0).my.keys.sort.perl.say[0mâ�¤â�¤Unhandled exception: Unable to resolve method my in type CallFrameâ�¤  at /tmp/Gu6tF…»
20:53 camelia ..rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«("\$!", "\$*DISPATCHER", "\$/", "\$_", "\$x", "\&?ROUTINE", "RETURN")␤»
20:54 BenGoldberg rn: sub f($x) { $x = $x; callframe(0).my.keys.sort.perl.say }; f(42)
20:54 camelia rakudo-jvm d72797: OUTPUT«Cannot assign to a readonly variable or a value␤  in sub f at /tmp/mGuLulzLJ8:1␤␤»
20:54 camelia ..rakudo-parrot d72797: OUTPUT«Cannot assign to a readonly variable or a value␤  in sub f at /tmp/KapOQDvQai:1␤  in block  at /tmp/KapOQDvQai:1␤␤»
20:54 camelia ..niecza v24-108-g17d73e4: OUTPUT«Unhandled exception: Writing to readonly scalar␤  at /tmp/XWPWSFgnAv line 1 (f @ 3) ␤  at /tmp/XWPWSFgnAv line 1 (mainline @ 4) ␤  at /home/p6eval/niecza/lib/CORE.setting line 4595 (ANON @ 3) ␤  at /home/p6eval/niecza/lib/CORE.setting line 459…»
20:54 BenGoldberg rn: sub f($x) { say $x; callframe(0).my.keys.sort.perl.say }; f(42)
20:54 camelia niecza v24-108-g17d73e4: OUTPUT«42␤Unhandled exception: Unable to resolve method my in type CallFrame␤  at /tmp/XWi5PnZnPP line 1 (f @ 7) ␤  at /tmp/XWi5PnZnPP line 1 (mainline @ 4) ␤  at /home/p6eval/niecza/lib/CORE.setting line 4595 (ANON @ 3) ␤  at /home/p6eval/niecza/l…»
20:54 camelia ..rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«42␤("\$!", "\$*DISPATCHER", "\$/", "\$_", "\$x", "\&?ROUTINE", "RETURN")␤»
20:54 BenGoldberg How is it done on niecza?
20:55 Rotwang r: sub MAIN(Str :$foo) { my @bar = $foo;say "{@bar}"; }
20:55 camelia rakudo-parrot d72797: OUTPUT«Cannot unbox a type object as a native str␤  in method join at gen/parrot/CORE.setting:1593␤  in method Str at gen/parrot/CORE.setting:7515␤  in method Str at gen/parrot/CORE.setting:996␤  in method Stringy at gen/parrot/CORE.setting:1006␤  in …»
20:55 camelia ..rakudo-jvm d72797: OUTPUT«Cannot unbox a type object␤  in method join at gen/jvm/CORE.setting:1580␤  in sub MAIN at /tmp/3uLbFX_Jbx:1␤␤»
20:55 Rotwang is this a bug or not a bug? [;
20:56 BenGoldberg n: sub MAIN(Str :$foo) { my @bar = $foo;say "{@bar}"; }
20:56 camelia niecza v24-108-g17d73e4: OUTPUT«␤»
20:56 BenGoldberg n: sub MAIN(Str :$foo) { my @bar = $foo;say "x{@bar}y"; }
20:56 camelia niecza v24-108-g17d73e4: OUTPUT«xy␤»
20:56 Rotwang yeah, so it seems to be a bug
20:57 FROGGS r: sub MAIN(Str :$foo = "") { my @bar = $foo;say "{@bar}"; }
20:57 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«␤»
20:57 BenGoldberg r: sub f($x) { callframe(0).my.perl.say }; f(42)
20:57 camelia rakudo-jvm d72797: OUTPUT«No such method 'perl' for invocant of type 'Lexotic'␤  in method perl at gen/jvm/CORE.setting:8691␤␤»
20:57 camelia ..rakudo-parrot d72797: OUTPUT«No such method 'perl' for invocant of type 'Continuation'␤  in method perl at gen/parrot/CORE.setting:8716␤  in method perl at gen/parrot/CORE.setting:1018␤  in sub f at /tmp/8jTHYA8ojf:1␤  in block  at /tmp/8jTHYA8ojf:1␤␤»
20:57 FROGGS IMO it should say the same as this in your example:
20:57 FROGGS p: "{Str}"
20:57 camelia rakudo-parrot d72797: OUTPUT«use of uninitialized value of type Str in string context  in block  at /tmp/SN5OvTtksL:1␤␤»
20:58 BenGoldberg r: sub f($x) { callframe(0).my.kv.perl.say }; f(42)
20:58 camelia rakudo-jvm d72797: OUTPUT«("\$x", Mu, "\$!", Mu, "\$*DISPATCHER", Mu, "\$_", Mu, "\$/", Mu, "RETURN", Mu, "\&?ROUTINE", Mu).list␤»
20:58 camelia ..rakudo-parrot d72797: OUTPUT«("\$x", 3, "\$_", 7, "\$/", 11, "\$!", 15, "\$*DISPATCHER", 19, "\&?ROUTINE", 23, "RETURN", 27).list␤»
20:58 BenGoldberg r: sub f($x) { callframe(0).my.kv.sort.perl.say }; f(42)
20:58 camelia rakudo-jvm d72797: OUTPUT«Nominal type check failed for parameter 'null'␤  in block  at gen/jvm/CORE.setting:7808␤  in method sort at gen/jvm/CORE.setting:7802␤␤»
20:58 camelia ..rakudo-parrot d72797: OUTPUT«("\$!", "\$*DISPATCHER", "\$/", "\$_", "\$x", "\&?ROUTINE", 3, 7, 11, 15, 19, 23, 27, "RETURN")␤»
20:58 BenGoldberg Type check failed?
21:00 BenGoldberg r: sub f($x) { callframe(0).my.pairs.sort.perl.say }; f(42)
21:00 camelia rakudo-parrot d72797: OUTPUT«("\$!" => 15, "\$*DISPATCHER" => 19, "\$/" => 11, "\$_" => 7, "\$x" => 3, "\&?ROUTINE" => 23, "RETURN" => 27)␤»
21:00 camelia ..rakudo-jvm d72797: OUTPUT«("\$!" => Mu, "\$*DISPATCHER" => Mu, "\$/" => Mu, "\$_" => Mu, "\$x" => Mu, "\&?ROUTINE" => Mu, "RETURN" => Mu)␤»
21:01 BenGoldberg Shouldn't my.pairs have '$x' => 42?
21:02 BenGoldberg r: sub f($x) { callframe(0).my<RETURN>.say }; f(42)
21:03 camelia rakudo-parrot d72797: OUTPUT«No such method 'say' for invocant of type 'Continuation'␤  in sub f at /tmp/6cW3MdZ0lx:1␤  in block  at /tmp/6cW3MdZ0lx:1␤␤»
21:03 camelia ..rakudo-jvm d72797: OUTPUT«No such method 'say' for invocant of type 'Lexotic'␤␤»
21:03 BenGoldberg Why is one a Continuation, and the other a Lexotic?
21:07 moritz internal leaking out, I think
21:09 Rotwang crap, I've just sent an email to rakudobug without a topic
21:10 Rotwang I guess server will reject this message?
21:10 * moritz has no idea
21:10 moritz never tried that before :-)
21:10 Rotwang no, it was accepted, but it looks ridiculous
21:12 nwc10 what should the subject be?
21:12 Rotwang nwc10: thats the problem, I have no idea [;
21:12 nwc10 oh OK, I can't fix that then :-)
21:12 Rotwang r: my Str $foo; my @bar = $foo;say ~@bar
21:12 camelia rakudo-parrot d72797: OUTPUT«Cannot unbox a type object as a native str␤  in method join at gen/parrot/CORE.setting:1593␤  in method Str at gen/parrot/CORE.setting:7515␤  in method Str at gen/parrot/CORE.setting:996␤  in method Stringy at gen/parrot/CORE.setting:1006␤  in …»
21:12 camelia ..rakudo-jvm d72797: OUTPUT«Cannot unbox a type object␤  in method join at gen/jvm/CORE.setting:1580␤␤»
21:13 nwc10 when you know the answer, get someone to go to https://rt.perl.org/Ticket/Modify.html?id=120846
21:13 nwc10 r: my Str $foo; my @bar = $foo;say ~@bar;
21:13 camelia rakudo-parrot d72797: OUTPUT«Cannot unbox a type object as a native str␤  in method join at gen/parrot/CORE.setting:1593␤  in method Str at gen/parrot/CORE.setting:7515␤  in method Str at gen/parrot/CORE.setting:996␤  in method Stringy at gen/parrot/CORE.setting:1006␤  in …»
21:13 camelia ..rakudo-jvm d72797: OUTPUT«Cannot unbox a type object␤  in method join at gen/jvm/CORE.setting:1580␤␤»
21:14 nwc10 well, at least they agree
21:14 nwc10 :r my Str $foo = ""; my @bar = $foo;say ~@bar;
21:14 nwc10 r: my Str $foo = ""; my @bar = $foo;say ~@bar;
21:15 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«␤»
21:15 Rotwang "Cannot unbox a type object as a native str if object is not defined" is that a good subject?
21:15 nwc10 r: my Str $foo = undef; my @bar = $foo;say ~@bar;
21:15 camelia rakudo-jvm d72797: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/_5SzF97OsWâ�¤Unsupported use of undef as a value; in Perl 6 please use something more specific:â�¤      Any (the "whatever" type object),â�¤      an undefined type object such as Int,â�¤  :!defined as a matcher…»
21:15 camelia ..rakudo-parrot d72797: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/460_CNAFiaâ�¤Unsupported use of undef as a value; in Perl 6 please use something more specific:â�¤   Any (the "whatever" type object),â�¤      an undefined type object such as Int,â�¤  :!defined as a matc…»
21:15 nwc10 see, I don' tknow Perl 6 :-)
21:15 nwc10 r: my Str $foo = $a; my @bar = $foo;say ~@bar;
21:15 camelia rakudo-parrot d72797: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/KHEfiXj9Wkâ�¤Variable '$a' is not declaredâ�¤at /tmp/KHEfiXj9Wk:1â�¤------> [32mmy Str $foo = $a[33mâ��[31m; my @bar = $foo;say ~@bar;[0mâ�¤    expecting any of:â�¤        postfixâ�¤Â»
21:15 camelia ..rakudo-jvm d72797: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/TybFqhMnnSâ�¤Variable '$a' is not declaredâ�¤at /tmp/TybFqhMnnS:1â�¤------> [32mmy Str $foo = $a[33mâ��[31m; my @bar = $foo;say ~@bar;[0mâ�¤    expecting any of:â�¤        postfixâ�¤Â»
21:16 nwc10 r: my $a; my Str $foo = $a; my @bar = $foo;say ~@bar;
21:16 camelia rakudo-parrot d72797: OUTPUT«Type check failed in assignment to '$foo'; expected 'Str' but got 'Any'␤  in block  at /tmp/48LjEmKlzq:1␤␤»
21:16 camelia ..rakudo-jvm d72797: OUTPUT«Type check failed in assignment to '$foo'; expected 'Str' but got 'Any'␤␤»
21:19 Rotwang nwc10: so lets call it: "Cannot unbox a type object as a native str if object is not defined"
21:19 nwc10 updated it.
21:20 Rotwang thank you
21:21 nwc10 no problem. Sorry that I don't actually know enough Perl 6 to be able to comment further on it.
21:21 FROGGS r: sub a(*@a) { say "a: @a" }; sub b(*@a) { goto &a }; sub goto(Callable $r) { $r( |callframe(1).my{ CALLER::DYNAMIC::<&?ROUTINE>.signature.params.map(*.name) } ) }; b(42)
21:21 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«a: @a␤»
21:21 FROGGS moritz++
21:21 FROGGS thanks for the pointer :o)
21:51 cognominal joined #perl6
22:01 Rotwang and what about nqp bugs?
22:01 Rotwang should it be reported to rakudobug?
22:03 FROGGS better as github issues for the nqp repo
22:03 Rotwang ok, thanks
22:04 Rotwang btw. what does give icu support in parrot?
22:04 FROGGS libicu
22:06 Rotwang so without it rakudo won't support utf-8?
22:08 FROGGS I can't describe what will fail exactly
22:08 Rotwang I'm trying to asses if libicu should be provided by default for rakudo
22:26 logie joined #perl6
22:29 dalek rakudo-star-daily: 34584f5 | coke++ | log/ (5 files):
22:29 dalek rakudo-star-daily: today (automated commit)
22:29 dalek rakudo-star-daily: review: https://github.com/coke/rakudo-star-daily/commit/34584f5263
22:29 dalek perl6-roast-data: 6eeba88 | coke++ | / (5 files):
22:29 dalek perl6-roast-data: today (automated commit)
22:29 dalek perl6-roast-data: review: https://github.com/coke/perl6-roast-data/commit/6eeba88c3f
22:30 FROGGS p: macro a { return }; sub b { a; say "ohh?" }; b()
22:30 camelia rakudo-parrot d72797: OUTPUT«ohh?␤»
22:30 FROGGS I was under the impression that the return will land in the sub b before the say statement
22:33 jeffreykegler joined #perl6
22:36 * [Coke] returns from a stereotypical day at the mall.
22:40 BenGoldberg Is there a spectest for srand?  Something like:
22:40 BenGoldberg rn: my $a = all(map { srand(42); (0..9).pick(*).join('') }, 1..9); say so $a eq $a
22:40 camelia rakudo-jvm d72797, niecza v24-108-g17d73e4: OUTPUT«True␤»
22:40 camelia ..rakudo-parrot d72797: OUTPUT«False␤»
22:43 FROGGS BenGoldberg: these are the tests for rand: https://github.com/perl6/roast/blob/master/S32-num/rand.t
22:44 colomon masak++ # blog post on HN
22:44 BenGoldberg Does .pick use the same random seed and state as rand?
22:48 colomon BenGoldberg: yes
22:49 colomon BenGoldberg: and yes to the spectest question as well
22:50 BenGoldberg rn: srand(42); my $a = [~] ('a'..'z').pick(*);srand(42); my $b = [~] ('a'..'z').pick(*); say $a; say $b;
22:50 camelia rakudo-parrot d72797: OUTPUT«edpxafwihynvqmurkjcltzbsog␤fblaydtxzurknjcqhpsigwovem␤»
22:50 camelia ..niecza v24-108-g17d73e4: OUTPUT«rfbjcqksolmutapzgnwxdvheiy␤rfbjcqksolmutapzgnwxdvheiy␤»
22:50 camelia ..rakudo-jvm d72797: OUTPUT«vxbieldnwaptyfogcmkzhsjurq␤vxbieldnwaptyfogcmkzhsjurq␤»
22:51 BenGoldberg Why does rakduo-parrot produce two different strings for $a and $b?
22:51 zakharyas joined #perl6
23:01 colomon bug?
23:02 Ben_Goldberg joined #perl6
23:04 colomon rn: srand(42); say 10.rand; srand(42); say 10.rand
23:04 camelia rakudo-parrot d72797: OUTPUT«7.44525000061007␤7.44525000061007␤»
23:04 camelia ..rakudo-jvm d72797: OUTPUT«7.275636800328681␤7.275636800328681␤»
23:04 camelia ..niecza v24-108-g17d73e4: OUTPUT«6.6887221376824755␤6.6887221376824755␤»
23:04 Ben_Goldberg Clearly srand affects rand properly
23:05 Ben_Goldberg rn: for (^3) { srand(42); ^10.pick(*).say }
23:05 camelia rakudo-parrot d72797, rakudo-jvm d72797, niecza v24-108-g17d73e4: OUTPUT«10␤10␤10␤»
23:05 colomon should be (^10).
23:05 Ben_Goldberg rn: for (^3) { srand(42); (^10).pick(*).say }
23:05 camelia niecza v24-108-g17d73e4: OUTPUT«6 1 0 2 7 3 9 4 8 5␤6 1 0 2 7 3 9 4 8 5␤6 1 0 2 7 3 9 4 8 5␤»
23:05 camelia ..rakudo-parrot d72797: OUTPUT«4 9 3 7 8 6 2 1 0 5␤2 0 7 5 9 4 6 1 3 8␤5 4 9 1 3 7 8 0 6 2␤»
23:05 camelia ..rakudo-jvm d72797: OUTPUT«5 7 1 0 4 3 9 8 2 6␤5 7 1 0 4 3 9 8 2 6␤5 7 1 0 4 3 9 8 2 6␤»
23:06 Ben_Goldberg On parakudo, srand is not affecting .pick
23:07 Ben_Goldberg I notice that the pick tests, at https://github.com/perl6/roast/blob/master/S32-list/pick.t , do not include a test involving srand
23:07 REPLeffect joined #perl6
23:08 Ben_Goldberg rn: for (^3) { srand(42); (^1000).pick(1).say }
23:08 camelia niecza v24-108-g17d73e4: OUTPUT«427␤427␤427␤»
23:08 camelia ..rakudo-jvm d72797: OUTPUT«413␤413␤413␤»
23:08 camelia ..rakudo-parrot d72797: OUTPUT«618␤989␤566␤»
23:10 FROGGS the parrot version uses mp_rand
23:10 xinming joined #perl6
23:11 Ben_Goldberg Is there an mp_srand?  And if so, could parrot's srand call it?
23:11 Ben_Goldberg Not that I comprehend why a multi precision rand is needed for .pick ....
23:15 rurban1 joined #perl6
23:17 FROGGS can't find a mp_srand
23:29 kivutar joined #perl6
23:35 Mouq joined #perl6
23:42 Mouq r: say sort *.trans(([~] 1..9) => ([~] 9...1)), 2,10,300
23:42 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«300 2 10␤»
23:42 Ben_Goldberg Ya know, you could always just use reverse :P
23:43 Mouq yeah, I was revisiting
23:43 Mouq r: say sort -~*, 2,10,300
23:43 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«300 10 2␤»
23:43 Mouq that
23:45 finanalyst joined #perl6
23:54 xenoterracide joined #perl6
23:54 Mouq The code could be simpler, but there seems to be a rakudobug with .trans and closures
23:54 Mouq r: 300.trans: /\d/=>{say $/}
23:54 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«Nil␤Nil␤Nil␤Nil␤»
23:54 Mouq r: 300.trans: /\d/=>{say $_}
23:55 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«Nil␤Nil␤Nil␤Nil␤»
23:55 Mouq Quoth S05: “If the right side of the arrow is a closure, it is evaluated to determine the replacement value. If the left side was matched by a regex, the resulting match object is available within the closure.”
23:56 BenGoldberg joined #perl6
23:58 thou joined #perl6
23:58 ssutch joined #perl6
23:59 BenGoldberg r: say sort ~*, (3, 20, 100).pick(*)
23:59 camelia rakudo-parrot d72797, rakudo-jvm d72797: OUTPUT«100 20 3␤»
23:59 BenGoldberg r: say sort {$b leg $a}, (3, 20, 100).pick(*)
23:59 camelia rakudo-parrot d72797: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/FBYib76uF_â�¤Variable '$b' is not declaredâ�¤at /tmp/FBYib76uF_:1â�¤------> [32msay sort {$b[33mâ��[31m leg $a}, (3, 20, 100).pick(*)[0mâ�¤    expecting any of:â�¤        postfixâ�¤Â»
23:59 camelia ..rakudo-jvm d72797: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/hlwmg6uXdeâ�¤Variable '$b' is not declaredâ�¤at /tmp/hlwmg6uXde:1â�¤------> [32msay sort {$b[33mâ��[31m leg $a}, (3, 20, 100).pick(*)[0mâ�¤    expecting any of:â�¤        postfixâ�¤Â»

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

Perl 6 | Reference Documentation | Rakudo