Camelia, the Perl 6 bug

IRC log for #perl6, 2014-11-27

Perl 6 | Reference Documentation | Rakudo | Niecza | Specs

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

All times shown according to UTC.

Time Nick Message
00:00 timotimo m: multi sub f($target, @outers) { "<apply>" ~ f($target, @outers[1..]) ~ "</apply>" }; multi sub f($target, @($a)) { "<apply>" ~ $a ~ $target ~ "</apply>" }; say f("yippie", <foo bar baz quux>);
00:00 camelia rakudo-moar cd9001: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/3vKwgWX1d9�Please use ..* for indefinite range�at /tmp/3vKwgWX1d9:1�------> [32mrs) { "<apply>" ~ f($target, @outers[1..[33m�[31m]) ~ "</apply>" }; multi sub f($target, [0m�»
00:00 timotimo m: multi sub f($target, @outers) { "<apply>" ~ f($target, @outers[1..*]) ~ "</apply>" }; multi sub f($target, @($a)) { "<apply>" ~ $a ~ $target ~ "</apply>" }; say f("yippie", <foo bar baz quux>);
00:00 camelia rakudo-moar cd9001: OUTPUT«<apply><apply><apply><apply>quuxy​ippie</apply></apply></apply></apply>␤»
00:01 timotimo oh, i missed something
00:01 timotimo m: multi sub f($target, @outers) { "<apply>" ~ @outers[0] ~ f($target, @outers[1..*]) ~ "</apply>" }; multi sub f($target, @($a)) { "<apply>" ~ $a ~ $target ~ "</apply>" }; say f("yippie", <foo bar baz quux>);
00:01 camelia rakudo-moar cd9001: OUTPUT«<apply>foo<apply>bar<apply>baz<apply>​quuxyippie</apply></apply></apply></apply>␤»
00:01 adu its not a traditional FP combinator
00:01 timotimo this one's recursive, if you like that
00:02 adu ok
00:02 adu that's good
00:04 adu hanks timo
00:04 adu *thanks
00:05 raydiak timotimo++ # not completely misunderstanding the question like me :)
00:10 smls Why not just:
00:10 smls m: sub f($target, @outers) { [~] @outers.map("<apply>" ~ *), $target, ("</apply>" xx @outers) };   say f("foo", [1, 2, 3]);
00:10 camelia rakudo-moar cd9001: OUTPUT«<apply>1<apply>2<apply>​3foo</apply></apply></apply>␤»
00:24 timotimo yeah, that's much better
00:33 timotimo TimToady: replacing @!neighbours[$x;$y].any === Burning with .grep( Burning ) makes rc-forest-fire a bit faster; does that sound like an acceptable optimization?
00:33 raydiak m: sub foo ($x is copy, @a) { $x = "<apply>$_$x\</apply>" for @a.reverse; $x }; foo("x", <a b c>).say
00:33 camelia rakudo-moar cd9001: OUTPUT«<apply>a<apply>b<apply​>cx</apply></apply></apply>␤»
00:34 timotimo hm. i need to control for randomness
00:34 TimToady you mean in the benchmark?
00:35 timotimo yes
00:35 TimToady the purpose of the benchmark is to measure what's slow, not to cheat around it :)
00:35 timotimo haha! i can just use bench to run the benchmark multiple times!
00:36 timotimo well, i have no clue how to further optimize junctions for now
00:36 TimToady then, er, do it later... :)
00:37 timotimo i guess i had that coming :)
00:37 TimToady the best thing to do here is probably wait for the GLR
00:38 TimToady which may give you a better iterator for any to use
00:39 adu timotimo: sweet!
00:39 adu timotimo++
00:39 timotimo hm?
00:40 TimToady m: say any(1,2,3) == 2
00:40 camelia rakudo-moar cd9001: OUTPUT«any(False, True, False)␤»
00:40 timotimo TimToady: aye. i'm a bit annoyed by how often i reach a point where i go "well, better wait for the GLR to land for this one"
00:40 adu timotimo: smls's improvement
00:40 timotimo but why do i get a ++ for smls' work? :)
00:41 TimToady you'll note that an any with two False's in it has done some extra work it didn't really need to
00:41 adu generalized left-to-right right-most derivation?
00:42 adu smls++
00:42 adu timotimo: you write the first draft
00:47 * raydiak was wondering if multiple instances of the same object should collapse to one in a junction
00:48 timotimo it was also the worst draft :)
00:51 timotimo bench claims with .grep it's 32x per second and with any it's 22x
01:03 adu joined #perl6
01:06 rurban joined #perl6
01:13 raiph joined #perl6
01:15 Mouq joined #perl6
01:21 timotimo m: say "building the core setting generates { 9307097 / 1024 } kilobytes of jitted bytecode (that is { 9307097 / 1024 / 1024 } megabytes)"
01:21 camelia rakudo-moar cd9001: OUTPUT«building the core setting generates 9088.961914 kilobytes of jitted bytecode (that is 8.87593937 megabytes)␤»

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

Perl 6 | Reference Documentation | Rakudo | Niecza | Specs